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