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