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