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