Better detection of clang in ./configure. Issue #7678.
[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 # BootingFromHc - build GHC and the libraries from .hc files?
40 # (unregisterised only)
41 BootingFromHc = @BootingFromHc@
42
43 NO_INCLUDE_DEPS = NO
44 NO_INCLUDE_PKGDATA = NO
45
46 # Should we build latex docs?
47 LATEX_DOCS = NO
48
49 # Is the global compiler clang, llvm, or something neither?
50 CC_CLANG_BACKEND = @CC_CLANG_BACKEND@
51 CC_LLVM_BACKEND = @CC_LLVM_BACKEND@
52
53 # Mac OS X deployment target (to cross-compile for older OS versions)
54 #
55 MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
56 MACOSX_DEPLOYMENT_SDK = @MACOSX_DEPLOYMENT_SDK@
57
58 ifneq "$(MACOSX_DEPLOYMENT_VERSION)" ""
59 MACOSX_DEPLOYMENT_CC_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
60 -isysroot $(MACOSX_DEPLOYMENT_SDK) \
61 --no-builtin-fprintf
62 MACOSX_DEPLOYMENT_LD_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
63 -Wl,-syslibroot,$(MACOSX_DEPLOYMENT_SDK)
64 # We don't extend SRC_CC_OPTS and friends here directly, as (a) they may get
65 # overwritten in build.mk and (b) we must not use the deployment options in
66 # stage 1 or we get a linker error if the bootstrap compiler is for a more
67 # recent OS version.
68 #
69 # We need --no-builtin-fprintf, as the use of the builtin function optimisation
70 # for fprintf together with #include "PosixSource" in the RTS leads to the
71 # use of fwrite$UNIX2003 (with GCC 4.0.1 on Mac OS X 10.5.2).
72 endif
73
74 ################################################################################
75 #
76 # Variables that control how the compiler itself is built
77 #
78 ################################################################################
79
80 # The compiler used to build GHC is $(GHC). To change the actual compiler
81 # used, re-configure with --with-ghc=<path-to-ghc>.
82
83 # Extra ways in which to build the compiler (for example, you might want to
84 # build a profiled compiler so you can see where it spends its time)
85 GhcCompilerWays=
86
87 # Extra option flags to pass to the compiler that compiles the compiler
88 # (Ones that are essential are wired into compiler/Makefile)
89 # Typical options to use here:
90 #
91 # -DDEBUG include debugging code and assertions (will make the
92 # compiler slower and produce debugging output, but useful
93 # for development)
94 #
95 # -dcore-lint check the types after every pass of the compiler;
96 # a pretty strong internal check of the compiler being
97 # used to compile GHC. Useful when bootstrapping.
98 GhcHcOpts=-Rghc-timing
99
100 # Extra options added to specific stages of the compiler bootstrap.
101 # These are placed later on the command line, and may therefore
102 # override options from $(GhcHcOpts).
103 GhcStage1HcOpts=
104 GhcStage2HcOpts=-O2
105 GhcStage3HcOpts=-O2
106
107 # These options modify whether or not a built compiler for a bootstrap
108 # stage defaults to using the new code generation path. The new
109 # code generation path is a bit slower, so for development just
110 # GhcStage2DefaultNewCodegen=YES, but it's also a good idea to try
111 # building all libraries and the stage2 compiler with the
112 # new code generator, which involves GhcStage1DefaultNewCodegen=YES.
113 GhcStage1DefaultNewCodegen=NO
114 GhcStage2DefaultNewCodegen=NO
115 GhcStage3DefaultNewCodegen=NO
116
117 GhcDebugged=NO
118 GhcDynamic=NO
119
120 # GhcProfiled=YES means compile a profiled stage-2 compiler
121 GhcProfiled=NO
122
123 # Do we support shared libs?
124 SharedLibsPlatformList = \
125 i386-unknown-linux x86_64-unknown-linux \
126 i386-unknown-freebsd x86_64-unknown-freebsd \
127 i386-unknown-openbsd x86_64-unknown-openbsd \
128 i386-unknown-netbsd x86_64-unknown-netbsd \
129 i386-unknown-mingw32 x86_64-unknown-mingw32 \
130 i386-apple-darwin x86_64-apple-darwin powerpc-apple-darwin
131
132 ifeq "$(SOLARIS_BROKEN_SHLD)" "NO"
133 SharedLibsPlatformList += i386-unknown-solaris2
134 endif
135
136 PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),\
137 $(SharedLibsPlatformList)),YES,NO)
138
139 # DYNAMIC_BY_DEFAULT says whether this compiler will default to
140 # building dynamic executables, i.e. -dynamic is on. We do this for
141 # most platforms because it lets us use the system dynamic linker
142 # instead of our own linker for GHCi.
143 #
144 # Currently this isn't possible on Windows, and we have not yet enabled
145 # it on i386 while we consider the performance implications.
146 #
147 ifeq "$(TargetOS_CPP)" "mingw32"
148 DYNAMIC_BY_DEFAULT = NO
149 else ifeq "$(TargetArch_CPP)" "i386"
150 DYNAMIC_BY_DEFAULT = NO
151 else
152 DYNAMIC_BY_DEFAULT = YES
153 endif
154
155 # For now, we unconditionally disable dynamic-by-default, as the
156 # cabal-install's that are in the wild don't handle it properly.
157 DYNAMIC_BY_DEFAULT = NO
158
159 # Build a compiler that will build *unregisterised* libraries and
160 # binaries by default. Unregisterised code is supposed to compile and
161 # run without any support for architecture-specific assembly mangling,
162 # register assignment or tail-calls, and is therefore a good way to get
163 # started when porting GHC to new architectures.
164 #
165 # NOTE: the stage1 compiler will be a registerised binary (assuming
166 # the compiler you build with is generating registerised binaries), but
167 # the stage2 compiler will be an unregisterised binary.
168 #
169 GhcUnregisterised=@Unregisterised@
170
171 # Build a compiler with a native code generator backend
172 # (as well as a C backend)
173 #
174 # Target platforms supported:
175 # i386, powerpc
176 # AIX is not supported
177 ArchSupportsNCG=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc)))
178 OsSupportsNCG=$(strip $(patsubst $(TargetOS_CPP), YES, $(patsubst aix,,$(TargetOS_CPP))))
179
180 GhcWithNativeCodeGen := $(strip\
181 $(if $(filter YESYESNO,\
182 $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO))
183
184 HaveLibDL = @HaveLibDL@
185
186 # ArchSupportsSMP should be set iff there is support for that arch in
187 # includes/stg/SMP.h
188 ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc arm)))
189
190 GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
191
192 # Whether to include GHCi in the compiler. Depends on whether the RTS linker
193 # has support for this OS/ARCH combination.
194
195 OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu)))
196 ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc sparc sparc64 arm)))
197
198 ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
199 GhcWithInterpreter=YES
200 else
201 GhcWithInterpreter=$(if $(findstring YES,$(DYNAMIC_BY_DEFAULT)),YES,NO)
202 endif
203
204 # GhcEnableTablesNextToCode tells us whether the target architecture
205 # supports placing info tables directly before the entry code
206 # (see TABLES_NEXT_TO_CODE in the RTS). Whether we actually compile for
207 # TABLES_NEXT_TO_CODE depends on whether we're building unregisterised
208 # code or not, which may be decided by options to the compiler later.
209 ifneq "$(findstring $(TargetArch_CPP)X, ia64X powerpc64X)" ""
210 GhcEnableTablesNextToCode=NO
211 else
212 GhcEnableTablesNextToCode=YES
213 endif
214
215 # Whether to use libffi for adjustors (foreign import "wrapper") or
216 # not. If we have built-in support (rts/Adjustor.c) then we use that,
217 # otherwise we fall back on libffi, which is slightly slower.
218 ArchHasAdjustorSupport = $(if $(findstring $(TargetArch_CPP),i386 x86_64),YES,NO)
219 ifeq "$(ArchHasAdjustorSupport)" "YES"
220 UseLibFFIForAdjustors=NO
221 else
222 UseLibFFIForAdjustors=YES
223 endif
224
225 # On Windows we normally want to make a relocatable bindist, to we
226 # ignore flags like libdir
227 ifeq "$(Windows)" "YES"
228 RelocatableBuild = YES
229 else
230 RelocatableBuild = NO
231 endif
232
233 # needs to be after $(RelocatableBuild) is set above
234 include $(TOP)/mk/install.mk
235
236 # When building bindists we set this to yes so that the binaries are as
237 # portable as possible.
238 BeConservative = NO
239
240 ExtraMakefileSanityChecks = NO
241
242 #
243 # Building various ways?
244 # (right now, empty if not).
245 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
246 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
247
248 #------------------------------------------------------------------------------
249 # Options for Libraries
250
251 # Which directory (in libraries/) contains the integer library?
252 INTEGER_LIBRARY=integer-gmp
253
254 # We build the libraries at least the "vanilla" way (way "v")
255 GhcLibWays = v
256
257 # In addition to the normal sequential way, the default is to also build
258 # profiled prelude libraries unless we are booting from .hc files
259 ifneq "$(BootingFromHc)" "YES"
260 GhcLibWays += p
261 endif
262
263 ifeq "$(PlatformSupportsSharedLibs)" "YES"
264 GhcLibWays += dyn
265 endif
266
267 # Handy way to test whether we're building shared libs or not.
268 BuildSharedLibs=$(strip $(if $(findstring dyn,$(GhcLibWays)),YES,NO))
269
270 # In addition, the RTS is built in some further variations. Ways that
271 # make sense here:
272 #
273 # thr : threaded
274 # thr_p : threaded profiled
275 # debug : debugging (compile with -g for the C compiler, and -DDEBUG)
276 # debug_p : debugging profiled
277 # thr_debug : debugging threaded
278 # thr_debug_p : debugging threaded profiled
279 # l : event logging
280 # thr_l : threaded and event logging
281 #
282 GhcRTSWays=l
283
284 # Usually want the debug version
285 ifeq "$(BootingFromHc)" "NO"
286 GhcRTSWays += debug
287 endif
288
289 # We always have the threaded versions, but note that SMP support may be disabled
290 # (see GhcWithSMP).
291 GhcRTSWays += thr thr_debug thr_l
292 GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),thr_p,)
293 GhcRTSWays += $(if $(findstring dyn, $(GhcLibWays)),dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn,)
294
295 # We can only build GHCi threaded if we have a threaded RTS:
296 GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
297
298 # Option flags to pass to GHC when it's compiling modules in
299 # fptools/libraries. Typically these are things like -O or
300 # -dcore-lint or -H32m. The ones that are *essential* are wired into
301 # the build system.
302 #
303 # -O(2) is pretty desirable, otherwise no inlining of prelude
304 # things (incl "+") happens when compiling with this compiler
305
306 GhcLibHcOpts=-O2
307
308 # Strip local symbols from libraries? This can make the libraries smaller,
309 # but makes debugging somewhat more difficult. Doesn't work with all ld's.
310 #
311 StripLibraries=NO
312
313 # These are the URL patterns that Haddock uses to generate the "Source
314 # File" links on each page.
315 PackageSourceURL = http://darcs.haskell.org/packages/$(PACKAGE)/%{FILE}
316
317 # ----------------------------------------------------------------------------
318 # Object-file splitting
319 #
320 # Set SplitObjs=YES or NO in your build.mk
321 #
322 # Don't use -split-objs in in GhcLibHcOpts, because the build
323 # system needs to do other special magic if you are
324 # doing object-file splitting
325
326 ArchSupportsSplitObjs=$(strip $(if $(filter $(TargetArch_CPP),i386 x86_64 powerpc sparc),YES,NO))
327 OsSupportsSplitObjs=$(strip $(if $(filter $(TargetOS_CPP),mingw32 cygwin32 linux darwin solaris2 freebsd dragonfly netbsd openbsd),YES,NO))
328 SplitObjsBroken = @SplitObjsBroken@
329
330 SupportsSplitObjs := $(strip \
331 $(if $(and $(filter YES,$(ArchSupportsSplitObjs)),\
332 $(filter YES,$(OsSupportsSplitObjs)),\
333 $(filter NO,$(SplitObjsBroken)),\
334 $(filter NO,$(BootingFromHc)),\
335 $(filter NO,$(GhcUnregisterised))),\
336 YES,NO))
337
338 # By default, enable SplitObjs for the libraries if this build supports it
339 SplitObjs=$(SupportsSplitObjs)
340
341 # ----------------------------------------------------------------------------
342 # Package-related things
343
344 # Extra packages to add to the build, in dependency order
345 EXTRA_PACKAGES =
346
347 # Whether to install $(EXTRA_PACKAGES)
348 InstallExtraPackages = NO
349
350 # Run "ghc-pkg check" on each package
351 CHECK_PACKAGES = NO
352
353 # ----------------------------------------------------------------------------
354
355 # There are a number of things which technically depend on GHC (e.g. if
356 # ghc changes then Haskell files may be compiled differently, or Cabal
357 # packages may be configured differently). By default we therefore
358 # have dependencies on the compiler executable.
359
360 # However, in practice, having a dependency on GHC is just a pain: We
361 # normally don't want to spend time recompiling other things while
362 # we're working on the compiler, and even if we did, GHC will normally
363 # decide compilation isn't needed anyway. So by setting LAX_DEPENDENCIES
364 # to YES you can turn these dependencies into order-only dependencies,
365 # i.e. GHC must exist, but if it's newer than other targets then
366 # rebuilding is not necessary.
367
368 LAX_DEPENDENCIES = NO
369
370 # ----------------------------------------------------------------------------
371 # Options for GHC's RTS
372
373 # Build an optimised RTS. Remember that we need to turn on
374 # optimisation both for C code (-optc-O2) and .cmm code (-O2). For
375 # the debugging RTS flavour, rts/ghc.mk overrides these to turn off
376 # optimisation.
377 GhcRtsHcOpts=-optc-O2 -O2
378 GhcRtsCcOpts=-fomit-frame-pointer
379
380 # Include the front panel code? Needs GTK+.
381 GhcRtsWithFrontPanel = NO
382
383 # Include support for CPU performance counters via the PAPI library in the RTS?
384 # (PAPI: http://icl.cs.utk.edu/papi/)
385 GhcRtsWithPapi = NO
386 PapiLibDir=
387 PapiIncludeDir=
388
389 # Configuration for libffi
390 UseSystemLibFFI=@UseSystemLibFFI@
391 # Flags to go into package.conf for rts
392 FFILibDir=@FFILibDir@
393 FFIIncludeDir=@FFIIncludeDir@
394
395
396 ################################################################################
397 #
398 # Paths (see paths.mk)
399 #
400 ################################################################################
401
402 # Directory used by GHC (and possibly other tools) for storing
403 # temporary files. If your TMPDIR isn't big enough, either override
404 # this in build.mk or set your environment variable "TMPDIR" to point
405 # to somewhere with more space. (TMPDIR=. is a good choice).
406
407 # DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
408 # override an environment variable with the value of the make variable
409 # of the same name (if it exists) when executing sub-processes, so
410 # setting the TMPDIR env var would have no effect in the build tree.
411
412 DEFAULT_TMPDIR = /tmp
413 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
414 DEFAULT_TMPDIR = /C/TEMP
415 endif
416 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
417 DEFAULT_TMPDIR = /C/TEMP
418 endif
419
420 BIN_DIST_NAME = ghc-$(ProjectVersion)
421 BIN_DIST_PREP_DIR = bindistprep/$(BIN_DIST_NAME)
422 BIN_DIST_PREP_TAR = bindistprep/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
423 BIN_DIST_PREP_TAR_BZ2 = $(BIN_DIST_PREP_TAR).bz2
424 BIN_DIST_TAR_BZ2 = $(BIN_DIST_NAME)-$(TARGETPLATFORM).tar.bz2
425 BIN_DIST_LIST = bindist-list
426
427 WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-$(TargetArch_CPP)-windows
428 WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
429
430 # -----------------------------------------------------------------------------
431 # Utilities programs: flags
432
433 # If you want to give any standard flags to pretty much any utility
434 # (see utils.mk for a complete list), by adding a line here
435 #
436 # SRC_P_OPTS += ...
437 #
438 # where P is the utility. For example, to add -O to all Haskell
439 # compilations,
440 #
441 # SRC_HC_OPTS += -O
442
443
444 # SRC_HC_OPTS includes flags to be added to *every* Haskell
445 # compilation. Setting SRC_HC_OPTS is a good way to set the default
446 # optimisation level (-O) and heap size (-H<size>).
447 #
448 # SRC_HC_OPTS is *not* for adding flags that are required to make your
449 # build work. Examples:
450 #
451 # - instead of using -pgmc/-pgma-/-pgml, use the --with-gcc option to configure
452 #
453 # - if you need -optc, -opta, or -optl flags, the CONF_CC_* and CONF_LD_*
454 # variables are more appropriate (set via configure)
455 #
456 # Note that SRC_HC_OPTS are added to every Haskell compilation,
457 # including when using the bootstrapping compiler (stage 0), So don't
458 # put options here that are only supported by very recent GHCs.
459 #
460 SRC_HC_OPTS += -H32m -O
461
462 # These flags make flex 8-bit
463 SRC_FLEX_OPTS += -8
464
465 # Flags for CPP when running GreenCard on .pgc files
466 GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__
467
468
469 # -----------------------------------------------------------------------------
470 # Names of programs in the GHC tree
471 #
472 # xxx_PGM the name of an executable, without the path
473 # xxx the executable relative to the current dir
474
475 GHC_UNLIT_PGM = unlit$(exeext)
476 GHC_HP2PS_PGM = hp2ps$(exeext)
477 GHC_GHCTAGS_PGM = ghctags$(exeext)
478 GHC_HSC2HS_PGM = hsc2hs$(exeext)
479 GHC_TOUCHY_PGM = touchy$(exeext)
480 GHC_SPLIT_PGM = ghc-split
481 GHC_SYSMAN_PGM = SysMan
482 GHC_GENPRIMOP_PGM = genprimopcode$(exeext)
483 GHC_GENAPPLY_PGM = genapply$(exeext)
484 GHC_CABAL_PGM = ghc-cabal$(exeext)
485 GHC_PKG_PGM = ghc-pkg$(exeext)
486 GHC_LTX_PGM = ltx$(exeext)
487 GHC_MKDIRHIER_PGM = mkdirhier
488 GHC_LNDIR_PGM = lndir
489
490 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
491 GHC_CP = "xcopy /y"
492 GHC_PERL = perl
493 else
494 GHC_CP = $(CP)
495 GHC_PERL = $(PERL)
496 endif
497
498 HP2PS = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
499 SPLIT = $(INPLACE_LIB)/$(GHC_SPLIT_PGM)
500 SYSMAN = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
501 LTX = $(GHC_LTX_DIR)/$(GHC_LTX_PGM)
502 LNDIR = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM)
503
504 UNLIT = $(INPLACE_LIB)/$(GHC_UNLIT_PGM)
505 TOUCHY = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM)
506 MKDIRHIER = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM)
507 GHC_CABAL_INPLACE = $(INPLACE_BIN)/$(GHC_CABAL_PGM)
508 GENAPPLY_INPLACE = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM)
509 GHC_PKG_INPLACE = $(INPLACE_BIN)/$(GHC_PKG_PGM)
510 GHCTAGS_INPLACE = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
511 HSC2HS_INPLACE = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
512 GENPRIMOP_INPLACE = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
513
514 GENERATED_FILE = chmod a-w
515 EXECUTABLE_FILE = chmod +x
516
517 #-----------------------------------------------------------------------------
518 # Installed GHC
519
520 # $(GHC) points to installed version of the compiler.
521 #
522 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
523 # (because the version numbers have to be calculated).
524
525 GHC := @WithGhc@
526 # If we have a make dependency on c:/ghc/ghc, and the file is actually
527 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
528 # and that it doesn't know how to create it.
529 ifneq "$(wildcard $(GHC).exe)" ""
530 GHC := $(GHC).exe
531 endif
532
533 # Sometimes we want to invoke ghc from the build tree in different
534 # places (eg. it's handy to have a nofib & a ghc build in the same
535 # tree). We can refer to "this ghc" as $(GHC_INPLACE):
536
537 GHC_INPLACE = $(GHC_STAGE1)
538
539 GHC_STAGE0_ABS = $(GHC)
540 GHC_STAGE1_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage1$(exeext)
541 GHC_STAGE2_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage2$(exeext)
542 GHC_STAGE3_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage3$(exeext)
543
544 GHC_STAGE0 = $(GHC)
545 GHC_STAGE1 = $(INPLACE_BIN)/ghc-stage1$(exeext)
546 GHC_STAGE2 = $(INPLACE_BIN)/ghc-stage2$(exeext)
547 GHC_STAGE3 = $(INPLACE_BIN)/ghc-stage3$(exeext)
548
549 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
550
551 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf.d
552
553 GhcVersion = @GhcVersion@
554 GhcPatchLevel = @GhcPatchLevel@
555 GhcMajVersion = @GhcMajVersion@
556 GhcMinVersion = @GhcMinVersion@
557
558 # Canonicalised ghc version number, used for easy (integer) version
559 # comparisons. We must expand $(GhcMinVersion) to two digits by
560 # adding a leading zero if necessary:
561 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
562 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
563 else
564 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
565 endif
566
567 GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@
568
569 #-----------------------------------------------------------------------------
570 # C compiler
571 #
572 # NB. Don't override $(WhatGccIsCalled) using build.mk, re-configure using
573 # the flag --with-gcc=<blah> instead. The reason is that the configure script
574 # needs to know which gcc you're using in order to perform its tests.
575
576 WhatGccIsCalled = @WhatGccIsCalled@
577 GccVersion = @GccVersion@
578 ifeq "$(phase)" "0"
579 CrossCompilePrefix =
580 else
581 CrossCompilePrefix = @CrossCompilePrefix@
582 endif
583 # TargetPlatformFull retains the string passed to configure so we have it in
584 # the necessary format to pass to libffi's configure.
585 TargetPlatformFull = @TargetPlatformFull@
586 GccLT34 = @GccLT34@
587 GccLT46 = @GccLT46@
588
589 CC = $(WhatGccIsCalled)
590 CC_STAGE0 = @CC_STAGE0@
591 CC_STAGE1 = $(CC)
592 CC_STAGE2 = $(CC)
593 CC_STAGE3 = $(CC)
594
595 AS = $(WhatGccIsCalled)
596 AS_STAGE0 = @CC_STAGE0@
597 AS_STAGE1 = $(AS)
598 AS_STAGE2 = $(AS)
599 AS_STAGE3 = $(AS)
600
601 # We don't have an LD_STAGE0. CC_STAGE0 is determined by asking "ghc
602 # --info", and it doesn't report an LD.
603 LD_STAGE0 = error-no-ld-stage0
604 LD_STAGE1 = $(LD)
605 LD_STAGE2 = $(LD)
606 LD_STAGE3 = $(LD)
607
608 # Cross-compiling options
609 #
610 CrossCompiling = @CrossCompiling@
611
612 # Change this to YES if you're building a cross-compiler and don't
613 # want to build stage 2.
614 Stage1Only = NO
615
616 # Install stage 2 by default, or stage 1 in the cross compiler
617 # case. Can be changed to 3
618 INSTALL_GHC_STAGE= $(if $(filter YES,$(Stage1Only)),1,2)
619
620 # C compiler and linker flags from configure (e.g. -m<blah> to select
621 # correct C compiler backend). The stage number is the stage of GHC
622 # that is being used to compile with.
623 CONF_CC_OPTS_STAGE0 = @CONF_CC_OPTS_STAGE0@
624 CONF_CC_OPTS_STAGE1 = @CONF_CC_OPTS_STAGE1@
625 CONF_CC_OPTS_STAGE2 = @CONF_CC_OPTS_STAGE2@
626 CONF_GCC_LINKER_OPTS_STAGE0 = @CONF_GCC_LINKER_OPTS_STAGE0@
627 CONF_GCC_LINKER_OPTS_STAGE1 = @CONF_GCC_LINKER_OPTS_STAGE1@
628 CONF_GCC_LINKER_OPTS_STAGE2 = @CONF_GCC_LINKER_OPTS_STAGE2@
629 CONF_LD_LINKER_OPTS_STAGE0 = @CONF_LD_LINKER_OPTS_STAGE0@
630 CONF_LD_LINKER_OPTS_STAGE1 = @CONF_LD_LINKER_OPTS_STAGE1@
631 CONF_LD_LINKER_OPTS_STAGE2 = @CONF_LD_LINKER_OPTS_STAGE2@
632 CONF_CPP_OPTS_STAGE0 = @CONF_CPP_OPTS_STAGE0@
633 CONF_CPP_OPTS_STAGE1 = @CONF_CPP_OPTS_STAGE1@
634 CONF_CPP_OPTS_STAGE2 = @CONF_CPP_OPTS_STAGE2@
635
636 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
637 CONF_CC_OPTS += -G0
638 endif
639
640 # The .hsc files aren't currently safe for cross-compilation on Windows:
641 # libraries\haskeline\.\System\Console\Haskeline\Backend\Win32.hsc:160
642 # directive "let" is not safe for cross-compilation
643 ifneq "$(Windows)" "YES"
644 SRC_HSC2HS_OPTS += --cross-safe
645 endif
646 SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS) $(CONF_CC_OPTS_STAGE0)))
647 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
648 ifeq "$(CrossCompiling)" "YES"
649 SRC_HSC2HS_OPTS += --cross-compile
650 endif
651
652 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
653 WINDRES = $(INPLACE_MINGW)/bin/windres
654 else ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
655 WINDRES = $(INPLACE_MINGW)/bin/windres
656 endif
657
658 #-----------------------------------------------------------------------------
659 # Mingwex Library
660 #
661 HaveLibMingwEx = @HaveLibMingwEx@
662 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
663 DLLTOOL = inplace/mingw/bin/dlltool.exe
664 else ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
665 DLLTOOL = inplace/mingw/bin/dlltool.exe
666 endif
667
668 #-----------------------------------------------------------------------------
669 # Flex (currently unused, could be moved to glafp-utils)
670
671 # FLEX = @LEX@
672 # Don't bother with -lfl, we define our own yywrap()s anyway.
673 # FLEX_LIB =
674 #WAS:FLEX_LIB = @LEXLIB@
675
676 #-----------------------------------------------------------------------------
677 # Other standard (ha!) Unix utilities
678
679 AR = @ArCmd@
680 AR_OPTS = @ArArgs@
681 ArSupportsAtFile = @ArSupportsAtFile@
682
683 AR_STAGE0 = @AR_STAGE0@
684 AR_STAGE1 = $(AR)
685 AR_STAGE2 = $(AR)
686 AR_STAGE3 = $(AR)
687 AR_OPTS_STAGE0 = @AR_OPTS_STAGE0@
688 AR_OPTS_STAGE1 = $(AR_OPTS)
689 AR_OPTS_STAGE2 = $(AR_OPTS)
690 AR_OPTS_STAGE3 = $(AR_OPTS)
691 EXTRA_AR_ARGS_STAGE0 = $(EXTRA_AR_ARGS)
692 EXTRA_AR_ARGS_STAGE1 = $(EXTRA_AR_ARGS)
693 EXTRA_AR_ARGS_STAGE2 = $(EXTRA_AR_ARGS)
694 EXTRA_AR_ARGS_STAGE3 = $(EXTRA_AR_ARGS)
695 ArSupportsAtFile_STAGE0 = @ArSupportsAtFile_STAGE0@
696 ArSupportsAtFile_STAGE1 = $(ArSupportsAtFile)
697 ArSupportsAtFile_STAGE2 = $(ArSupportsAtFile)
698 ArSupportsAtFile_STAGE3 = $(ArSupportsAtFile)
699
700 CONTEXT_DIFF = @ContextDiffCmd@
701 CP = cp
702 # It's not easy to separate the CPP program from its flags, as
703 # AC_PROG_CPP defines CPP as "/usr/bin/gcc -E"
704 CPP = @CPP@ @CPPFLAGS@
705 CTAGS = $(ETAGS)
706 #
707 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
708 # behave plausibly on Haskell sources.
709 #
710 RAWCPP_FLAGS = -undef -traditional
711 FIND = @FindCmd@
712
713 #
714 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
715 # install-sh script (if chosen). This not terribly useful to us, so we convert
716 # it into an abs. path.
717 #
718 INSTALL = @INSTALL@
719 INSTALL := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
720
721 LATEX = latex
722 PDFLATEX = pdflatex
723 BIBTEX = bibtex
724 LN_S = @LN_S@
725 MV = mv
726 NROFF = nroff
727 PERL = @PerlCmd@
728 PIC = pic
729 RANLIB = @RANLIB@
730 SED = @SedCmd@
731 TR = tr
732 SHELL = /bin/sh
733
734 HaveDtrace = @HaveDtrace@
735 USE_DTRACE = $(HaveDtrace)
736 DTRACE = @DtraceCmd@
737
738 LD = @LdCmd@
739 NM = @NmCmd@
740 OBJDUMP = @ObjdumpCmd@
741
742 LLC = @LlcCmd@
743 OPT = @OptCmd@
744
745 # GNU ld supports input via a linker script, which is useful to avoid
746 # overflowing command-line length limits.
747 LdIsGNULd = @LdIsGNULd@
748
749 # Set to YES if ld has the --build-id flag. Sometimes we need to
750 # disable it with --build-id=none.
751 LdHasBuildId = @LdHasBuildId@
752
753 # Set to YES if ld has the --no_compact_unwind flag. See #5019
754 # and compiler/main/DriverPipeline.hs.
755 LdHasNoCompactUnwind = @LdHasNoCompactUnwind@
756
757 # On MSYS, building with SplitObjs=YES fails with
758 # ar: Bad file number
759 # see #3201. We need to specify a smaller max command-line size
760 # to work around it. 32767 doesn't work; 30000 does, but says
761 # xargs: value for -s option should be < 28153
762 # so we now use 20000 to be comfortably below this bound
763 XARGS = xargs
764 ifeq "$(Windows)" "YES"
765 XARGS_OPTS = -s 20000
766 endif
767
768 #
769 # In emergency situations, REAL_SHELL is used to perform shell commands
770 # from within the ghc driver script, by scribbling the command line to
771 # a temp file and then having $(REAL_SHELL) execute it.
772 #
773 # The reason for having to do this is that overly long command lines
774 # cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris
775 # 2.5.1), which is why this backdoor is provided. The situation of overly
776 # long command lines is either encountered while doing `make boot' in compiler/,
777 # or when linking the compiler binary (`hsc').
778 #
779 # We do not use SHELL to execute long commands, as `make' will more than likely
780 # override whatever setting you have in your environment while executing.
781
782 # By default, REAL_SHELL is set equal to SHELL, which is not really a smart move
783 # as it is SHELL that will show up the bogosity in the first place, but setting
784 # it to anything else isn't really portable.
785 #
786 # ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise)
787 # with REAL_SHELL set to something else than /bin/sh, for instance, your favourite
788 # command shell.
789 #
790 REAL_SHELL = $(SHELL)
791
792 ifeq "$(TARGETPLATFORM)" "x86_64-unknown-mingw32"
793 STRIP_CMD = $(TOP)/inplace/mingw/bin/strip.exe
794 else
795 STRIP_CMD = strip
796 endif
797 PATCH_CMD = @PatchCmd@
798 TAR_CMD = @TarCmd@
799 BZIP2_CMD = bzip2
800 GZIP_CMD = gzip
801
802 ifeq "$(Windows)" "YES"
803 TOUCH_CMD = $(utils/touchy_dist_INPLACE)
804 TOUCH_DEP = $(TOUCH_CMD)
805 else
806 TOUCH_CMD = touch
807 TOUCH_DEP =
808 endif
809
810 HSCOLOUR_CMD = @HSCOLOUR@
811
812 TIME_CMD = @TimeCmd@
813
814 # GTK+
815 GTK_CONFIG_CMD = @GTK_CONFIG@
816
817 # Set this if you want to use Inno Setup to build a Windows installer
818 # when you make a bindist
819 ISCC_CMD =
820
821 #-----------------------------------------------------------------------------
822 # DocBook XML stuff
823
824 BUILD_DOCBOOK_HTML = @BUILD_DOCBOOK_HTML@
825 BUILD_DOCBOOK_PS = @BUILD_DOCBOOK_PS@
826 BUILD_DOCBOOK_PDF = @BUILD_DOCBOOK_PDF@
827 DBLATEX = @DblatexCmd@
828 # filename.as.url=0 is needed with dblatex 0.3.4 (#7486)
829 DBLATEX_OPTS = -P 'filename.as.url=0'
830 XSLTPROC = @XsltprocCmd@
831 XMLLINT = @XmllintCmd@
832 HAVE_DOCBOOK_XSL = @HAVE_DOCBOOK_XSL@
833 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
834 XSLTPROC_LABEL_OPTS = --stringparam toc.section.depth 3 \
835 --stringparam section.autolabel 1 \
836 --stringparam section.label.includes.component.label 1
837
838 #-----------------------------------------------------------------------------
839 # FPtools support software
840
841 #
842 # ghc-pkg
843 #
844 GHC_PKG = @GhcPkgCmd@
845
846 #
847 # Happy
848 #
849 HAPPY = @HappyCmd@
850 HAPPY_VERSION = @HappyVersion@
851 #
852 # Options to pass to Happy when we're going to compile the output with GHC
853 #
854 SRC_HAPPY_OPTS = -agc --strict
855
856 #
857 # Alex
858 #
859 ALEX = @AlexCmd@
860 ALEX_VERSION = @AlexVersion@
861 Alex3 = @Alex3@
862 #
863 # Options to pass to Happy when we're going to compile the output with GHC
864 #
865 ifeq "$(Alex3)" "YES"
866 # We aren't using the Unicode support in Alex 3.0 yet, in fact we do our own
867 # Unicode handling, so diable Alex's.
868 SRC_ALEX_OPTS = -g --latin1
869 else
870 SRC_ALEX_OPTS = -g
871 endif
872
873 # Should we build haddock docs?
874 HADDOCK_DOCS = YES
875 # And HsColour the sources?
876 ifeq "$(HSCOLOUR_CMD)" ""
877 HSCOLOUR_SRCS = NO
878 else
879 HSCOLOUR_SRCS = YES
880 endif
881
882 ################################################################################
883 #
884 # 31-bit-Int Core files
885 #
886 ################################################################################
887
888 #
889 # It is possible to configure the compiler and prelude to support 31-bit
890 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
891 # architecture. Currently the only useful output from this option is external Core
892 # files. The following additions to your build.mk will produce the
893 # 31-bit core output. Note that this is *not* just a library "way"; the
894 # compiler must be built a special way too.
895
896 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
897 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
898 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
899 # SplitObjs=NO
900
901 ################################################################################
902 #
903 # Library configure arguments
904 #
905 ################################################################################
906
907 CONFIGURE_ARGS = @CONFIGURE_ARGS@
908
909 ################################################################################
910 #
911 # To be passed to sub-builds
912 #
913 ################################################################################
914
915 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
916 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
917
918 GMP_INCLUDE_DIRS = @GMP_INCLUDE_DIRS@
919 GMP_LIB_DIRS = @GMP_LIB_DIRS@