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