Fix up logic to decide whether shared libs are being built or not
[ghc-hetmet.git] / mk / config.mk.in
1 #                                                                -*-makefile-*-
2 # @configure_input@
3 #
4 ################################################################################
5 #
6 # config.mk.in
7 #
8 # This file supplies defaults for many tweakable build configuration
9 # options.  Some of the defaults are filled in by the autoconf-generated
10 # configure script.
11 #
12 # DO NOT EDIT THIS FILE!
13 #
14 #       - config.mk is auto-generated from config.mk.in by configure.
15 #         If you edit config.mk your changes will be spammed.
16 #
17 #       - Settings in this file may be overriden by giving replacement
18 #         definitions in build.mk.  See build.mk.sample for a good
19 #         starting point for a build.mk file.
20 #
21 #         If you don't have a build.mk file then you get defaults for everything.
22 #         The defaults should provide a reasonable vanilla build.
23
24 # TOP: the top of the fptools hierarchy, absolute path.
25 # On Windows this is a c:/foo/bar style path.
26 TOP             = @hardtop@
27
28 include $(TOP)/mk/project.mk
29 include $(TOP)/mk/install.mk
30
31 ################################################################################
32 #
33 #               Global configuration options
34 #
35 ################################################################################
36
37 # BootingFromHc - build GHC and the libraries from .hc files?
38 # (unregisterised only)
39 BootingFromHc = @BootingFromHc@
40
41 NO_INCLUDE_DEPS = NO
42 NO_INCLUDE_PKGDATA = NO
43
44 # Should we build latex docs?
45 LATEX_DOCS = NO
46
47 # Mac OS X deployment target (to cross-compile for older OS versions)
48 #
49 MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
50 MACOSX_DEPLOYMENT_SDK = @MACOSX_DEPLOYMENT_SDK@
51
52 ifneq "$(MACOSX_DEPLOYMENT_VERSION)" ""
53 MACOSX_DEPLOYMENT_CC_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
54                             -isysroot $(MACOSX_DEPLOYMENT_SDK) \
55                             --no-builtin-fprintf
56 MACOSX_DEPLOYMENT_LD_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
57                             -Wl,-syslibroot,$(MACOSX_DEPLOYMENT_SDK)
58 # We don't extend SRC_CC_OPTS and friends here directly, as (a) they may get
59 # overwritten in build.mk and (b) we must not use the deployment options in
60 # stage 1 or we get a linker error if the bootstrap compiler is for a more 
61 # recent OS version.
62 #
63 # We need --no-builtin-fprintf, as the use of the builtin function optimisation
64 # for fprintf together with #include "PosixSource" in the RTS leads to the
65 # use of fwrite$UNIX2003 (with GCC 4.0.1 on Mac OS X 10.5.2).
66 endif
67
68 ################################################################################
69 #
70 # Variables that control how the compiler itself is built
71 #
72 ################################################################################
73
74 # The compiler used to build GHC is $(GHC).  To change the actual compiler
75 # used, re-configure with --with-ghc=<path-to-ghc>.
76
77 # Extra ways in which to build the compiler (for example, you might want to
78 # build a profiled compiler so you can see where it spends its time)
79 GhcCompilerWays=
80
81 # Extra option flags to pass to the compiler that compiles the compiler
82 # (Ones that are essential are wired into compiler/Makefile)
83 # Typical options to use here:
84 #
85 #       -DDEBUG         include debugging code and assertions (will make the
86 #                       compiler slower and produce debugging output, but useful
87 #                       for development)
88 #
89 #       -dcore-lint     check the types after every pass of the compiler;
90 #                       a pretty strong internal check of the compiler being
91 #                       used to compile GHC.  Useful when bootstrapping.
92 GhcHcOpts=-Rghc-timing
93
94 # Extra options added to specific stages of the compiler bootstrap.
95 # These are placed later on the command line, and may therefore
96 # override options from $(GhcHcOpts).
97 GhcStage1HcOpts=
98 GhcStage2HcOpts=-O2
99 GhcStage3HcOpts=-O2
100
101 GhcProfiled=NO
102 GhcDebugged=NO
103 GhcLibProfiled=$(if $(filter p,$(GhcLibWays)),YES,NO)
104
105 # Do we support shared libs?
106 PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),i386-unknown-linux x86_64-unknown-linux),YES,NO)
107
108 # ToDo later:
109 # BuildStaticLibs=@BuildStaticLibs@
110
111 # Build a compiler that will build *unregisterised* libraries and
112 # binaries by default.  Unregisterised code is supposed to compile and
113 # run without any support for architecture-specific assembly mangling,
114 # register assignment or tail-calls, and is therefore a good way to get
115 # started when porting GHC to new architectures.
116 #
117 # If this is set to NO, you can still use the unregisterised way
118 # (way 'u') to get unregisterised code, but the default way will be
119 # registerised.
120 #
121 # NOTE: the stage1 compiler will be a registerised binary (assuming
122 # the compiler you build with is generating registerised binaries), but
123 # the stage2 compiler will be an unregisterised binary.
124 #
125 ifneq "$(findstring $(HostArch_CPP), alpha hppa)" ""
126 GhcUnregisterised=YES
127 else
128 GhcUnregisterised=NO
129 endif
130
131 # Build a compiler with a native code generator backend
132 # (as well as a C backend)
133 #
134 # Target platforms supported:
135 #   i386, powerpc
136 #   AIX is not supported 
137 ArchSupportsNCG=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc)))
138 OsSupportsNCG=$(strip $(patsubst $(HostOS_CPP), YES, $(patsubst aix,,$(HostOS_CPP))))
139
140 # lazy test, because $(GhcUnregisterised) might be set in build.mk later.
141 GhcWithNativeCodeGen=$(strip\
142     $(if $(filter YESYESNO,\
143                   $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO))
144
145 HaveLibDL = @HaveLibDL@
146
147 # ArchSupportsSMP should be set iff there is support for that arch in
148 # includes/stg/SMP.h
149 ArchSupportsSMP=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 sparc powerpc)))
150
151 # lazy test, because $(GhcUnregisterised) might be set in build.mk later.
152 GhcWithSMP=$(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
153
154 # Whether to include GHCi in the compiler.  Depends on whether the RTS linker
155 # has support for this OS/ARCH combination.
156
157 OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd netbsd openbsd darwin)))
158 ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc sparc64)))
159
160 ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
161 GhcWithInterpreter=YES
162 else 
163 GhcWithInterpreter=NO
164 endif
165
166 # GhcEnableTablesNextToCode tells us whether the target architecture
167 # supports placing info tables directly before the entry code
168 # (see TABLES_NEXT_TO_CODE in the RTS).  Whether we actually compile for
169 # TABLES_NEXT_TO_CODE depends on whether we're building unregisterised
170 # code or not, which may be decided by options to the compiler later.
171 ifneq "$(findstring $(TargetArch_CPP)X, ia64X powerpc64X)" ""
172 GhcEnableTablesNextToCode=NO
173 else
174 GhcEnableTablesNextToCode=YES
175 endif
176
177 # Whether to use libffi for adjustors (foreign import "wrapper") or
178 # not.  If we have built-in support (rts/Adjustor.c) then we use that,
179 # otherwise we fall back on libffi, which is slightly slower.
180 ArchHasAdjustorSupport=$(strip $(if $(findstring $(HostArch_CPP),i386 x86_64 alpha powerpc ia64,),YES,NO))
181 ifeq "$(ArchHasAdjustorSupport)" "YES"
182 UseLibFFIForAdjustors=NO
183 else
184 UseLibFFIForAdjustors=YES
185 endif
186
187 # On Windows we normally want to make a relocatable bindist, to we
188 # ignore flags like libdir
189 ifeq "$(Windows)" "YES"
190 RelocatableBuild = YES
191 else
192 RelocatableBuild = NO
193 endif
194
195 # When building bindists we set this to yes so that the binaries are as
196 # portable as possible.
197 BeConservative = NO
198
199 #
200 # Building various ways?
201 # (right now, empty if not).
202 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
203 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
204
205 #------------------------------------------------------------------------------
206 # Options for Libraries
207
208 # Which directory (in libraries/) contains the integer library?
209 INTEGER_LIBRARY=integer-gmp
210
211 # We build the libraries at least the "vanilla" way (way "v")
212 GhcLibWays = v
213
214 # In addition to the normal sequential way, the default is to also build
215 # profiled prelude libraries unless we are booting from .hc files
216 ifneq "$(BootingFromHc)" "YES"
217 GhcLibWays += p
218 endif
219
220 ifeq "$(PlatformSupportsSharedLibs)" "YES"
221 GhcLibWays += dyn
222 endif
223
224 # Handy way to test whether we're building shared libs or not.
225 BuildSharedLibs=$(strip $(if $(findstring dyn,$(GhcLibWays)),YES,NO))
226
227 # In addition, the RTS is built in some further variations.  Ways that
228 # make sense here:
229
230 #   thr         : threaded
231 #   thr_p       : threaded profiled
232 #   debug       : debugging (compile with -g for the C compiler, and -DDEBUG)
233 #   debug_p     : debugging profiled
234 #   thr_debug   : debugging threaded
235 #   thr_debug_p : debugging threaded profiled
236 #   t           : ticky-ticky profiling
237 #   debug_t     : debugging ticky-ticky profiling
238 #   l           : event logging
239 #   thr_l       : threaded and event logging
240 #
241 GhcRTSWays=l
242
243 # Usually want the debug version
244 ifeq "$(BootingFromHc)" "NO"
245 GhcRTSWays += debug 
246 endif
247
248 # Want the threaded versions unless we're unregisterised
249 # Defer the check until later by using $(if..), because GhcUnregisterised might
250 # be set in build.mk, which hasn't been read yet.
251 GhcRTSWays += $(if $(findstring NO, $(GhcUnregisterised)),thr thr_debug thr_l,)
252 GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),$(if $(findstring NO, $(GhcUnregisterised)),thr_p,),)
253 GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)), dyn debug_dyn $(if $(findstring NO, $(GhcUnregisterised)),thr_dyn thr_debug_dyn),)
254
255 # We can only build GHCi threaded if we have a threaded RTS:
256 GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
257
258 # Option flags to pass to GHC when it's compiling modules in
259 # fptools/libraries.  Typically these are things like -O or
260 # -dcore-lint or -H32m.  The ones that are *essential* are wired into
261 # the build system.
262 #
263 #       -O(2) is pretty desirable, otherwise no inlining of prelude
264 #               things (incl "+") happens when compiling with this compiler
265 #
266 #       -XGenerics switches on generation of support code for 
267 #               derivable type classes.  This is now off by default,
268 #               but we switch it on for the libraries so that we generate
269 #               the code in case someone importing wants it
270
271 GhcLibHcOpts=-O2 -XGenerics
272
273 # Win32 only: Enable the RTS and libraries to be built as DLLs
274 DLLized=@EnableWin32DLLs@
275
276 # Strip local symbols from libraries?  This can make the libraries smaller,
277 # but makes debugging somewhat more difficult.  Doesn't work with all ld's.
278 #
279 StripLibraries=NO
280
281 # These are the URL patterns that Haddock uses to generate the "Source
282 # File" links on each page.
283 PackageSourceURL = http://darcs.haskell.org/packages/$(PACKAGE)/%{FILE}
284
285 # ----------------------------------------------------------------------------
286 # Object-file splitting
287 #
288 #       Set SplitObjs=YES or NO in your build.mk
289 #
290 #       Don't use -split-objs in in GhcLibHcOpts, because the build
291 #               system needs to do other special magic if you are
292 #               doing object-file splitting
293
294 ArchSupportsSplitObjs=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64 powerpc sparc),YES,NO))
295
296 # lazy test, so that $(GhcUnregisterised) can be set in build.mk
297 SupportsSplitObjs=$(strip $(if $(filter YES,$(ArchSupportsSplitObjs)),\
298                     $(if $(filter NO,$(BootingFromHc)),\
299                       $(if $(filter NO,$(GhcUnregisterised)),\
300                         YES,\
301                         NO),\
302                       NO),\
303                     NO))
304
305 # By default, enable SplitObjs for the libraries if this build supports it
306 SplitObjs=$(SupportsSplitObjs)
307
308 # Math library
309 LIBM=@LIBM@
310
311 # .NET interop support?
312 #
313 DotnetSupport=NO
314
315 # Build unix package?
316 #
317 GhcLibsWithUnix=@GhcLibsWithUnix@
318
319 CHECK_PACKAGES = NO
320
321 # ----------------------------------------------------------------------------
322 # Options for GHC's RTS
323
324 # For an optimised RTS (you probably don't want to change these; we build
325 # a debugging RTS by default now.  Use -debug to get it).
326 GhcRtsHcOpts=-optc-O2
327 GhcRtsCcOpts=-fomit-frame-pointer
328
329 # Include the front panel code?  Needs GTK+.
330 GhcRtsWithFrontPanel = NO
331
332 # Include support for CPU performance counters via the PAPI library in the RTS?
333 # (PAPI: http://icl.cs.utk.edu/papi/)
334 GhcRtsWithPapi = NO
335 PapiLibDir=
336 PapiIncludeDir=
337
338 ################################################################################
339 #
340 #               Paths (see paths.mk)
341 #
342 ################################################################################
343
344 # Directory used by GHC (and possibly other tools) for storing
345 # temporary files.  If your TMPDIR isn't big enough, either override
346 # this in build.mk or set your environment variable "TMPDIR" to point
347 # to somewhere with more space.  (TMPDIR=. is a good choice).
348
349 # DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
350 # override an environment variable with the value of the make variable
351 # of the same name (if it exists) when executing sub-processes, so
352 # setting the TMPDIR env var would have no effect in the build tree.
353
354 DEFAULT_TMPDIR          = /tmp
355 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
356 DEFAULT_TMPDIR          = /C/TEMP
357 endif
358 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
359 DEFAULT_TMPDIR          = /C/TEMP
360 endif
361
362 BIN_DIST_TOPDIR_ABS=$(TOP)
363 BIN_DIST_DIR=$(BIN_DIST_TOPDIR_ABS)/$(BIN_DIST_NAME)
364
365 BIN_DIST_NAME=ghc-$(ProjectVersion)
366 BIN_DIST_TAR=$(TOP)/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
367 BIN_DIST_TAR_BZ2=$(BIN_DIST_TAR).bz2
368 BIN_DIST_PREP_DIR=$(TOP)/bindist-prep
369 BIN_DIST_PREP=$(BIN_DIST_PREP_DIR)/$(BIN_DIST_NAME)
370 BIN_DIST_LIST=$(TOP)/bindist-list
371
372 WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-i386-windows
373 WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
374
375 # -----------------------------------------------------------------------------
376 # Utilities programs: flags 
377
378 # If you want to give any standard flags to pretty much any utility
379 # (see utils.mk for a complete list), by adding a line here
380 #
381 #       SRC_P_OPTS += ...
382 #
383 # where P is the utility. For example, to add -O to all Haskell
384 # compilations, 
385 #
386 #       SRC_HC_OPTS += -O
387
388 SRC_HC_OPTS += -H32m -O
389
390 # These flags make flex 8-bit
391 SRC_FLEX_OPTS   += -8
392
393 # Default fptools options for dllwrap.
394 SRC_BLD_DLL_OPTS += --target=i386-mingw32
395
396 # Flags for CPP when running GreenCard on .pgc files
397 GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__
398
399
400 # -----------------------------------------------------------------------------
401 # Names of programs in the GHC tree
402 #
403 #      xxx_PGM          the name of an executable, without the path
404 #      xxx              the executable relative to the current dir
405
406 GHC_UNLIT_PGM           = unlit$(exeext)
407 GHC_HP2PS_PGM           = hp2ps$(exeext)
408 GHC_GHCTAGS_PGM         = ghctags$(exeext)
409 GHC_HSC2HS_PGM          = hsc2hs$(exeext)
410 GHC_TOUCHY_PGM          = touchy$(exeext)
411 GHC_MANGLER_PGM         = ghc-asm
412 GHC_SPLIT_PGM           = ghc-split
413 GHC_SYSMAN_PGM          = SysMan
414 GHC_GENPRIMOP_PGM       = genprimopcode$(exeext)
415 GHC_GENAPPLY_PGM        = genapply$(exeext)
416 GHC_CABAL_PGM           = ghc-cabal$(exeext)
417 GHC_PKG_PGM             = ghc-pkg$(exeext)
418 GHC_MKDEPENDC_PGM       = mkdependC
419 GHC_LTX_PGM             = ltx$(exeext)
420 GHC_MKDIRHIER_PGM       = mkdirhier
421 GHC_LNDIR_PGM           = lndir
422 GHC_DUMMY_GHC_PGM       = dummy-ghc$(exeext)
423
424 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
425 GHC_CP                  = "xcopy /y"
426 GHC_PERL                = perl
427 else
428 GHC_CP                  = $(CP)
429 GHC_PERL                = $(PERL)
430 endif
431
432 HP2PS                   = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
433 MANGLER                 = $(INPLACE_LIB)/$(GHC_MANGLER_PGM)
434 SPLIT                   = $(INPLACE_LIB)/$(GHC_SPLIT_PGM)
435 SYSMAN                  = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
436 LTX                     = $(GHC_LTX_DIR)/$(GHC_LTX_PGM)
437 LNDIR                   = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM)
438
439 UNLIT                   = $(INPLACE_LIB)/$(GHC_UNLIT_PGM)
440 TOUCHY                  = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM)
441 MKDIRHIER               = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM)
442 MKDEPENDC               = $(INPLACE_BIN)/$(GHC_MKDEPENDC_PGM)
443 GHC_CABAL_INPLACE       = $(INPLACE_BIN)/$(GHC_CABAL_PGM)
444 GENAPPLY_INPLACE        = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM)
445 GHC_PKG_INPLACE         = $(INPLACE_BIN)/$(GHC_PKG_PGM)
446 GHCTAGS_INPLACE         = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
447 HSC2HS_INPLACE          = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
448 GENPRIMOP_INPLACE       = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
449 DUMMY_GHC_INPLACE       = $(INPLACE_BIN)/$(GHC_DUMMY_GHC_PGM)
450
451 GENERATED_FILE  = chmod a-w
452 EXECUTABLE_FILE = chmod +x
453
454 #-----------------------------------------------------------------------------
455 # Haskell compilers and mkdependHS
456
457 # $(GHC), $(HBC) and $(NHC) point to installed versions of the relevant
458 # compilers, if available.
459 #
460 # $(HC) is a generic Haskell 98 compiler, set to $(GHC) by default.
461 # $(MKDEPENDHS) is the Haskell dependency generator (ghc -M).
462 #
463 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
464 # (because the version numbers have to be calculated).
465
466 GHC := @WithGhc@
467 # If we have a make dependency on c:/ghc/ghc, and the file is actually
468 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
469 # and that it doesn't know how to create it.
470 ifneq "$(wildcard $(GHC).exe)" ""
471 GHC := $(GHC).exe
472 endif
473
474 GhcDir          = $(dir $(GHC))
475
476 # Set to YES if $(GHC) has the editline package installed
477 GhcHasEditline  = @GhcHasEditline@
478
479 HBC             = @HBC@
480 NHC             = @NHC@
481
482 # Sometimes we want to invoke ghc from the build tree in different
483 # places (eg. it's handy to have a nofib & a ghc build in the same
484 # tree).  We can refer to "this ghc" as $(GHC_INPLACE):
485
486 GHC_INPLACE = $(GHC_STAGE1)
487
488 GHC_STAGE0_ABS = $(GHC)
489 GHC_STAGE1_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage1$(exeext)
490 GHC_STAGE2_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage2$(exeext)
491 GHC_STAGE3_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage3$(exeext)
492
493 GHC_STAGE0  = $(GHC)
494 GHC_STAGE1  = $(INPLACE_BIN)/ghc-stage1$(exeext)
495 GHC_STAGE2  = $(INPLACE_BIN)/ghc-stage2$(exeext)
496 GHC_STAGE3  = $(INPLACE_BIN)/ghc-stage3$(exeext)
497
498 # Install stage 2 by default, can be changed to 3
499 INSTALL_GHC_STAGE=2
500
501 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
502
503 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf
504
505 GhcVersion      = @GhcVersion@
506 GhcPatchLevel   = @GhcPatchLevel@
507 GhcMajVersion   = @GhcMajVersion@
508 GhcMinVersion   = @GhcMinVersion@
509
510 ghc_ge_609 = @ghc_ge_609@
511
512 # Canonicalised ghc version number, used for easy (integer) version
513 # comparisons.  We must expand $(GhcMinVersion) to two digits by
514 # adding a leading zero if necessary:
515 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
516 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
517 else
518 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
519 endif
520
521 #-----------------------------------------------------------------------------
522 # C compiler
523 #
524 # NB. Don't override $(WhatGccIsCalled) using build.mk,  re-configure using
525 # the flag --with-gcc=<blah> instead.  The reason is that the configure script
526 # needs to know which gcc you're using in order to perform its tests.
527
528 HaveGcc         = @HaveGcc@
529 UseGcc          = YES
530 WhatGccIsCalled = @WhatGccIsCalled@
531 GccVersion      = @GccVersion@
532 GccLT34         = @GccLT34@
533 ifeq "$(strip $(HaveGcc))" "YES"
534 ifneq "$(strip $(UseGcc))"  "YES"
535   CC    = cc
536 else
537   CC    = $(WhatGccIsCalled)
538 endif
539 endif
540
541 # C compiler and linker flags from configure (e.g. -m<blah> to select
542 # correct C compiler backend).
543 CONF_CC_OPTS = @CONF_CC_OPTS@
544 CONF_LD_OPTS = @CONF_LD_OPTS@
545
546 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
547 CONF_CC_OPTS += -G0
548 endif
549
550 SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS)))
551 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
552
553 #-----------------------------------------------------------------------------
554 # Mingwex Library
555 #
556 HaveLibMingwEx  = @HaveLibMingwEx@
557
558 #-----------------------------------------------------------------------------
559 # Flex (currently unused, could be moved to glafp-utils)
560
561 # FLEX                  = @LEX@
562 # Don't bother with -lfl, we define our own yywrap()s anyway.
563 # FLEX_LIB              = 
564 #WAS:FLEX_LIB           = @LEXLIB@
565
566 #-----------------------------------------------------------------------------
567 # Other standard (ha!) Unix utilities
568
569 AR                      = @ArCmd@
570 ArSupportsInput         = @ArSupportsInput@
571 # Yuckage: for ghc/utils/parallel -- todo: nuke this dependency!!
572 BASH                    = /usr/local/bin/bash
573
574 CONTEXT_DIFF            = @ContextDiffCmd@
575 CP                      = cp
576 CPP                     = @CPP@ @CPPFLAGS@
577 CTAGS                   = $(ETAGS)
578 #
579 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
580 # behave plausibly on Haskell sources.
581 #
582 RAWCPP_FLAGS            = -undef -traditional
583 FIND                    = @FindCmd@
584 SORT                    = @SortCmd@
585 INSTALL                 = @INSTALL@
586 #
587 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
588 # install-sh script (if chosen). This not terribly useful to us, so we convert
589 # it into an abs. path.
590
591 INSTALL                 := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
592 LATEX                   = latex
593 HEVEA                   = hevea
594 HACHA                   = hacha
595 LN_S                    = @LN_S@
596 MANMACROS               = -man
597 MSMACROS                = -ms
598 MV                      = mv
599 NROFF                   = nroff
600 PERL                    = @PerlCmd@
601 PYTHON                  = @PythonCmd@
602 PIC                     = pic
603 PREPROCESSCMD           = $(CC) -E
604 RANLIB                  = @RANLIB@
605 SED                     = @SedCmd@
606 SHELL                   = /bin/sh
607
608 LD                      = @LdCmd@
609
610 # Some ld's support the -x flag and some don't, so the configure
611 # script detects which we have and sets LdXFlag to "-x" or ""
612 # respectively.
613 LD_X                    = @LdXFlag@
614
615 # GNU ld supports input via a linker script, which is useful to avoid
616 # overflowing command-line length limits.
617 LdIsGNULd               = @LdIsGNULd@
618
619 # On MSYS, building with SplitObjs=YES fails with 
620 #   ar: Bad file number
621 # see #3201.  We need to specify a smaller max command-line size
622 # to work around it.  32767 doesn't work; 30000 does.
623 ifeq "$(Windows)" "YES"
624 XARGS = xargs -s 30000
625 else
626 XARGS = xargs
627 endif
628
629 #
630 # In emergency situations, REAL_SHELL is used to perform shell commands
631 # from within the ghc driver script, by scribbling the command line to
632 # a temp file and then having $(REAL_SHELL) execute it. 
633 #
634 # The reason for having to do this is that overly long command lines
635 # cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris
636 # 2.5.1), which is why this backdoor is provided. The situation of overly
637 # long command lines is either encountered while doing `make boot' in compiler/, 
638 # or when linking the compiler binary (`hsc'). 
639 #
640 # We do not use SHELL to execute long commands, as `make' will more than likely
641 # override whatever setting you have in your environment while executing. 
642
643 # By default, REAL_SHELL is set equal to SHELL, which is not really a smart move
644 # as it is SHELL that will show up the bogosity in the first place, but setting
645 # it to anything else isn't really portable.
646 #
647 #  ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise)
648 # with REAL_SHELL set to something else than /bin/sh, for instance, your favourite
649 # command shell.
650 #
651 REAL_SHELL=$(SHELL)
652 SIZE                    = size
653 STRIP                   = strip
654 PATCH                   = @PatchCmd@
655 TAR                     = @TarCmd@
656 ZIP                     = zip
657
658 HSCOLOUR = @HSCOLOUR@
659
660 #
661 # This is special to literate/, ToDo: add literate-specific
662 # configure setup to literate/.
663 #
664 TBL                     = tbl
665 TEX                     = tex
666 TGRIND                  = tgrind
667 TGRIND_HELPER           = /usr/local/lib/tgrind/tfontedpr # XXX
668 TIB                     = tib
669
670 TIME                    = @TimeCmd@
671 TROFF                   = troff
672 UNAME                   = uname
673
674 # GTK+
675 GTK_CONFIG = @GTK_CONFIG@
676
677 # Set this if you want to use Inno Setup to build a Windows installer
678 # when you make a bindist
679 ISCC                    =
680
681 #-----------------------------------------------------------------------------
682 # DocBook XML stuff
683
684 BUILD_DOCBOOK_HTML       = @BUILD_DOCBOOK_HTML@
685 BUILD_DOCBOOK_PS         = @BUILD_DOCBOOK_PS@
686 BUILD_DOCBOOK_PDF        = @BUILD_DOCBOOK_PDF@
687 DBLATEX                  = @DblatexCmd@
688 XSLTPROC                 = @XsltprocCmd@
689 XMLLINT                  = @XmllintCmd@
690 HAVE_DOCBOOK_XSL         = @HAVE_DOCBOOK_XSL@
691 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
692 XSLTPROC_LABEL_OPTS      = --stringparam toc.section.depth 3 \
693                            --stringparam section.autolabel 1 \
694                            --stringparam section.label.includes.component.label 1
695
696 #-----------------------------------------------------------------------------
697 #               FPtools support software
698
699 BLD_DLL                 = dllwrap
700
701 #
702 # ghc-pkg
703 #
704 GHC_PKG                 = @GhcPkgCmd@
705
706 #
707 # GreenCard
708 #
709 GREENCARD               = @GreenCardCmd@
710 GREENCARD_VERSION       = @GreenCardVersion@            
711
712 #
713 # Happy
714 #
715 HAPPY                   = @HappyCmd@
716 HAPPY_VERSION           = @HappyVersion@                
717 #
718 # Options to pass to Happy when we're going to compile the output with GHC
719 #
720 SRC_HAPPY_OPTS          = -agc --strict
721
722 # Temp. to work around performance problems in the HEAD around 8/12/2003,
723 # A Happy compiled with this compiler needs more stack.
724 SRC_HAPPY_OPTS          += +RTS -K2m -RTS
725
726 #
727 # Alex
728 #
729 ALEX                    = @AlexCmd@
730 ALEX_VERSION            = @AlexVersion@         
731 #
732 # Options to pass to Happy when we're going to compile the output with GHC
733 #
734 SRC_ALEX_OPTS           = -g
735
736 HSTAGS = @HstagsCmd@
737
738 # Should we build haddock docs?
739 HADDOCK_DOCS = YES
740 # And HsColour the sources?
741 ifeq "$(HSCOLOUR)" ""
742 HSCOLOUR_SRCS = NO
743 else
744 HSCOLOUR_SRCS = YES
745 endif
746
747 #
748 # Options for compiling in different `ways'. 
749
750 # To configure up your own way, have a look at some of the standard ways
751 # such as profiling, and create your own set of WAY_*_OPTS defs below.
752 # After having done that, add your way string to WAYS, and after having
753 # run the configure script, the different projects will add the new way
754 # to the list of ways they support.
755 #
756
757 #
758 # Definitions of the different ways:
759 #   
760 #   * their name:
761 #          - tag, e.g., p
762 #          - description, e.g., profiling
763 #   * what they mean to the driver:
764 #          - WAY_p_HC_OPTS gives the list of command-line options
765 #            to the driver.
766 #
767
768 #
769 # The ways currently defined.
770 #
771 ALL_WAYS=v p t l s mp mg debug dyn thr thr_l debug_dyn thr_dyn thr_debug_dyn thr_p thr_debug debug_p thr_debug_p
772
773 #
774 # The following ways currently have treated specially, p t mg,
775 # as the driver script treats these guys specially and needs to carefully be told
776 # about the options for these. Hence, we hide the required command line options
777 # for these in the driver, as this is the only place they are needed.
778
779 # If you want to add to these default options, fill in the variables below:
780
781 # Way 'v':
782 WAY_v_NAME=vanilla
783 WAY_v_HC_OPTS= 
784
785 # Way 'p':
786 WAY_p_NAME=profiling
787 WAY_p_HC_OPTS= -prof
788
789 # Way 't':
790 WAY_t_NAME=ticky-ticky profiling
791 WAY_t_HC_OPTS= -ticky
792
793 # Way 'l':
794 WAY_l_NAME=event logging
795 WAY_l_HC_OPTS= -eventlog
796
797 # Way `mp': 
798 WAY_mp_NAME=parallel
799 WAY_mp_HC_OPTS=-parallel
800
801 # Way `mg': 
802 WAY_mg_NAME=GranSim
803 WAY_mg_HC_OPTS=-gransim
804
805 #
806 # These ways apply to the RTS only:
807 #
808
809 # Way 'thr':
810 WAY_thr_NAME=threaded
811 WAY_thr_HC_OPTS=-optc-DTHREADED_RTS
812
813 # Way 'thr_p':
814 WAY_thr_p_NAME=threaded profiled
815 WAY_thr_p_HC_OPTS=-optc-DTHREADED_RTS -prof
816
817 # Way 'thr_l':
818 WAY_thr_l_NAME=threaded event logging
819 WAY_thr_l_HC_OPTS=-optc-DTHREADED_RTS -eventlog
820
821 # Way 'debug':
822 WAY_debug_NAME=debug
823 WAY_debug_HC_OPTS=-optc-DDEBUG
824
825 # Way 'debug_p':
826 WAY_debug_p_NAME=debug profiled
827 WAY_debug_p_HC_OPTS=-optc-DDEBUG -prof
828
829 # Way 'debug_t':
830 WAY_debug_t_NAME=debug ticky-ticky profiling
831 WAY_debug_t_HC_OPTS= -ticky -optc-DDEBUG
832
833 # Way 'thr_debug':
834 WAY_thr_debug_NAME=threaded
835 WAY_thr_debug_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG
836
837 # Way 'thr_debug_p':
838 WAY_thr_debug_p_NAME=threaded debug profiling
839 WAY_thr_debug_p_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -prof
840
841 # Way 'dyn': build dynamic shared libraries
842 WAY_dyn_NAME=dyn
843 WAY_dyn_HC_OPTS=-fPIC -dynamic
844
845 # Way 'thr_dyn':
846 WAY_thr_dyn_NAME=thr_dyn
847 WAY_thr_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS
848
849 # Way 'thr_debug_dyn':
850 WAY_thr_debug_dyn_NAME=thr_dyn
851 WAY_thr_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS -optc-DDEBUG
852
853 # Way 'debug_dyn':
854 WAY_debug_dyn_NAME=thr_dyn
855 WAY_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DDEBUG
856
857 ################################################################################
858 #
859 #               31-bit-Int Core files
860 #
861 ################################################################################
862
863
864 # It is possible to configure the compiler and prelude to support 31-bit
865 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
866 # architecture.  Currently the only useful output from this option is external Core
867 # files.  The following additions to your build.mk will produce the
868 # 31-bit core output.  Note that this is *not* just a library "way"; the
869 # compiler must be built a special way too.
870
871 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
872 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
873 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
874 # SplitObjs=NO
875
876 ################################################################################
877 #
878 #    Library configure arguments
879 #
880 ################################################################################
881
882 CONFIGURE_ARGS = @CONFIGURE_ARGS@
883
884 ################################################################################
885 #
886 #    To be passed to sub-builds
887 #
888 ################################################################################
889
890 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
891 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
892
893 ################################################################################
894 #
895 #    Bindist testing directory
896 #
897 ################################################################################
898
899 ifeq "$(Windows)" "YES"
900 BIN_DIST_INST_SUBDIR = "install dir"
901 else
902 # I very much doubt that paths with spaces will work on Unix
903 BIN_DIST_INST_SUBDIR = installed
904 endif
905
906 BIN_DIST_INST_DIR = $(TOP)/bindisttest/$(BIN_DIST_INST_SUBDIR)
907