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