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