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