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