merge GHC HEAD
[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
30 ################################################################################
31 #
32 #               Global configuration options
33 #
34 ################################################################################
35
36 # BootingFromHc - build GHC and the libraries from .hc files?
37 # (unregisterised only)
38 BootingFromHc = @BootingFromHc@
39
40 NO_INCLUDE_DEPS = NO
41 NO_INCLUDE_PKGDATA = NO
42
43 # Should we build latex docs?
44 LATEX_DOCS = NO
45
46 # Mac OS X deployment target (to cross-compile for older OS versions)
47 #
48 MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
49 MACOSX_DEPLOYMENT_SDK = @MACOSX_DEPLOYMENT_SDK@
50
51 ifneq "$(MACOSX_DEPLOYMENT_VERSION)" ""
52 MACOSX_DEPLOYMENT_CC_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
53                             -isysroot $(MACOSX_DEPLOYMENT_SDK) \
54                             --no-builtin-fprintf
55 MACOSX_DEPLOYMENT_LD_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
56                             -Wl,-syslibroot,$(MACOSX_DEPLOYMENT_SDK)
57 # We don't extend SRC_CC_OPTS and friends here directly, as (a) they may get
58 # overwritten in build.mk and (b) we must not use the deployment options in
59 # stage 1 or we get a linker error if the bootstrap compiler is for a more 
60 # recent OS version.
61 #
62 # We need --no-builtin-fprintf, as the use of the builtin function optimisation
63 # for fprintf together with #include "PosixSource" in the RTS leads to the
64 # use of fwrite$UNIX2003 (with GCC 4.0.1 on Mac OS X 10.5.2).
65 endif
66
67 ################################################################################
68 #
69 # Variables that control how the compiler itself is built
70 #
71 ################################################################################
72
73 # The compiler used to build GHC is $(GHC).  To change the actual compiler
74 # used, re-configure with --with-ghc=<path-to-ghc>.
75
76 # Extra ways in which to build the compiler (for example, you might want to
77 # build a profiled compiler so you can see where it spends its time)
78 GhcCompilerWays=
79
80 # Extra option flags to pass to the compiler that compiles the compiler
81 # (Ones that are essential are wired into compiler/Makefile)
82 # Typical options to use here:
83 #
84 #       -DDEBUG         include debugging code and assertions (will make the
85 #                       compiler slower and produce debugging output, but useful
86 #                       for development)
87 #
88 #       -dcore-lint     check the types after every pass of the compiler;
89 #                       a pretty strong internal check of the compiler being
90 #                       used to compile GHC.  Useful when bootstrapping.
91 GhcHcOpts=-Rghc-timing
92
93 # Extra options added to specific stages of the compiler bootstrap.
94 # These are placed later on the command line, and may therefore
95 # override options from $(GhcHcOpts).
96 GhcStage1HcOpts=
97 GhcStage2HcOpts=-O2
98 GhcStage3HcOpts=-O2
99
100 # These options modify whether or not a built compiler for a bootstrap
101 # stage defaults to using the new code generation path.  The new
102 # code generation path is a bit slower, so for development just
103 # GhcStage2DefaultNewCodegen=YES, but it's also a good idea to try
104 # building all libraries and the stage2 compiler with the
105 # new code generator, which involves GhcStage1DefaultNewCodegen=YES.
106 GhcStage1DefaultNewCodegen=NO
107 GhcStage2DefaultNewCodegen=NO
108 GhcStage3DefaultNewCodegen=NO
109
110 GhcDebugged=NO
111 GhcDynamic=NO
112
113 # GhcProfiled=YES means compile a profiled stage-2 compiler
114 GhcProfiled=NO
115
116 # Do we support shared libs?
117 SharedLibsPlatformList = i386-unknown-linux x86_64-unknown-linux \
118         i386-unknown-freebsd x86_64-unknown-freebsd \
119         i386-unknown-openbsd x86_64-unknown-openbsd \
120         i386-unknown-mingw32 \
121         i386-apple-darwin powerpc-apple-darwin
122
123 ifeq ($(SOLARIS_BROKEN_SHLD), NO)
124 SharedLibsPlatformList := $(SharedLibsPlatformList) i386-unknown-solaris2
125 endif
126
127 PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),\
128         $(SharedLibsPlatformList)),YES,NO)
129
130 # Build a compiler that will build *unregisterised* libraries and
131 # binaries by default.  Unregisterised code is supposed to compile and
132 # run without any support for architecture-specific assembly mangling,
133 # register assignment or tail-calls, and is therefore a good way to get
134 # started when porting GHC to new architectures.
135 #
136 # If this is set to NO, you can still use the unregisterised way
137 # (way 'u') to get unregisterised code, but the default way will be
138 # registerised.
139 #
140 # NOTE: the stage1 compiler will be a registerised binary (assuming
141 # the compiler you build with is generating registerised binaries), but
142 # the stage2 compiler will be an unregisterised binary.
143 #
144 ifneq "$(findstring $(HostArch_CPP), alpha hppa)" ""
145 GhcUnregisterised=YES
146 else
147 GhcUnregisterised=NO
148 endif
149
150 # Build a compiler with a native code generator backend
151 # (as well as a C backend)
152 #
153 # Target platforms supported:
154 #   i386, powerpc
155 #   AIX is not supported 
156 ArchSupportsNCG=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc)))
157 OsSupportsNCG=$(strip $(patsubst $(HostOS_CPP), YES, $(patsubst aix,,$(HostOS_CPP))))
158
159 # lazy test, because $(GhcUnregisterised) might be set in build.mk later.
160 GhcWithNativeCodeGen=$(strip\
161     $(if $(filter YESYESNO,\
162                   $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO))
163
164 HaveLibDL = @HaveLibDL@
165
166 # ArchSupportsSMP should be set iff there is support for that arch in
167 # includes/stg/SMP.h
168 ArchSupportsSMP=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 sparc powerpc)))
169
170 # lazy test, because $(GhcUnregisterised) might be set in build.mk later.
171 GhcWithSMP=$(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
172
173 # Whether to include GHCi in the compiler.  Depends on whether the RTS linker
174 # has support for this OS/ARCH combination.
175
176 OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin)))
177 ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc sparc64)))
178
179 ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
180 GhcWithInterpreter=YES
181 else 
182 GhcWithInterpreter=NO
183 endif
184
185 # GhcEnableTablesNextToCode tells us whether the target architecture
186 # supports placing info tables directly before the entry code
187 # (see TABLES_NEXT_TO_CODE in the RTS).  Whether we actually compile for
188 # TABLES_NEXT_TO_CODE depends on whether we're building unregisterised
189 # code or not, which may be decided by options to the compiler later.
190 ifneq "$(findstring $(TargetArch_CPP)X, ia64X powerpc64X)" ""
191 GhcEnableTablesNextToCode=NO
192 else
193 GhcEnableTablesNextToCode=YES
194 endif
195
196 # Whether to use libffi for adjustors (foreign import "wrapper") or
197 # not.  If we have built-in support (rts/Adjustor.c) then we use that,
198 # otherwise we fall back on libffi, which is slightly slower.
199 ArchHasAdjustorSupport = $(if $(findstring $(HostArch_CPP),i386 x86_64),YES,NO)
200 ifeq "$(ArchHasAdjustorSupport)" "YES"
201 UseLibFFIForAdjustors=NO
202 else
203 UseLibFFIForAdjustors=YES
204 endif
205
206 # On Windows we normally want to make a relocatable bindist, to we
207 # ignore flags like libdir
208 ifeq "$(Windows)" "YES"
209 RelocatableBuild = YES
210 else
211 RelocatableBuild = NO
212 endif
213
214 # needs to be after $(RelocatableBuild) is set above
215 include $(TOP)/mk/install.mk
216
217 # When building bindists we set this to yes so that the binaries are as
218 # portable as possible.
219 BeConservative = NO
220
221 #
222 # Building various ways?
223 # (right now, empty if not).
224 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
225 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
226
227 #------------------------------------------------------------------------------
228 # Options for Libraries
229
230 # Which directory (in libraries/) contains the integer library?
231 INTEGER_LIBRARY=integer-gmp
232
233 # We build the libraries at least the "vanilla" way (way "v")
234 GhcLibWays = v
235
236 # In addition to the normal sequential way, the default is to also build
237 # profiled prelude libraries unless we are booting from .hc files
238 ifneq "$(BootingFromHc)" "YES"
239 GhcLibWays += p
240 endif
241
242 ifeq "$(PlatformSupportsSharedLibs)" "YES"
243 GhcLibWays += dyn
244 endif
245
246 # Handy way to test whether we're building shared libs or not.
247 BuildSharedLibs=$(strip $(if $(findstring dyn,$(GhcLibWays)),YES,NO))
248
249 # In addition, the RTS is built in some further variations.  Ways that
250 # make sense here:
251
252 #   thr         : threaded
253 #   thr_p       : threaded profiled
254 #   debug       : debugging (compile with -g for the C compiler, and -DDEBUG)
255 #   debug_p     : debugging profiled
256 #   thr_debug   : debugging threaded
257 #   thr_debug_p : debugging threaded profiled
258 #   l           : event logging
259 #   thr_l       : threaded and event logging
260 #
261 GhcRTSWays=l
262
263 # Usually want the debug version
264 ifeq "$(BootingFromHc)" "NO"
265 GhcRTSWays += debug 
266 endif
267
268 # Want the threaded versions unless we're unregisterised
269 # Defer the check until later by using $(if..), because GhcUnregisterised might
270 # be set in build.mk, which hasn't been read yet.
271 GhcRTSWays += $(if $(findstring NO, $(GhcUnregisterised)),thr thr_debug thr_l,)
272 GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),$(if $(findstring NO, $(GhcUnregisterised)),thr_p,),)
273 GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)), dyn debug_dyn $(if $(findstring NO, $(GhcUnregisterised)),thr_dyn thr_debug_dyn),)
274
275 # We can only build GHCi threaded if we have a threaded RTS:
276 GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
277
278 # Option flags to pass to GHC when it's compiling modules in
279 # fptools/libraries.  Typically these are things like -O or
280 # -dcore-lint or -H32m.  The ones that are *essential* are wired into
281 # the build system.
282 #
283 #       -O(2) is pretty desirable, otherwise no inlining of prelude
284 #               things (incl "+") happens when compiling with this compiler
285
286 GhcLibHcOpts=-O2
287
288 # Strip local symbols from libraries?  This can make the libraries smaller,
289 # but makes debugging somewhat more difficult.  Doesn't work with all ld's.
290 #
291 StripLibraries=NO
292
293 # These are the URL patterns that Haddock uses to generate the "Source
294 # File" links on each page.
295 PackageSourceURL = http://darcs.haskell.org/packages/$(PACKAGE)/%{FILE}
296
297 # ----------------------------------------------------------------------------
298 # Object-file splitting
299 #
300 #       Set SplitObjs=YES or NO in your build.mk
301 #
302 #       Don't use -split-objs in in GhcLibHcOpts, because the build
303 #               system needs to do other special magic if you are
304 #               doing object-file splitting
305
306 ArchSupportsSplitObjs=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64 powerpc sparc),YES,NO))
307 OsSupportsSplitObjs=$(strip $(if $(filter $(TargetOS_CPP),mingw32 cygwin32 linux darwin solaris2 freebsd dragonfly netbsd openbsd),YES,NO))
308 SplitObjsBroken = @SplitObjsBroken@
309
310 # lazy test, so that $(GhcUnregisterised) can be set in build.mk
311 SupportsSplitObjs=$(strip \
312                     $(if $(and $(filter YES,$(ArchSupportsSplitObjs)),\
313                                $(filter YES,$(OsSupportsSplitObjs)),\
314                                $(filter NO,$(SplitObjsBroken)),\
315                                $(filter NO,$(BootingFromHc)),\
316                                $(filter NO,$(GhcUnregisterised))),\
317                           YES,NO))
318
319 # By default, enable SplitObjs for the libraries if this build supports it
320 SplitObjs=$(SupportsSplitObjs)
321
322 # ----------------------------------------------------------------------------
323 # Package-related things
324
325 # Extra packages to add to the build, in dependency order
326 EXTRA_PACKAGES =
327
328 # Whether to install $(EXTRA_PACKAGES)
329 InstallExtraPackages = NO
330
331 # Run "ghc-pkg check" on each package
332 CHECK_PACKAGES = NO
333
334 # ----------------------------------------------------------------------------
335 # Options for GHC's RTS
336
337 # For an optimised RTS (you probably don't want to change these; we build
338 # a debugging RTS by default now.  Use -debug to get it).
339 GhcRtsHcOpts=-optc-O2
340 GhcRtsCcOpts=-fomit-frame-pointer
341
342 # Include the front panel code?  Needs GTK+.
343 GhcRtsWithFrontPanel = NO
344
345 # Include support for CPU performance counters via the PAPI library in the RTS?
346 # (PAPI: http://icl.cs.utk.edu/papi/)
347 GhcRtsWithPapi = NO
348 PapiLibDir=
349 PapiIncludeDir=
350
351 ################################################################################
352 #
353 #               Paths (see paths.mk)
354 #
355 ################################################################################
356
357 # Directory used by GHC (and possibly other tools) for storing
358 # temporary files.  If your TMPDIR isn't big enough, either override
359 # this in build.mk or set your environment variable "TMPDIR" to point
360 # to somewhere with more space.  (TMPDIR=. is a good choice).
361
362 # DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
363 # override an environment variable with the value of the make variable
364 # of the same name (if it exists) when executing sub-processes, so
365 # setting the TMPDIR env var would have no effect in the build tree.
366
367 DEFAULT_TMPDIR          = /tmp
368 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
369 DEFAULT_TMPDIR          = /C/TEMP
370 endif
371 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
372 DEFAULT_TMPDIR          = /C/TEMP
373 endif
374
375 BIN_DIST_NAME         = ghc-$(ProjectVersion)
376 BIN_DIST_PREP_DIR     = bindistprep/$(BIN_DIST_NAME)
377 BIN_DIST_PREP_TAR     = bindistprep/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
378 BIN_DIST_PREP_TAR_BZ2 = $(BIN_DIST_PREP_TAR).bz2
379 BIN_DIST_TAR_BZ2      = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
380 BIN_DIST_LIST         = bindist-list
381
382 WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-i386-windows
383 WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
384
385 # -----------------------------------------------------------------------------
386 # Utilities programs: flags 
387
388 # If you want to give any standard flags to pretty much any utility
389 # (see utils.mk for a complete list), by adding a line here
390 #
391 #       SRC_P_OPTS += ...
392 #
393 # where P is the utility. For example, to add -O to all Haskell
394 # compilations, 
395 #
396 #       SRC_HC_OPTS += -O
397
398
399 # SRC_HC_OPTS includes flags to be added to *every* Haskell
400 # compilation.  Setting SRC_HC_OPTS is a good way to set the default
401 # optimisation level (-O) and heap size (-H<size>).
402
403 # SRC_HC_OPTS is *not* for adding flags that are required to make your
404 # build work.  Examples:
405 #
406 #  - instead of using -pgmc/-pgma-/-pgml, use the --with-gcc option to configure
407 #
408 #  - if you need -optc, -opta, or -optl flags, the CONF_CC_* and CONF_LD_*
409 #    variables are more appropriate (set via configure)
410 #
411 # Note that SRC_HC_OPTS are added to every Haskell compilation,
412 # including when using the bootstrapping compiler (stage 0), So don't
413 # put options here that are only supported by very recent GHCs.
414 #
415 SRC_HC_OPTS += -H32m -O
416
417 # These flags make flex 8-bit
418 SRC_FLEX_OPTS   += -8
419
420 # Default fptools options for dllwrap.
421 SRC_BLD_DLL_OPTS += --target=i386-mingw32
422
423 # Flags for CPP when running GreenCard on .pgc files
424 GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__
425
426
427 # -----------------------------------------------------------------------------
428 # Names of programs in the GHC tree
429 #
430 #      xxx_PGM          the name of an executable, without the path
431 #      xxx              the executable relative to the current dir
432
433 GHC_UNLIT_PGM           = unlit$(exeext)
434 GHC_HP2PS_PGM           = hp2ps$(exeext)
435 GHC_GHCTAGS_PGM         = ghctags$(exeext)
436 GHC_HSC2HS_PGM          = hsc2hs$(exeext)
437 GHC_TOUCHY_PGM          = touchy$(exeext)
438 GHC_SPLIT_PGM           = ghc-split
439 GHC_SYSMAN_PGM          = SysMan
440 GHC_GENPRIMOP_PGM       = genprimopcode$(exeext)
441 GHC_GENAPPLY_PGM        = genapply$(exeext)
442 GHC_CABAL_PGM           = ghc-cabal$(exeext)
443 GHC_PKG_PGM             = ghc-pkg$(exeext)
444 GHC_LTX_PGM             = ltx$(exeext)
445 GHC_MKDIRHIER_PGM       = mkdirhier
446 GHC_LNDIR_PGM           = lndir
447
448 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
449 GHC_CP                  = "xcopy /y"
450 GHC_PERL                = perl
451 else
452 GHC_CP                  = $(CP)
453 GHC_PERL                = $(PERL)
454 endif
455
456 HP2PS                   = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
457 SPLIT                   = $(INPLACE_LIB)/$(GHC_SPLIT_PGM)
458 SYSMAN                  = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
459 LTX                     = $(GHC_LTX_DIR)/$(GHC_LTX_PGM)
460 LNDIR                   = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM)
461
462 UNLIT                   = $(INPLACE_LIB)/$(GHC_UNLIT_PGM)
463 TOUCHY                  = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM)
464 MKDIRHIER               = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM)
465 GHC_CABAL_INPLACE       = $(INPLACE_BIN)/$(GHC_CABAL_PGM)
466 GENAPPLY_INPLACE        = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM)
467 GHC_PKG_INPLACE         = $(INPLACE_BIN)/$(GHC_PKG_PGM)
468 GHCTAGS_INPLACE         = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
469 HSC2HS_INPLACE          = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
470 GENPRIMOP_INPLACE       = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
471
472 GENERATED_FILE  = chmod a-w
473 EXECUTABLE_FILE = chmod +x
474
475 #-----------------------------------------------------------------------------
476 # Installed GHC
477
478 # $(GHC) points to installed version of the compiler.
479 #
480 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
481 # (because the version numbers have to be calculated).
482
483 GHC := @WithGhc@
484 # If we have a make dependency on c:/ghc/ghc, and the file is actually
485 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
486 # and that it doesn't know how to create it.
487 ifneq "$(wildcard $(GHC).exe)" ""
488 GHC := $(GHC).exe
489 endif
490
491 # Sometimes we want to invoke ghc from the build tree in different
492 # places (eg. it's handy to have a nofib & a ghc build in the same
493 # tree).  We can refer to "this ghc" as $(GHC_INPLACE):
494
495 GHC_INPLACE = $(GHC_STAGE1)
496
497 GHC_STAGE0_ABS = $(GHC)
498 GHC_STAGE1_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage1$(exeext)
499 GHC_STAGE2_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage2$(exeext)
500 GHC_STAGE3_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage3$(exeext)
501
502 GHC_STAGE0  = $(GHC)
503 GHC_STAGE1  = $(INPLACE_BIN)/ghc-stage1$(exeext)
504 GHC_STAGE2  = $(INPLACE_BIN)/ghc-stage2$(exeext)
505 GHC_STAGE3  = $(INPLACE_BIN)/ghc-stage3$(exeext)
506
507 # Install stage 2 by default, can be changed to 3
508 INSTALL_GHC_STAGE=2
509
510 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
511
512 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf.d
513
514 GhcVersion      = @GhcVersion@
515 GhcPatchLevel   = @GhcPatchLevel@
516 GhcMajVersion   = @GhcMajVersion@
517 GhcMinVersion   = @GhcMinVersion@
518
519 # Keep this in sync with the variables in package-config.mk
520 ghc_ge_613 = @ghc_ge_613@
521
522 # Canonicalised ghc version number, used for easy (integer) version
523 # comparisons.  We must expand $(GhcMinVersion) to two digits by
524 # adding a leading zero if necessary:
525 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
526 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
527 else
528 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
529 endif
530
531 #-----------------------------------------------------------------------------
532 # C compiler
533 #
534 # NB. Don't override $(WhatGccIsCalled) using build.mk,  re-configure using
535 # the flag --with-gcc=<blah> instead.  The reason is that the configure script
536 # needs to know which gcc you're using in order to perform its tests.
537
538 WhatGccIsCalled = @WhatGccIsCalled@
539 GccVersion      = @GccVersion@
540 GccLT34         = @GccLT34@
541 CC              = $(WhatGccIsCalled)
542 CC_STAGE0       = @CC_STAGE0@
543 CC_STAGE1       = $(CC)
544 CC_STAGE2       = $(CC)
545 CC_STAGE3       = $(CC)
546 AS              = $(WhatGccIsCalled)
547 AS_STAGE0       = @CC_STAGE0@
548 AS_STAGE1       = $(AS)
549 AS_STAGE2       = $(AS)
550 AS_STAGE3       = $(AS)
551
552 # C compiler and linker flags from configure (e.g. -m<blah> to select
553 # correct C compiler backend). The stage number is the stage of GHC
554 # that is being used to compile with.
555 CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
556 CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
557 CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
558 CONF_GCC_LINKER_OPTS_STAGE0 = @CONF_GCC_LINKER_OPTS_STAGE0@
559 CONF_GCC_LINKER_OPTS_STAGE1 = @CONF_GCC_LINKER_OPTS_STAGE1@
560 CONF_GCC_LINKER_OPTS_STAGE2 = @CONF_GCC_LINKER_OPTS_STAGE2@
561 CONF_LD_LINKER_OPTS_STAGE0 = @CONF_LD_LINKER_OPTS_STAGE0@
562 CONF_LD_LINKER_OPTS_STAGE1 = @CONF_LD_LINKER_OPTS_STAGE1@
563 CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@
564 CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@
565 CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@
566 CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@
567
568 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
569 CONF_CC_OPTS += -G0
570 endif
571
572 # The .hsc files aren't currently safe for cross-compilation on Windows:
573 #     libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160
574 #     directive "let" is not safe for cross-compilation
575 ifneq "$(Windows)" "YES"
576 SRC_HSC2HS_OPTS += --cross-safe
577 endif
578 SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)))
579 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
580
581 #-----------------------------------------------------------------------------
582 # Mingwex Library
583 #
584 HaveLibMingwEx  = @HaveLibMingwEx@
585 DLLTOOL                 = inplace/mingw/bin/dlltool.exe
586
587 #-----------------------------------------------------------------------------
588 # Flex (currently unused, could be moved to glafp-utils)
589
590 # FLEX                  = @LEX@
591 # Don't bother with -lfl, we define our own yywrap()s anyway.
592 # FLEX_LIB              = 
593 #WAS:FLEX_LIB           = @LEXLIB@
594
595 #-----------------------------------------------------------------------------
596 # Other standard (ha!) Unix utilities
597
598 AR                      = @ArCmd@
599 AR_OPTS                 = @ArArgs@
600 ArSupportsAtFile = @ArSupportsAtFile@
601
602 AR_STAGE0 = @AR_STAGE0@
603 AR_STAGE1 = $(AR)
604 AR_STAGE2 = $(AR)
605 AR_STAGE3 = $(AR)
606 AR_OPTS_STAGE0 = @AR_OPTS_STAGE0@
607 AR_OPTS_STAGE1 = $(AR_OPTS)
608 AR_OPTS_STAGE2 = $(AR_OPTS)
609 AR_OPTS_STAGE3 = $(AR_OPTS)
610 EXTRA_AR_ARGS_STAGE0 = $(EXTRA_AR_ARGS)
611 EXTRA_AR_ARGS_STAGE1 = $(EXTRA_AR_ARGS)
612 EXTRA_AR_ARGS_STAGE2 = $(EXTRA_AR_ARGS)
613 EXTRA_AR_ARGS_STAGE3 = $(EXTRA_AR_ARGS)
614 ArSupportsAtFile_STAGE0 = @ArSupportsAtFile_STAGE0@
615 ArSupportsAtFile_STAGE1 = $(ArSupportsAtFile)
616 ArSupportsAtFile_STAGE2 = $(ArSupportsAtFile)
617 ArSupportsAtFile_STAGE3 = $(ArSupportsAtFile)
618
619 CONTEXT_DIFF            = @ContextDiffCmd@
620 CP                      = cp
621 # It's not easy to separate the CPP program from its flags, as
622 # AC_PROG_CPP defines CPP as "/usr/bin/gcc -E"
623 CPP                     = @CPP@ @CPPFLAGS@
624 CTAGS                   = $(ETAGS)
625 #
626 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
627 # behave plausibly on Haskell sources.
628 #
629 RAWCPP_FLAGS            = -undef -traditional
630 FIND                    = @FindCmd@
631 SORT                    = @SortCmd@
632
633 #
634 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
635 # install-sh script (if chosen). This not terribly useful to us, so we convert
636 # it into an abs. path.
637
638 INSTALL                 = @INSTALL@
639 INSTALL                 := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
640
641 LATEX                   = latex
642 PDFLATEX                = pdflatex
643 BIBTEX                  = bibtex
644 LN_S                    = @LN_S@
645 MV                      = mv
646 NROFF                   = nroff
647 PERL                    = @PerlCmd@
648 PYTHON                  = @PythonCmd@
649 PIC                     = pic
650 RANLIB                  = @RANLIB@
651 SED                     = @SedCmd@
652 TR                      = tr
653 SHELL                   = /bin/sh
654
655 HaveDtrace              = @HaveDtrace@
656 USE_DTRACE = $(HaveDtrace)
657 DTRACE                  = @DtraceCmd@
658
659 LD = @LdCmd@
660 NM = @NmCmd@
661
662 # Some ld's support the -x flag and some don't, so the configure
663 # script detects which we have and sets LdXFlag to "-x" or ""
664 # respectively.
665 LD_X                    = @LdXFlag@
666
667 # GNU ld supports input via a linker script, which is useful to avoid
668 # overflowing command-line length limits.
669 LdIsGNULd               = @LdIsGNULd@
670
671 # Set to YES if ld has the --build-id flag.  Sometimes we need to
672 # disable it with --build-id=none.
673 LdHasBuildId            = @LdHasBuildId@
674
675 # On MSYS, building with SplitObjs=YES fails with 
676 #   ar: Bad file number
677 # see #3201.  We need to specify a smaller max command-line size
678 # to work around it.  32767 doesn't work; 30000 does, but says
679 #     xargs: value for -s option should be < 28153
680 # so we now use 20000 to be comfortably below this bound
681 XARGS = xargs
682 ifeq "$(Windows)" "YES"
683 XARGS_OPTS = -s 20000
684 endif
685
686 #
687 # In emergency situations, REAL_SHELL is used to perform shell commands
688 # from within the ghc driver script, by scribbling the command line to
689 # a temp file and then having $(REAL_SHELL) execute it. 
690 #
691 # The reason for having to do this is that overly long command lines
692 # cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris
693 # 2.5.1), which is why this backdoor is provided. The situation of overly
694 # long command lines is either encountered while doing `make boot' in compiler/, 
695 # or when linking the compiler binary (`hsc'). 
696 #
697 # We do not use SHELL to execute long commands, as `make' will more than likely
698 # override whatever setting you have in your environment while executing. 
699
700 # By default, REAL_SHELL is set equal to SHELL, which is not really a smart move
701 # as it is SHELL that will show up the bogosity in the first place, but setting
702 # it to anything else isn't really portable.
703 #
704 #  ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise)
705 # with REAL_SHELL set to something else than /bin/sh, for instance, your favourite
706 # command shell.
707 #
708 REAL_SHELL     = $(SHELL)
709
710 STRIP_CMD      = strip
711 PATCH_CMD      = @PatchCmd@
712 TAR_CMD        = @TarCmd@
713 BZIP2_CMD      = bzip2
714 GZIP_CMD       = gzip
715
716 HSCOLOUR_CMD   = @HSCOLOUR@
717
718 TIME_CMD       = @TimeCmd@
719
720 # GTK+
721 GTK_CONFIG_CMD = @GTK_CONFIG@
722
723 # Set this if you want to use Inno Setup to build a Windows installer
724 # when you make a bindist
725 ISCC_CMD       =
726
727 #-----------------------------------------------------------------------------
728 # DocBook XML stuff
729
730 BUILD_DOCBOOK_HTML       = @BUILD_DOCBOOK_HTML@
731 BUILD_DOCBOOK_PS         = @BUILD_DOCBOOK_PS@
732 BUILD_DOCBOOK_PDF        = @BUILD_DOCBOOK_PDF@
733 DBLATEX                  = @DblatexCmd@
734 XSLTPROC                 = @XsltprocCmd@
735 XMLLINT                  = @XmllintCmd@
736 HAVE_DOCBOOK_XSL         = @HAVE_DOCBOOK_XSL@
737 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
738 XSLTPROC_LABEL_OPTS      = --stringparam toc.section.depth 3 \
739                            --stringparam section.autolabel 1 \
740                            --stringparam section.label.includes.component.label 1
741
742 #-----------------------------------------------------------------------------
743 #               FPtools support software
744
745 BLD_DLL                 = dllwrap
746
747 #
748 # ghc-pkg
749 #
750 GHC_PKG                 = @GhcPkgCmd@
751
752 #
753 # Happy
754 #
755 HAPPY                   = @HappyCmd@
756 HAPPY_VERSION           = @HappyVersion@                
757 #
758 # Options to pass to Happy when we're going to compile the output with GHC
759 #
760 SRC_HAPPY_OPTS          = -agc --strict
761
762 #
763 # Alex
764 #
765 ALEX                    = @AlexCmd@
766 ALEX_VERSION            = @AlexVersion@         
767 #
768 # Options to pass to Happy when we're going to compile the output with GHC
769 #
770 SRC_ALEX_OPTS           = -g
771
772 # Should we build haddock docs?
773 HADDOCK_DOCS = YES
774 # And HsColour the sources?
775 ifeq "$(HSCOLOUR_CMD)" ""
776 HSCOLOUR_SRCS = NO
777 else
778 HSCOLOUR_SRCS = YES
779 endif
780
781 ################################################################################
782 #
783 #               31-bit-Int Core files
784 #
785 ################################################################################
786
787
788 # It is possible to configure the compiler and prelude to support 31-bit
789 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
790 # architecture.  Currently the only useful output from this option is external Core
791 # files.  The following additions to your build.mk will produce the
792 # 31-bit core output.  Note that this is *not* just a library "way"; the
793 # compiler must be built a special way too.
794
795 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
796 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
797 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
798 # SplitObjs=NO
799
800 ################################################################################
801 #
802 #    Library configure arguments
803 #
804 ################################################################################
805
806 CONFIGURE_ARGS = @CONFIGURE_ARGS@
807
808 ################################################################################
809 #
810 #    To be passed to sub-builds
811 #
812 ################################################################################
813
814 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
815 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
816
817 GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
818 GMP_LIB_DIRS = @GMP_LIB_DIRS@