Disable DYNAMIC_GHC_PROGRAMS on Windows
[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 # 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 # Building various ways?
226 # (right now, empty if not).
227 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
228 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
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 BIN_DIST_LIST = bindist-list
393
394 WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-$(TargetArch_CPP)-windows
395 WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
396
397 # -----------------------------------------------------------------------------
398 # Utilities programs: flags
399
400 # If you want to give any standard flags to pretty much any utility
401 # (see utils.mk for a complete list), by adding a line here
402 #
403 # SRC_P_OPTS += ...
404 #
405 # where P is the utility. For example, to add -O to all Haskell
406 # compilations,
407 #
408 # SRC_HC_OPTS += -O
409
410
411 # SRC_HC_OPTS includes flags to be added to *every* Haskell
412 # compilation. Setting SRC_HC_OPTS is a good way to set the default
413 # optimisation level (-O) and heap size (-H<size>).
414 #
415 # SRC_HC_OPTS is *not* for adding flags that are required to make your
416 # build work. Examples:
417 #
418 # - instead of using -pgmc/-pgma-/-pgml, use the --with-gcc option to configure
419 #
420 # - if you need -optc, -opta, or -optl flags, the CONF_CC_* and CONF_LD_*
421 # variables are more appropriate (set via configure)
422 #
423 # Note that SRC_HC_OPTS are added to every Haskell compilation,
424 # including when using the bootstrapping compiler (stage 0), So don't
425 # put options here that are only supported by very recent GHCs.
426 #
427 SRC_HC_OPTS += -H32m -O
428
429 # -----------------------------------------------------------------------------
430 # Names of programs in the GHC tree
431
432 MKDIRHIER = $(INPLACE_BIN)/mkdirhier
433
434 GENERATED_FILE = chmod a-w
435 EXECUTABLE_FILE = chmod +x
436
437 #-----------------------------------------------------------------------------
438 # Installed GHC
439
440 # $(GHC) points to installed version of the compiler.
441 #
442 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
443 # (because the version numbers have to be calculated).
444
445 GHC := @WithGhc@
446 # If we have a make dependency on c:/ghc/ghc, and the file is actually
447 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
448 # and that it doesn't know how to create it.
449 ifneq "$(wildcard $(GHC).exe)" ""
450 GHC := $(GHC).exe
451 endif
452
453 # Sometimes we want to invoke ghc from the build tree in different
454 # places (eg. it's handy to have a nofib & a ghc build in the same
455 # tree). We can refer to "this ghc" as $(GHC_INPLACE):
456
457 GHC_INPLACE = $(GHC_STAGE1)
458
459 GHC_STAGE0 = $(GHC)
460 GHC_STAGE1 = $(INPLACE_BIN)/ghc-stage1$(exeext)
461 GHC_STAGE2 = $(INPLACE_BIN)/ghc-stage2$(exeext)
462 GHC_STAGE3 = $(INPLACE_BIN)/ghc-stage3$(exeext)
463
464 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
465
466 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf.d
467
468 GhcVersion = @GhcVersion@
469 GhcPatchLevel = @GhcPatchLevel@
470 GhcMajVersion = @GhcMajVersion@
471 GhcMinVersion = @GhcMinVersion@
472
473 # Canonicalised ghc version number, used for easy (integer) version
474 # comparisons. We must expand $(GhcMinVersion) to two digits by
475 # adding a leading zero if necessary:
476 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
477 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
478 else
479 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
480 endif
481
482 GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
483
484 #-----------------------------------------------------------------------------
485 # C compiler
486 #
487 # NB. Don't override $(WhatGccIsCalled) using build.mk, re-configure using
488 # the flag --with-gcc=<blah> instead. The reason is that the configure script
489 # needs to know which gcc you're using in order to perform its tests.
490
491 WhatGccIsCalled = @WhatGccIsCalled@
492 GccVersion = @GccVersion@
493 ifeq "$(phase)" "0"
494 CrossCompilePrefix =
495 else
496 CrossCompilePrefix = @CrossCompilePrefix@
497 endif
498 # TargetPlatformFull retains the string passed to configure so we have it in
499 # the necessary format to pass to libffi's configure.
500 TargetPlatformFull = @TargetPlatformFull@
501 GccLT34 = @GccLT34@
502 GccLT46 = @GccLT46@
503
504 CC = $(WhatGccIsCalled)
505 CC_STAGE0 = @CC_STAGE0@
506 CC_STAGE1 = $(CC)
507 CC_STAGE2 = $(CC)
508 CC_STAGE3 = $(CC)
509
510 AS = $(WhatGccIsCalled)
511 AS_STAGE0 = @CC_STAGE0@
512 AS_STAGE1 = $(AS)
513 AS_STAGE2 = $(AS)
514 AS_STAGE3 = $(AS)
515
516 # We don't have an LD_STAGE0. CC_STAGE0 is determined by asking "ghc
517 # --info", and it doesn't report an LD.
518 LD_STAGE0 = error-no-ld-stage0
519 LD_STAGE1 = $(LD)
520 LD_STAGE2 = $(LD)
521 LD_STAGE3 = $(LD)
522
523 # Cross-compiling options
524 #
525 CrossCompiling = @CrossCompiling@
526
527 # Change this to YES if you're building a cross-compiler and don't
528 # want to build stage 2.
529 Stage1Only = NO
530
531 # Install stage 2 by default, or stage 1 in the cross compiler
532 # case. Can be changed to 3
533 INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
534
535 # C compiler and linker flags from configure (e.g. -m<blah> to select
536 # correct C compiler backend). The stage number is the stage of GHC
537 # that is being used to compile with.
538 CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
539 CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
540 CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
541 CONF_GCC_LINKER_OPTS_STAGE0 = @CONF_GCC_LINKER_OPTS_STAGE0@
542 CONF_GCC_LINKER_OPTS_STAGE1 = @CONF_GCC_LINKER_OPTS_STAGE1@
543 CONF_GCC_LINKER_OPTS_STAGE2 = @CONF_GCC_LINKER_OPTS_STAGE2@
544 CONF_LD_LINKER_OPTS_STAGE0 = @CONF_LD_LINKER_OPTS_STAGE0@
545 CONF_LD_LINKER_OPTS_STAGE1 = @CONF_LD_LINKER_OPTS_STAGE1@
546 CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@
547 CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@
548 CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@
549 CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@
550
551 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
552 CONF_CC_OPTS += -G0
553 endif
554
555 # The .hsc files aren't currently safe for cross-compilation on Windows:
556 # libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160
557 # directive "let" is not safe for cross-compilation
558 ifneq "$(Windows_Host)" "YES"
559 SRC_HSC2HS_OPTS += --cross-safe
560 endif
561 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
562
563 define set_stage_HSC2HS_OPTS
564 # $1 = stage
565 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(filter-out -O,$$(SRC_CC_OPTS) $$(CONF_CC_OPTS_STAGE$1)))
566 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --cflag=,$$(CONF_CPP_OPTS_STAGE$1))
567 SRC_HSC2HS_OPTS_STAGE$1 += $$(addprefix --lflag=,$$(CONF_GCC_LINKER_OPTS_STAGE$1))
568 endef
569 $(eval $(call set_stage_HSC2HS_OPTS,0))
570 $(eval $(call set_stage_HSC2HS_OPTS,1))
571 $(eval $(call set_stage_HSC2HS_OPTS,2))
572 ifeq "$(CrossCompiling)" "YES"
573 SRC_HSC2HS_OPTS_STAGE1 += --cross-compile
574 SRC_HSC2HS_OPTS_STAGE2 += --cross-compile
575 endif
576
577 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
578 WINDRES = $(INPLACE_MINGW)/bin/windres
579 else ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
580 WINDRES = $(INPLACE_MINGW)/bin/windres
581 endif
582
583 #-----------------------------------------------------------------------------
584 # Mingwex Library
585 #
586 HaveLibMingwEx = @HaveLibMingwEx@
587 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
588 DLLTOOL = inplace/mingw/bin/dlltool.exe
589 else ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
590 DLLTOOL = inplace/mingw/bin/dlltool.exe
591 endif
592
593 #-----------------------------------------------------------------------------
594 # Other standard (ha!) Unix utilities
595
596 AR = @ArCmd@
597 AR_OPTS = @ArArgs@
598 ArSupportsAtFile = @ArSupportsAtFile@
599
600 AR_STAGE0 = @AR_STAGE0@
601 AR_STAGE1 = $(AR)
602 AR_STAGE2 = $(AR)
603 AR_STAGE3 = $(AR)
604 AR_OPTS_STAGE0 = @AR_OPTS_STAGE0@
605 AR_OPTS_STAGE1 = $(AR_OPTS)
606 AR_OPTS_STAGE2 = $(AR_OPTS)
607 AR_OPTS_STAGE3 = $(AR_OPTS)
608 EXTRA_AR_ARGS_STAGE0 = $(EXTRA_AR_ARGS)
609 EXTRA_AR_ARGS_STAGE1 = $(EXTRA_AR_ARGS)
610 EXTRA_AR_ARGS_STAGE2 = $(EXTRA_AR_ARGS)
611 EXTRA_AR_ARGS_STAGE3 = $(EXTRA_AR_ARGS)
612 ArSupportsAtFile_STAGE0 = @ArSupportsAtFile_STAGE0@
613 ArSupportsAtFile_STAGE1 = $(ArSupportsAtFile)
614 ArSupportsAtFile_STAGE2 = $(ArSupportsAtFile)
615 ArSupportsAtFile_STAGE3 = $(ArSupportsAtFile)
616
617 CONTEXT_DIFF = @ContextDiffCmd@
618 CP = cp
619 # It's not easy to separate the CPP program from its flags, as
620 # AC_PROG_CPP defines CPP as "/usr/bin/gcc -E"
621 CPP = @CPP@ @CPPFLAGS@
622 #
623 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
624 # behave plausibly on Haskell sources.
625 #
626 RAWCPP_FLAGS = -undef -traditional
627 FIND = @FindCmd@
628
629 #
630 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
631 # install-sh script (if chosen). This not terribly useful to us, so we convert
632 # it into an abs. path.
633 #
634 INSTALL = @INSTALL@
635 INSTALL := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
636
637 LN_S = @LN_S@
638 MV = mv
639 PERL = @PerlCmd@
640 PIC = pic
641 RANLIB = @RANLIB@
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 # Set this if you want to use Inno Setup to build a Windows installer
702 # when you make a bindist
703 ISCC_CMD =
704
705 #-----------------------------------------------------------------------------
706 # DocBook XML stuff
707
708 BUILD_DOCBOOK_HTML = @BUILD_DOCBOOK_HTML@
709 BUILD_DOCBOOK_PS = @BUILD_DOCBOOK_PS@
710 BUILD_DOCBOOK_PDF = @BUILD_DOCBOOK_PDF@
711 DBLATEX = @DblatexCmd@
712 # filename.as.url=0 is needed with dblatex 0.3.4 (#7486)
713 DBLATEX_OPTS = -P 'filename.as.url=0'
714 XSLTPROC = @XsltprocCmd@
715 XMLLINT = @XmllintCmd@
716 HAVE_DOCBOOK_XSL = @HAVE_DOCBOOK_XSL@
717 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
718 XSLTPROC_LABEL_OPTS = --stringparam toc.section.depth 3 \
719 --stringparam section.autolabel 1 \
720 --stringparam section.label.includes.component.label 1
721
722 #-----------------------------------------------------------------------------
723 # FPtools support software
724
725 #
726 # ghc-pkg
727 #
728 GHC_PKG = @GhcPkgCmd@
729
730 #
731 # Happy
732 #
733 HAPPY = @HappyCmd@
734 HAPPY_VERSION = @HappyVersion@
735 #
736 # Options to pass to Happy when we're going to compile the output with GHC
737 #
738 SRC_HAPPY_OPTS = -agc --strict
739
740 #
741 # Alex
742 #
743 ALEX = @AlexCmd@
744 ALEX_VERSION = @AlexVersion@
745 Alex3 = @Alex3@
746 #
747 # Options to pass to Alex when we're going to compile the output with GHC
748 #
749 SRC_ALEX_OPTS = -g
750 ifeq "$(Alex3)" "YES"
751 # The compiler isn't using the Unicode support in Alex 3.0 yet, in fact we do our own
752 # Unicode handling, so diable Alex's.
753 compiler_ALEX_OPTS = --latin1
754 endif
755
756 # Should we build haddock docs?
757 HADDOCK_DOCS = YES
758 # And HsColour the sources?
759 ifeq "$(HSCOLOUR_CMD)" ""
760 HSCOLOUR_SRCS = NO
761 else
762 HSCOLOUR_SRCS = YES
763 endif
764
765 ################################################################################
766 #
767 # 31-bit-Int Core files
768 #
769 ################################################################################
770
771 #
772 # It is possible to configure the compiler and prelude to support 31-bit
773 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
774 # architecture. Currently the only useful output from this option is external Core
775 # files. The following additions to your build.mk will produce the
776 # 31-bit core output. Note that this is *not* just a library "way"; the
777 # compiler must be built a special way too.
778
779 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
780 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
781 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
782 # SplitObjs=NO
783
784 ################################################################################
785 #
786 # Library configure arguments
787 #
788 ################################################################################
789
790 CONFIGURE_ARGS = @CONFIGURE_ARGS@
791
792 ################################################################################
793 #
794 # To be passed to sub-builds
795 #
796 ################################################################################
797
798 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
799 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
800
801 GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
802 GMP_LIB_DIRS = @GMP_LIB_DIRS@