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