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