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