Make validate play nice with clang (for Xcode 5 command line tools)
[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 powerpc-unknown-linux
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 ifeq "$(TargetOS_CPP)" "freebsd"
138 # FreeBSD cannot do proper resolution for $ORIGIN (due to a bug in
139 # rtld(1)), so disable it by default (see #7819).
140 DYNAMIC_GHC_PROGRAMS = 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_BZ2 = $(BIN_DIST_PREP_TAR).bz2
391 BIN_DIST_TAR_BZ2 = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
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 # -----------------------------------------------------------------------------
426 # Names of programs in the GHC tree
427
428 MKDIRHIER = $(INPLACE_BIN)/mkdirhier
429
430 GENERATED_FILE = chmod a-w
431 EXECUTABLE_FILE = chmod +x
432
433 #-----------------------------------------------------------------------------
434 # Installed GHC
435
436 # $(GHC) points to installed version of the compiler.
437 #
438 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
439 # (because the version numbers have to be calculated).
440
441 GHC := @WithGhc@
442 # If we have a make dependency on c:/ghc/ghc, and the file is actually
443 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
444 # and that it doesn't know how to create it.
445 ifneq "$(wildcard $(GHC).exe)" ""
446 GHC := $(GHC).exe
447 endif
448
449 GHC_STAGE0 = $(GHC)
450 GHC_STAGE1 = $(ghc-stage1_INPLACE)
451 GHC_STAGE2 = $(ghc-stage2_INPLACE)
452 GHC_STAGE3 = $(ghc-stage3_INPLACE)
453
454 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
455
456 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf.d
457
458 GhcVersion = @GhcVersion@
459 GhcPatchLevel = @GhcPatchLevel@
460 GhcMajVersion = @GhcMajVersion@
461 GhcMinVersion = @GhcMinVersion@
462
463 # Canonicalised ghc version number, used for easy (integer) version
464 # comparisons. We must expand $(GhcMinVersion) to two digits by
465 # adding a leading zero if necessary:
466 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
467 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
468 else
469 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
470 endif
471
472 GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
473
474 #-----------------------------------------------------------------------------
475 # C compiler
476 #
477 # NB. Don't override $(WhatGccIsCalled) using build.mk, re-configure using
478 # the flag --with-gcc=<blah> instead. The reason is that the configure script
479 # needs to know which gcc you're using in order to perform its tests.
480
481 WhatGccIsCalled = @WhatGccIsCalled@
482 GccVersion = @GccVersion@
483 ifeq "$(phase)" "0"
484 CrossCompilePrefix =
485 else
486 CrossCompilePrefix = @CrossCompilePrefix@
487 endif
488 # TargetPlatformFull retains the string passed to configure so we have it in
489 # the necessary format to pass to libffi's configure.
490 TargetPlatformFull = @TargetPlatformFull@
491 GccLT34 = @GccLT34@
492 GccLT46 = @GccLT46@
493 GccIsClang = @GccIsClang@
494
495 CC = $(WhatGccIsCalled)
496 CC_STAGE0 = @CC_STAGE0@
497 CC_STAGE1 = $(CC)
498 CC_STAGE2 = $(CC)
499 CC_STAGE3 = $(CC)
500
501 AS = $(WhatGccIsCalled)
502 AS_STAGE0 = @CC_STAGE0@
503 AS_STAGE1 = $(AS)
504 AS_STAGE2 = $(AS)
505 AS_STAGE3 = $(AS)
506
507 # We don't have an LD_STAGE0. CC_STAGE0 is determined by asking "ghc
508 # --info", and it doesn't report an LD.
509 LD_STAGE0 = error-no-ld-stage0
510 LD_STAGE1 = $(LD)
511 LD_STAGE2 = $(LD)
512 LD_STAGE3 = $(LD)
513
514 # Cross-compiling options
515 #
516 CrossCompiling = @CrossCompiling@
517
518 # Change this to YES if you're building a cross-compiler and don't
519 # want to build stage 2.
520 Stage1Only = NO
521
522 # Install stage 2 by default, or stage 1 in the cross compiler
523 # case. Can be changed to 3
524 INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
525
526 # C compiler and linker flags from configure (e.g. -m<blah> to select
527 # correct C compiler backend). The stage number is the stage of GHC
528 # that is being used to compile with.
529 CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
530 CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
531 CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
532 CONF_GCC_LINKER_OPTS_STAGE0 = @CONF_GCC_LINKER_OPTS_STAGE0@
533 CONF_GCC_LINKER_OPTS_STAGE1 = @CONF_GCC_LINKER_OPTS_STAGE1@
534 CONF_GCC_LINKER_OPTS_STAGE2 = @CONF_GCC_LINKER_OPTS_STAGE2@
535 CONF_LD_LINKER_OPTS_STAGE0 = @CONF_LD_LINKER_OPTS_STAGE0@
536 CONF_LD_LINKER_OPTS_STAGE1 = @CONF_LD_LINKER_OPTS_STAGE1@
537 CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@
538 CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@
539 CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@
540 CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@
541
542 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
543 CONF_CC_OPTS += -G0
544 endif
545
546 # The .hsc files aren't currently safe for cross-compilation on Windows:
547 # libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160
548 # directive "let" is not safe for cross-compilation
549 ifneq "$(Windows_Host)" "YES"
550 SRC_HSC2HS_OPTS += --cross-safe
551 endif
552 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
553
554 define set_stage_HSC2HS_OPTS
555 # $1 = stage
556 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(filter-out -O,$$(SRC_CC_OPTS) $$(CONF_CC_OPTS_STAGE$1)))
557 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(CONF_CPP_OPTS_STAGE$1))
558 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --lflag=,$$(CONF_GCC_LINKER_OPTS_STAGE$1))
559 endef
560 $(eval $(call set_stage_HSC2HS_OPTS,0))
561 $(eval $(call set_stage_HSC2HS_OPTS,1))
562 $(eval $(call set_stage_HSC2HS_OPTS,2))
563 ifeq "$(CrossCompiling)" "YES"
564 SRC_HSC2HS_OPTS_STAGE1 += --cross-compile
565 SRC_HSC2HS_OPTS_STAGE2 += --cross-compile
566 endif
567 SRC_HSC2HS_OPTS_STAGE0 += --cflag=-D$(HostArch_CPP)_HOST_ARCH=1 --cflag=-D$(HostOS_CPP)_HOST_OS=1
568 SRC_HSC2HS_OPTS_STAGE1 += --cflag=-D$(TargetArch_CPP)_HOST_ARCH=1 --cflag=-D$(TargetOS_CPP)_HOST_OS=1
569 SRC_HSC2HS_OPTS_STAGE2 += --cflag=-D$(TargetArch_CPP)_HOST_ARCH=1 --cflag=-D$(TargetOS_CPP)_HOST_OS=1
570
571 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
572 WINDRES = $(INPLACE_MINGW)/bin/windres
573 else ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
574 WINDRES = $(INPLACE_MINGW)/bin/windres
575 endif
576
577 #-----------------------------------------------------------------------------
578 # Mingwex Library
579 #
580 HaveLibMingwEx = @HaveLibMingwEx@
581 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
582 DLLTOOL = inplace/mingw/bin/dlltool.exe
583 else ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
584 DLLTOOL = inplace/mingw/bin/dlltool.exe
585 endif
586
587 #-----------------------------------------------------------------------------
588 # Other standard (ha!) Unix utilities
589
590 AR = @ArCmd@
591 AR_OPTS = @ArArgs@
592 ArSupportsAtFile = @ArSupportsAtFile@
593
594 AR_STAGE0 = @AR_STAGE0@
595 AR_STAGE1 = $(AR)
596 AR_STAGE2 = $(AR)
597 AR_STAGE3 = $(AR)
598 AR_OPTS_STAGE0 = @AR_OPTS_STAGE0@
599 AR_OPTS_STAGE1 = $(AR_OPTS)
600 AR_OPTS_STAGE2 = $(AR_OPTS)
601 AR_OPTS_STAGE3 = $(AR_OPTS)
602 EXTRA_AR_ARGS_STAGE0 = $(EXTRA_AR_ARGS)
603 EXTRA_AR_ARGS_STAGE1 = $(EXTRA_AR_ARGS)
604 EXTRA_AR_ARGS_STAGE2 = $(EXTRA_AR_ARGS)
605 EXTRA_AR_ARGS_STAGE3 = $(EXTRA_AR_ARGS)
606 ArSupportsAtFile_STAGE0 = @ArSupportsAtFile_STAGE0@
607 ArSupportsAtFile_STAGE1 = $(ArSupportsAtFile)
608 ArSupportsAtFile_STAGE2 = $(ArSupportsAtFile)
609 ArSupportsAtFile_STAGE3 = $(ArSupportsAtFile)
610
611 CONTEXT_DIFF = @ContextDiffCmd@
612 CP = cp
613 # It's not easy to separate the CPP program from its flags, as
614 # AC_PROG_CPP defines CPP as "/usr/bin/gcc -E"
615 CPP = @CPP@ @CPPFLAGS@
616 #
617 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
618 # behave plausibly on Haskell sources.
619 #
620 # Clang in particular is a bit more annoying, so we suppress some warnings.
621 RAWCPP_FLAGS = -undef -traditional
622 ifeq "$(CC_CLANG_BACKEND)" "1"
623 RAWCPP_FLAGS += -Wno-invalid-pp-token -Wno-unicode -Wno-trigraphs
624 endif
625
626 FIND = @FindCmd@
627
628 #
629 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
630 # install-sh script (if chosen). This not terribly useful to us, so we convert
631 # it into an abs. path.
632 #
633 INSTALL = @INSTALL@
634 INSTALL := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
635
636 LN_S = @LN_S@
637 MV = mv
638 PERL = @PerlCmd@
639 PIC = pic
640 RANLIB_CMD = @RANLIB_CMD@
641 REAL_RANLIB_CMD = @REAL_RANLIB_CMD@
642 SED = @SedCmd@
643 SHELL = /bin/sh
644
645 HaveDtrace = @HaveDtrace@
646 USE_DTRACE = $(HaveDtrace)
647 DTRACE = @DtraceCmd@
648
649 LD = @LdCmd@
650 NM = @NmCmd@
651 OBJDUMP = @ObjdumpCmd@
652
653 LLC = @LlcCmd@
654 OPT = @OptCmd@
655
656 # GNU ld supports input via a linker script, which is useful to avoid
657 # overflowing command-line length limits.
658 LdIsGNULd = @LdIsGNULd@
659
660 # Set to YES if ld has the --build-id flag. Sometimes we need to
661 # disable it with --build-id=none.
662 LdHasBuildId = @LdHasBuildId@
663
664 # Set to YES if ld has the --no_compact_unwind flag. See #5019
665 # and compiler/main/DriverPipeline.hs.
666 LdHasNoCompactUnwind = @LdHasNoCompactUnwind@
667
668 # On MSYS, building with SplitObjs=YES fails with
669 # ar: Bad file number
670 # see #3201. We need to specify a smaller max command-line size
671 # to work around it. 32767 doesn't work; 30000 does, but says
672 # xargs: value for -s option should be < 28153
673 # so we now use 20000 to be comfortably below this bound
674 XARGS = xargs
675 ifeq "$(Windows_Host)" "YES"
676 XARGS_OPTS = -s 20000
677 endif
678
679 ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
680 STRIP_CMD = $(TOP)/inplace/mingw/bin/strip.exe
681 else
682 STRIP_CMD = strip
683 endif
684 PATCH_CMD = @PatchCmd@
685 TAR_CMD = @TarCmd@
686 BZIP2_CMD = bzip2
687 GZIP_CMD = gzip
688
689 ifeq "$(Windows_Host)" "YES"
690 TOUCH_CMD = $(utils/touchy_dist_INPLACE)
691 TOUCH_DEP = $(TOUCH_CMD)
692 else
693 TOUCH_CMD = touch
694 TOUCH_DEP =
695 endif
696
697 HSCOLOUR_CMD = @HSCOLOUR@
698
699 TIME_CMD = @TimeCmd@
700
701 #-----------------------------------------------------------------------------
702 # DocBook XML stuff
703
704 BUILD_DOCBOOK_HTML = @BUILD_DOCBOOK_HTML@
705 BUILD_DOCBOOK_PS = @BUILD_DOCBOOK_PS@
706 BUILD_DOCBOOK_PDF = @BUILD_DOCBOOK_PDF@
707 DBLATEX = @DblatexCmd@
708 # filename.as.url=0 is needed with dblatex 0.3.4 (#7486)
709 DBLATEX_OPTS = -P 'filename.as.url=0'
710 XSLTPROC = @XsltprocCmd@
711 XMLLINT = @XmllintCmd@
712 HAVE_DOCBOOK_XSL = @HAVE_DOCBOOK_XSL@
713 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
714 XSLTPROC_LABEL_OPTS = --stringparam toc.section.depth 3 \
715 --stringparam section.autolabel 1 \
716 --stringparam section.label.includes.component.label 1
717
718 #-----------------------------------------------------------------------------
719 # FPtools support software
720
721 #
722 # ghc-pkg
723 #
724 GHC_PKG = @GhcPkgCmd@
725
726 #
727 # Happy
728 #
729 HAPPY = @HappyCmd@
730 HAPPY_VERSION = @HappyVersion@
731 #
732 # Options to pass to Happy when we're going to compile the output with GHC
733 #
734 SRC_HAPPY_OPTS = -agc --strict
735
736 #
737 # Alex
738 #
739 ALEX = @AlexCmd@
740 ALEX_VERSION = @AlexVersion@
741 Alex3 = @Alex3@
742 #
743 # Options to pass to Alex when we're going to compile the output with GHC
744 #
745 SRC_ALEX_OPTS = -g
746 ifeq "$(Alex3)" "YES"
747 # The compiler isn't using the Unicode support in Alex 3.0 yet, in fact we do our own
748 # Unicode handling, so diable Alex's.
749 compiler_ALEX_OPTS = --latin1
750 endif
751
752 # Should we build haddock docs?
753 HADDOCK_DOCS = YES
754 # And HsColour the sources?
755 ifeq "$(HSCOLOUR_CMD)" ""
756 HSCOLOUR_SRCS = NO
757 else
758 HSCOLOUR_SRCS = YES
759 endif
760
761 ################################################################################
762 #
763 # 31-bit-Int Core files
764 #
765 ################################################################################
766
767 #
768 # It is possible to configure the compiler and prelude to support 31-bit
769 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
770 # architecture. Currently the only useful output from this option is external Core
771 # files. The following additions to your build.mk will produce the
772 # 31-bit core output. Note that this is *not* just a library "way"; the
773 # compiler must be built a special way too.
774
775 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
776 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
777 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
778 # SplitObjs=NO
779
780 ################################################################################
781 #
782 # Library configure arguments
783 #
784 ################################################################################
785
786 CONFIGURE_ARGS = @CONFIGURE_ARGS@
787
788 ################################################################################
789 #
790 # To be passed to sub-builds
791 #
792 ################################################################################
793
794 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
795 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
796
797 GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
798 GMP_LIB_DIRS = @GMP_LIB_DIRS@