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