Merge branch 'master' of win:c:/ghc/git/cygwin/.
[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 # Do we support shared libs?
92 SharedLibsPlatformList = \
93 i386-unknown-linux x86_64-unknown-linux \
94 i386-unknown-freebsd x86_64-unknown-freebsd \
95 i386-unknown-openbsd x86_64-unknown-openbsd \
96 i386-unknown-netbsd x86_64-unknown-netbsd \
97 i386-unknown-mingw32 x86_64-unknown-mingw32 \
98 i386-apple-darwin x86_64-apple-darwin powerpc-apple-darwin
99
100 ifeq "$(SOLARIS_BROKEN_SHLD)" "NO"
101 SharedLibsPlatformList += i386-unknown-solaris2
102 endif
103
104 PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),\
105 $(SharedLibsPlatformList)),YES,NO)
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 DYNAMIC_TOO = YES
128
129 # Build a compiler that will build *unregisterised* libraries and
130 # binaries by default. Unregisterised code is supposed to compile and
131 # run without any support for architecture-specific assembly mangling,
132 # register assignment or tail-calls, and is therefore a good way to get
133 # started when porting GHC to new architectures.
134 #
135 # NOTE: the stage1 compiler will be a registerised binary (assuming
136 # the compiler you build with is generating registerised binaries), but
137 # the stage2 compiler will be an unregisterised binary.
138 #
139 GhcUnregisterised=@Unregisterised@
140
141 # Build a compiler with a native code generator backend
142 # (as well as a C backend)
143 #
144 # Target platforms supported:
145 # i386, powerpc
146 # AIX is not supported
147 ArchSupportsNCG=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc)))
148 OsSupportsNCG=$(strip $(patsubst $(TargetOS_CPP), YES, $(patsubst aix,,$(TargetOS_CPP))))
149
150 GhcWithNativeCodeGen := $(strip\
151 $(if $(filter YESYESNO,\
152 $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO))
153
154 HaveLibDL = @HaveLibDL@
155
156 # ArchSupportsSMP should be set iff there is support for that arch in
157 # includes/stg/SMP.h
158 ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc arm)))
159
160 GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
161
162 # Whether to include GHCi in the compiler. Depends on whether the RTS linker
163 # has support for this OS/ARCH combination.
164
165 OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu)))
166 ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc sparc64 arm)))
167
168 ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
169 GhcWithInterpreter=YES
170 else
171 GhcWithInterpreter=$(if $(findstring YES,$(DYNAMIC_BY_DEFAULT)),YES,NO)
172 endif
173
174 # GhcEnableTablesNextToCode tells us whether the target architecture
175 # supports placing info tables directly before the entry code
176 # (see TABLES_NEXT_TO_CODE in the RTS). Whether we actually compile for
177 # TABLES_NEXT_TO_CODE depends on whether we're building unregisterised
178 # code or not, which may be decided by options to the compiler later.
179 ifneq "$(findstring $(TargetArch_CPP)X, ia64X powerpc64X)" ""
180 GhcEnableTablesNextToCode=NO
181 else
182 GhcEnableTablesNextToCode=YES
183 endif
184
185 # Whether to use libffi for adjustors (foreign import "wrapper") or
186 # not. If we have built-in support (rts/Adjustor.c) then we use that,
187 # otherwise we fall back on libffi, which is slightly slower.
188 ArchHasAdjustorSupport = $(if $(findstring $(TargetArch_CPP),i386 x86_64),YES,NO)
189 ifeq "$(ArchHasAdjustorSupport)" "YES"
190 UseLibFFIForAdjustors=NO
191 else
192 UseLibFFIForAdjustors=YES
193 endif
194
195 # On Windows we normally want to make a relocatable bindist, to we
196 # ignore flags like libdir
197 ifeq "$(Windows_Host)" "YES"
198 RelocatableBuild = YES
199 else
200 RelocatableBuild = NO
201 endif
202
203 # needs to be after $(RelocatableBuild) is set above
204 include $(TOP)/mk/install.mk
205
206 # When building bindists we set this to yes so that the binaries are as
207 # portable as possible.
208 BeConservative = NO
209
210 ExtraMakefileSanityChecks = NO
211
212 #
213 # Building various ways?
214 # (right now, empty if not).
215 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
216 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
217
218 #------------------------------------------------------------------------------
219 # Options for Libraries
220
221 # Which directory (in libraries/) contains the integer library?
222 INTEGER_LIBRARY=integer-gmp
223
224 # We build the libraries at least the "vanilla" way (way "v")
225 GhcLibWays = v
226
227 # In addition to the normal sequential way, the default is to also build
228 # profiled prelude libraries
229 GhcLibWays += p
230
231 ifeq "$(PlatformSupportsSharedLibs)" "YES"
232 GhcLibWays += dyn
233 endif
234
235 # Handy way to test whether we're building shared libs or not.
236 BuildSharedLibs=$(strip $(if $(findstring dyn,$(GhcLibWays)),YES,NO))
237
238 # In addition, the RTS is built in some further variations. Ways that
239 # make sense here:
240 #
241 # thr : threaded
242 # thr_p : threaded profiled
243 # debug : debugging (compile with -g for the C compiler, and -DDEBUG)
244 # debug_p : debugging profiled
245 # thr_debug : debugging threaded
246 # thr_debug_p : debugging threaded profiled
247 # l : event logging
248 # thr_l : threaded and event logging
249 #
250 GhcRTSWays=l
251
252 # Usually want the debug version
253 GhcRTSWays += debug
254
255 # We always have the threaded versions, but note that SMP support may be disabled
256 # (see GhcWithSMP).
257 GhcRTSWays += thr thr_debug thr_l
258 GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),thr_p,)
259 GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)),dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn,)
260
261 # We can only build GHCi threaded if we have a threaded RTS:
262 GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
263
264 # Option flags to pass to GHC when it's compiling modules in
265 # fptools/libraries. Typically these are things like -O or
266 # -dcore-lint or -H32m. The ones that are *essential* are wired into
267 # the build system.
268 #
269 # -O(2) is pretty desirable, otherwise no inlining of prelude
270 # things (incl "+") happens when compiling with this compiler
271
272 GhcLibHcOpts=-O2
273
274 # Strip local symbols from libraries? This can make the libraries smaller,
275 # but makes debugging somewhat more difficult. Doesn't work with all ld's.
276 #
277 StripLibraries=NO
278
279 # ----------------------------------------------------------------------------
280 # Object-file splitting
281 #
282 # Set SplitObjs=YES or NO in your build.mk
283 #
284 # Don't use -split-objs in in GhcLibHcOpts, because the build
285 # system needs to do other special magic if you are
286 # doing object-file splitting
287
288 ArchSupportsSplitObjs=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64 powerpc sparc),YES,NO))
289 OsSupportsSplitObjs=$(strip $(if $(filter $(TargetOS_CPP),mingw32 cygwin32 linux darwin solaris2 freebsd dragonfly netbsd openbsd),YES,NO))
290 SplitObjsBroken = @SplitObjsBroken@
291
292 SupportsSplitObjs := $(strip \
293 $(if $(and $(filter YES,$(ArchSupportsSplitObjs)),\
294 $(filter YES,$(OsSupportsSplitObjs)),\
295 $(filter NO,$(SplitObjsBroken)),\
296 $(filter NO,$(GhcUnregisterised))),\
297 YES,NO))
298
299 # By default, enable SplitObjs for the libraries if this build supports it
300 SplitObjs=$(SupportsSplitObjs)
301
302 # ----------------------------------------------------------------------------
303 # Package-related things
304
305 # Whether to install the extra packages
306 InstallExtraPackages = NO
307
308 # Run "ghc-pkg check" on each package
309 CHECK_PACKAGES = NO
310
311 # ----------------------------------------------------------------------------
312
313 # There are a number of things which technically depend on GHC (e.g. if
314 # ghc changes then Haskell files may be compiled differently, or Cabal
315 # packages may be configured differently). By default we therefore
316 # have dependencies on the compiler executable.
317
318 # However, in practice, having a dependency on GHC is just a pain: We
319 # normally don't want to spend time recompiling other things while
320 # we're working on the compiler, and even if we did, GHC will normally
321 # decide compilation isn't needed anyway. So by setting LAX_DEPENDENCIES
322 # to YES you can turn these dependencies into order-only dependencies,
323 # i.e. GHC must exist, but if it's newer than other targets then
324 # rebuilding is not necessary.
325
326 LAX_DEPENDENCIES = NO
327
328 # ----------------------------------------------------------------------------
329 # Options for GHC's RTS
330
331 # Build an optimised RTS. Remember that we need to turn on
332 # optimisation both for C code (-optc-O2) and .cmm code (-O2). For
333 # the debugging RTS flavour, rts/ghc.mk overrides these to turn off
334 # optimisation.
335 GhcRtsHcOpts=-O2
336 GhcRtsCcOpts=-O2 -fomit-frame-pointer
337
338 # Include support for CPU performance counters via the PAPI library in the RTS?
339 # (PAPI: http://icl.cs.utk.edu/papi/)
340 GhcRtsWithPapi = NO
341 PapiLibDir=
342 PapiIncludeDir=
343
344 # Configuration for libffi
345 UseSystemLibFFI=@UseSystemLibFFI@
346 # Flags to go into package.conf for rts
347 FFILibDir=@FFILibDir@
348 FFIIncludeDir=@FFIIncludeDir@
349
350
351 ################################################################################
352 #
353 # Paths (see paths.mk)
354 #
355 ################################################################################
356
357 # Directory used by GHC (and possibly other tools) for storing
358 # temporary files. If your TMPDIR isn't big enough, either override
359 # this in build.mk or set your environment variable "TMPDIR" to point
360 # to somewhere with more space. (TMPDIR=. is a good choice).
361
362 # DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
363 # override an environment variable with the value of the make variable
364 # of the same name (if it exists) when executing sub-processes, so
365 # setting the TMPDIR env var would have no effect in the build tree.
366
367 DEFAULT_TMPDIR = /tmp
368 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
369 DEFAULT_TMPDIR = /C/TEMP
370 endif
371 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
372 DEFAULT_TMPDIR = /C/TEMP
373 endif
374
375 BIN_DIST_NAME = ghc-$(ProjectVersion)
376 BIN_DIST_PREP_DIR = bindistprep/$(BIN_DIST_NAME)
377 BIN_DIST_PREP_TAR = bindistprep/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
378 BIN_DIST_PREP_TAR_BZ2 = $(BIN_DIST_PREP_TAR).bz2
379 BIN_DIST_TAR_BZ2 = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
380 BIN_DIST_LIST = bindist-list
381
382 WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-$(TargetArch_CPP)-windows
383 WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
384
385 # -----------------------------------------------------------------------------
386 # Utilities programs: flags
387
388 # If you want to give any standard flags to pretty much any utility
389 # (see utils.mk for a complete list), by adding a line here
390 #
391 # SRC_P_OPTS += ...
392 #
393 # where P is the utility. For example, to add -O to all Haskell
394 # compilations,
395 #
396 # SRC_HC_OPTS += -O
397
398
399 # SRC_HC_OPTS includes flags to be added to *every* Haskell
400 # compilation. Setting SRC_HC_OPTS is a good way to set the default
401 # optimisation level (-O) and heap size (-H<size>).
402 #
403 # SRC_HC_OPTS is *not* for adding flags that are required to make your
404 # build work. Examples:
405 #
406 # - instead of using -pgmc/-pgma-/-pgml, use the --with-gcc option to configure
407 #
408 # - if you need -optc, -opta, or -optl flags, the CONF_CC_* and CONF_LD_*
409 # variables are more appropriate (set via configure)
410 #
411 # Note that SRC_HC_OPTS are added to every Haskell compilation,
412 # including when using the bootstrapping compiler (stage 0), So don't
413 # put options here that are only supported by very recent GHCs.
414 #
415 SRC_HC_OPTS += -H32m -O
416
417 # -----------------------------------------------------------------------------
418 # Names of programs in the GHC tree
419
420 MKDIRHIER = $(INPLACE_BIN)/mkdirhier
421
422 GENERATED_FILE = chmod a-w
423 EXECUTABLE_FILE = chmod +x
424
425 #-----------------------------------------------------------------------------
426 # Installed GHC
427
428 # $(GHC) points to installed version of the compiler.
429 #
430 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
431 # (because the version numbers have to be calculated).
432
433 GHC := @WithGhc@
434 # If we have a make dependency on c:/ghc/ghc, and the file is actually
435 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
436 # and that it doesn't know how to create it.
437 ifneq "$(wildcard $(GHC).exe)" ""
438 GHC := $(GHC).exe
439 endif
440
441 # Sometimes we want to invoke ghc from the build tree in different
442 # places (eg. it's handy to have a nofib & a ghc build in the same
443 # tree). We can refer to "this ghc" as $(GHC_INPLACE):
444
445 GHC_INPLACE = $(GHC_STAGE1)
446
447 GHC_STAGE0 = $(GHC)
448 GHC_STAGE1 = $(INPLACE_BIN)/ghc-stage1$(exeext)
449 GHC_STAGE2 = $(INPLACE_BIN)/ghc-stage2$(exeext)
450 GHC_STAGE3 = $(INPLACE_BIN)/ghc-stage3$(exeext)
451
452 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
453
454 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf.d
455
456 GhcVersion = @GhcVersion@
457 GhcPatchLevel = @GhcPatchLevel@
458 GhcMajVersion = @GhcMajVersion@
459 GhcMinVersion = @GhcMinVersion@
460
461 # Canonicalised ghc version number, used for easy (integer) version
462 # comparisons. We must expand $(GhcMinVersion) to two digits by
463 # adding a leading zero if necessary:
464 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
465 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
466 else
467 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
468 endif
469
470 GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
471
472 #-----------------------------------------------------------------------------
473 # C compiler
474 #
475 # NB. Don't override $(WhatGccIsCalled) using build.mk, re-configure using
476 # the flag --with-gcc=<blah> instead. The reason is that the configure script
477 # needs to know which gcc you're using in order to perform its tests.
478
479 WhatGccIsCalled = @WhatGccIsCalled@
480 GccVersion = @GccVersion@
481 ifeq "$(phase)" "0"
482 CrossCompilePrefix =
483 else
484 CrossCompilePrefix = @CrossCompilePrefix@
485 endif
486 # TargetPlatformFull retains the string passed to configure so we have it in
487 # the necessary format to pass to libffi's configure.
488 TargetPlatformFull = @TargetPlatformFull@
489 GccLT34 = @GccLT34@
490 GccLT46 = @GccLT46@
491
492 CC = $(WhatGccIsCalled)
493 CC_STAGE0 = @CC_STAGE0@
494 CC_STAGE1 = $(CC)
495 CC_STAGE2 = $(CC)
496 CC_STAGE3 = $(CC)
497
498 AS = $(WhatGccIsCalled)
499 AS_STAGE0 = @CC_STAGE0@
500 AS_STAGE1 = $(AS)
501 AS_STAGE2 = $(AS)
502 AS_STAGE3 = $(AS)
503
504 # We don't have an LD_STAGE0. CC_STAGE0 is determined by asking "ghc
505 # --info", and it doesn't report an LD.
506 LD_STAGE0 = error-no-ld-stage0
507 LD_STAGE1 = $(LD)
508 LD_STAGE2 = $(LD)
509 LD_STAGE3 = $(LD)
510
511 # Cross-compiling options
512 #
513 CrossCompiling = @CrossCompiling@
514
515 # Change this to YES if you're building a cross-compiler and don't
516 # want to build stage 2.
517 Stage1Only = NO
518
519 # Install stage 2 by default, or stage 1 in the cross compiler
520 # case. Can be changed to 3
521 INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
522
523 # C compiler and linker flags from configure (e.g. -m<blah> to select
524 # correct C compiler backend). The stage number is the stage of GHC
525 # that is being used to compile with.
526 CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
527 CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
528 CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
529 CONF_GCC_LINKER_OPTS_STAGE0 = @CONF_GCC_LINKER_OPTS_STAGE0@
530 CONF_GCC_LINKER_OPTS_STAGE1 = @CONF_GCC_LINKER_OPTS_STAGE1@
531 CONF_GCC_LINKER_OPTS_STAGE2 = @CONF_GCC_LINKER_OPTS_STAGE2@
532 CONF_LD_LINKER_OPTS_STAGE0 = @CONF_LD_LINKER_OPTS_STAGE0@
533 CONF_LD_LINKER_OPTS_STAGE1 = @CONF_LD_LINKER_OPTS_STAGE1@
534 CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@
535 CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@
536 CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@
537 CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@
538
539 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
540 CONF_CC_OPTS += -G0
541 endif
542
543 # The .hsc files aren't currently safe for cross-compilation on Windows:
544 # libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160
545 # directive "let" is not safe for cross-compilation
546 ifneq "$(Windows_Host)" "YES"
547 SRC_HSC2HS_OPTS += --cross-safe
548 endif
549 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
550
551 define set_stage_HSC2HS_OPTS
552 # $1 = stage
553 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(filter-out -O,$$(SRC_CC_OPTS) $$(CONF_CC_OPTS_STAGE$1)))
554 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(CONF_CPP_OPTS_STAGE$1))
555 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --lflag=,$$(CONF_GCC_LINKER_OPTS_STAGE$1))
556 endef
557 $(eval $(call set_stage_HSC2HS_OPTS,0))
558 $(eval $(call set_stage_HSC2HS_OPTS,1))
559 $(eval $(call set_stage_HSC2HS_OPTS,2))
560 ifeq "$(CrossCompiling)" "YES"
561 SRC_HSC2HS_OPTS_STAGE1 += --cross-compile
562 SRC_HSC2HS_OPTS_STAGE2 += --cross-compile
563 endif
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 # Set this if you want to use Inno Setup to build a Windows installer
690 # when you make a bindist
691 ISCC_CMD =
692
693 #-----------------------------------------------------------------------------
694 # DocBook XML stuff
695
696 BUILD_DOCBOOK_HTML = @BUILD_DOCBOOK_HTML@
697 BUILD_DOCBOOK_PS = @BUILD_DOCBOOK_PS@
698 BUILD_DOCBOOK_PDF = @BUILD_DOCBOOK_PDF@
699 DBLATEX = @DblatexCmd@
700 # filename.as.url=0 is needed with dblatex 0.3.4 (#7486)
701 DBLATEX_OPTS = -P 'filename.as.url=0'
702 XSLTPROC = @XsltprocCmd@
703 XMLLINT = @XmllintCmd@
704 HAVE_DOCBOOK_XSL = @HAVE_DOCBOOK_XSL@
705 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
706 XSLTPROC_LABEL_OPTS = --stringparam toc.section.depth 3 \
707 --stringparam section.autolabel 1 \
708 --stringparam section.label.includes.component.label 1
709
710 #-----------------------------------------------------------------------------
711 # FPtools support software
712
713 #
714 # ghc-pkg
715 #
716 GHC_PKG = @GhcPkgCmd@
717
718 #
719 # Happy
720 #
721 HAPPY = @HappyCmd@
722 HAPPY_VERSION = @HappyVersion@
723 #
724 # Options to pass to Happy when we're going to compile the output with GHC
725 #
726 SRC_HAPPY_OPTS = -agc --strict
727
728 #
729 # Alex
730 #
731 ALEX = @AlexCmd@
732 ALEX_VERSION = @AlexVersion@
733 Alex3 = @Alex3@
734 #
735 # Options to pass to Alex when we're going to compile the output with GHC
736 #
737 SRC_ALEX_OPTS = -g
738 ifeq "$(Alex3)" "YES"
739 # The compiler isn't using the Unicode support in Alex 3.0 yet, in fact we do our own
740 # Unicode handling, so diable Alex's.
741 compiler_ALEX_OPTS = --latin1
742 endif
743
744 # Should we build haddock docs?
745 HADDOCK_DOCS = YES
746 # And HsColour the sources?
747 ifeq "$(HSCOLOUR_CMD)" ""
748 HSCOLOUR_SRCS = NO
749 else
750 HSCOLOUR_SRCS = YES
751 endif
752
753 ################################################################################
754 #
755 # 31-bit-Int Core files
756 #
757 ################################################################################
758
759 #
760 # It is possible to configure the compiler and prelude to support 31-bit
761 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
762 # architecture. Currently the only useful output from this option is external Core
763 # files. The following additions to your build.mk will produce the
764 # 31-bit core output. Note that this is *not* just a library "way"; the
765 # compiler must be built a special way too.
766
767 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
768 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
769 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
770 # SplitObjs=NO
771
772 ################################################################################
773 #
774 # Library configure arguments
775 #
776 ################################################################################
777
778 CONFIGURE_ARGS = @CONFIGURE_ARGS@
779
780 ################################################################################
781 #
782 # To be passed to sub-builds
783 #
784 ################################################################################
785
786 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
787 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
788
789 GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
790 GMP_LIB_DIRS = @GMP_LIB_DIRS@