Configurable iconv header and library locations
[ghc-hetmet.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 include $(TOP)/mk/install.mk
30
31 ################################################################################
32 #
33 #               Global configuration options
34 #
35 ################################################################################
36
37 # BootingFromHc - build GHC and the libraries from .hc files?
38 BootingFromHc = @BootingFromHc@
39
40 # BootingFromUnregisterisedHc - treat .hc files as containing unregisterised
41 # rather than registerised code, i.e., disable the mangler?
42 BootingFromUnregisterisedHc = @BootingFromUnregisterisedHc@
43
44 NO_INCLUDE_DEPS = NO
45 NO_INCLUDE_PKGDATA = NO
46
47 # Should we build latex docs?
48 LATEX_DOCS = NO
49
50 # Mac OS X deployment target (to cross-compile for older OS versions)
51 #
52 MACOSX_DEPLOYMENT_VERSION = @MACOSX_DEPLOYMENT_VERSION@
53 MACOSX_DEPLOYMENT_SDK = @MACOSX_DEPLOYMENT_SDK@
54
55 ifneq "$(MACOSX_DEPLOYMENT_VERSION)" ""
56 MACOSX_DEPLOYMENT_CC_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
57                             -isysroot $(MACOSX_DEPLOYMENT_SDK) \
58                             --no-builtin-fprintf
59 MACOSX_DEPLOYMENT_LD_OPTS = -mmacosx-version-min=$(MACOSX_DEPLOYMENT_VERSION) \
60                             -Wl,-syslibroot,$(MACOSX_DEPLOYMENT_SDK)
61 # We don't extend SRC_CC_OPTS and friends here directly, as (a) they may get
62 # overwritten in build.mk and (b) we must not use the deployment options in
63 # stage 1 or we get a linker error if the bootstrap compiler is for a more 
64 # recent OS version.
65 #
66 # We need --no-builtin-fprintf, as the use of the builtin function optimisation
67 # for fprintf together with #include "PosixSource" in the RTS leads to the
68 # use of fwrite$UNIX2003 (with GCC 4.0.1 on Mac OS X 10.5.2).
69 endif
70
71 ################################################################################
72 #
73 # Variables that control how the compiler itself is built
74 #
75 ################################################################################
76
77 # The compiler used to build GHC is $(GHC).  To change the actual compiler
78 # used, re-configure with --with-ghc=<path-to-ghc>.
79
80 # Extra ways in which to build the compiler (for example, you might want to
81 # build a profiled compiler so you can see where it spends its time)
82 GhcCompilerWays=
83
84 # Extra option flags to pass to the compiler that compiles the compiler
85 # (Ones that are essential are wired into compiler/Makefile)
86 # Typical options to use here:
87 #
88 #       -DDEBUG         include debugging code and assertions (will make the
89 #                       compiler slower and produce debugging output, but useful
90 #                       for development)
91 #
92 #       -dcore-lint     check the types after every pass of the compiler;
93 #                       a pretty strong internal check of the compiler being
94 #                       used to compile GHC.  Useful when bootstrapping.
95 GhcHcOpts=-Rghc-timing
96
97 # Extra options added to specific stages of the compiler bootstrap.
98 # These are placed later on the command line, and may therefore
99 # override options from $(GhcHcOpts).
100 GhcStage1HcOpts=
101 GhcStage2HcOpts=-O2
102 GhcStage3HcOpts=-O2
103
104 GhcProfiled=NO
105 GhcDebugged=NO
106 GhcLibProfiled=$(if $(filter p,$(GhcLibWays)),YES,NO)
107
108 # Build shared and/or static libs?
109 PlatformSupportsSharedLibs = $(if $(filter $(TARGETPLATFORM),i386-unknown-linux x86_64-unknown-linux),YES,NO)
110 ifeq "$(PlatformSupportsSharedLibs)" "YES"
111 BuildSharedLibs = YES
112 else
113 BuildSharedLibs = NO
114 endif
115 # ToDo later:
116 # BuildStaticLibs=@BuildStaticLibs@
117
118 # Build a compiler that will build *unregisterised* libraries and
119 # binaries by default.  Unregisterised code is supposed to compile and
120 # run without any support for architecture-specific assembly mangling,
121 # register assignment or tail-calls, and is therefore a good way to get
122 # started when porting GHC to new architectures.
123 #
124 # If this is set to NO, you can still use the unregisterised way
125 # (way 'u') to get unregisterised code, but the default way will be
126 # registerised.
127 #
128 # NOTE: the stage1 compiler will be a registerised binary (assuming
129 # the compiler you build with is generating registerised binaries), but
130 # the stage2 compiler will be an unregisterised binary.
131 #
132 ifneq "$(findstring $(HostArch_CPP), alpha hppa)" ""
133 GhcUnregisterised=YES
134 else
135 GhcUnregisterised=NO
136 endif
137
138 # Build a compiler with a native code generator backend
139 # (as well as a C backend)
140 #
141 # Target platforms supported:
142 #   i386, powerpc
143 #   AIX is not supported 
144 ArchSupportsNCG=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc)))
145 OsSupportsNCG=$(strip $(patsubst $(HostOS_CPP), YES, $(patsubst aix,,$(HostOS_CPP))))
146
147 # lazy test, because $(GhcUnregisterised) might be set in build.mk later.
148 GhcWithNativeCodeGen=$(strip\
149     $(if $(filter YESYESNO,\
150                   $(OsSupportsNCG)$(ArchSupportsNCG)$(GhcUnregisterised)),YES,NO))
151
152 HaveLibDL = @HaveLibDL@
153
154 # ArchSupportsSMP should be set iff there is support for that arch in
155 # includes/stg/SMP.h
156 ArchSupportsSMP=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 sparc powerpc)))
157
158 # lazy test, because $(GhcUnregisterised) might be set in build.mk later.
159 GhcWithSMP=$(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
160
161 # Whether to include GHCi in the compiler.  Depends on whether the RTS linker
162 # has support for this OS/ARCH combination.
163
164 OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd netbsd openbsd darwin)))
165 ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 x86_64 powerpc sparc sparc64)))
166
167 ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
168 GhcWithInterpreter=YES
169 else 
170 GhcWithInterpreter=NO
171 endif
172
173 # GhcEnableTablesNextToCode tells us whether the target architecture
174 # supports placing info tables directly before the entry code
175 # (see TABLES_NEXT_TO_CODE in the RTS).  Whether we actually compile for
176 # TABLES_NEXT_TO_CODE depends on whether we're building unregisterised
177 # code or not, which may be decided by options to the compiler later.
178 ifneq "$(findstring $(TargetArch_CPP)X, ia64X powerpc64X)" ""
179 GhcEnableTablesNextToCode=NO
180 else
181 GhcEnableTablesNextToCode=YES
182 endif
183
184 # Whether to use libffi for adjustors (foreign import "wrapper") or
185 # not.  If we have built-in support (rts/Adjustor.c) then we use that,
186 # otherwise we fall back on libffi, which is slightly slower.
187 ArchHasAdjustorSupport=$(strip $(if $(findstring $(HostArch_CPP),i386 x86_64 alpha powerpc ia64,),YES,NO))
188 ifeq "$(ArchHasAdjustorSupport)" "YES"
189 UseLibFFIForAdjustors=NO
190 else
191 UseLibFFIForAdjustors=YES
192 endif
193
194 # On Windows we normally want to make a relocatable bindist, to we
195 # ignore flags like libdir
196 ifeq "$(Windows)" "YES"
197 RelocatableBuild = YES
198 else
199 RelocatableBuild = NO
200 endif
201
202 # When building bindists we set this to yes so that the binaries are as
203 # portable as possible.
204 BeConservative = NO
205
206 #
207 # Building various ways?
208 # (right now, empty if not).
209 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
210 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
211
212 #------------------------------------------------------------------------------
213 # Options for Libraries
214
215 # Which directory (in libraries/) contains the integer library?
216 INTEGER_LIBRARY=integer-gmp
217
218 # We build the libraries at least the "vanilla" way (way "v")
219 GhcLibWays = v
220
221 # In addition to the normal sequential way, the default is to also build
222 # profiled prelude libraries unless we are booting from .hc files
223 ifneq "$(BootingFromHc)" "YES"
224 GhcLibWays += p
225 endif
226
227 ifeq "$(BuildSharedLibs)" "YES"
228 GhcLibWays += dyn
229 endif
230
231 # In addition, the RTS is built in some further variations.  Ways that
232 # make sense here:
233
234 #   thr         : threaded
235 #   thr_p       : threaded profiled
236 #   debug       : debugging (compile with -g for the C compiler, and -DDEBUG)
237 #   debug_p     : debugging profiled
238 #   thr_debug   : debugging threaded
239 #   thr_debug_p : debugging threaded profiled
240 #   t           : ticky-ticky profiling
241 #   debug_t     : debugging ticky-ticky profiling
242 #   l           : event logging
243 #   thr_l       : threaded and event logging
244 #   thr_debug_l : threaded and debugging and event logging
245 #
246 GhcRTSWays=l
247
248 # Usually want the debug version
249 ifeq "$(BootingFromHc)" "NO"
250 GhcRTSWays += debug 
251 endif
252
253 ifeq "$(BuildSharedLibs)" "YES"
254 GhcRTSWays += dyn debug_dyn $(if $(findstring NO, $(GhcUnregisterised)),thr_dyn thr_debug_dyn)
255 endif
256
257 # Want the threaded versions unless we're unregisterised
258 # Defer the check until later by using $(if..), because GhcUnregisterised might
259 # be set in build.mk, which hasn't been read yet.
260 GhcRTSWays += $(if $(findstring NO, $(GhcUnregisterised)),thr thr_debug thr_l,)
261 GhcRTSWays += $(if $(findstring p, $(GhcLibWays)),$(if $(findstring NO, $(GhcUnregisterised)),thr_p,),)
262
263 # We can only build GHCi threaded if we have a threaded RTS:
264 GhcThreaded = $(if $(findstring thr,$(GhcRTSWays)),YES,NO)
265
266 # Option flags to pass to GHC when it's compiling modules in
267 # fptools/libraries.  Typically these are things like -O or
268 # -dcore-lint or -H32m.  The ones that are *essential* are wired into
269 # the build system.
270 #
271 #       -O(2) is pretty desirable, otherwise no inlining of prelude
272 #               things (incl "+") happens when compiling with this compiler
273 #
274 #       -XGenerics switches on generation of support code for 
275 #               derivable type classes.  This is now off by default,
276 #               but we switch it on for the libraries so that we generate
277 #               the code in case someone importing wants it
278
279 GhcLibHcOpts=-O2 -XGenerics
280
281 # Win32 only: Enable the RTS and libraries to be built as DLLs
282 DLLized=@EnableWin32DLLs@
283
284 # Strip local symbols from libraries?  This can make the libraries smaller,
285 # but makes debugging somewhat more difficult.  Doesn't work with all ld's.
286 #
287 StripLibraries=NO
288
289 # These are the URL patterns that Haddock uses to generate the "Source
290 # File" links on each page.
291 PackageSourceURL = http://darcs.haskell.org/packages/$(PACKAGE)/%{FILE}
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
304 # lazy test, so that $(GhcUnregisterised) can be set in build.mk
305 SupportsSplitObjs=$(strip $(if $(filter YES,$(ArchSupportsSplitObjs)),\
306                     $(if $(filter NO,$(BootingFromHc)),\
307                       $(if $(filter NO,$(GhcUnregisterised)),\
308                         YES,\
309                         NO),\
310                       NO),\
311                     NO))
312
313 # By default, enable SplitObjs for the libraries if this build supports it
314 SplitObjs=$(SupportsSplitObjs)
315
316 # Math library
317 LIBM=@LIBM@
318
319 # .NET interop support?
320 #
321 DotnetSupport=NO
322
323 # Build unix package?
324 #
325 GhcLibsWithUnix=@GhcLibsWithUnix@
326
327 CHECK_PACKAGES = NO
328
329 # ----------------------------------------------------------------------------
330 # Options for GHC's RTS
331
332 # For an optimised RTS (you probably don't want to change these; we build
333 # a debugging RTS by default now.  Use -debug to get it).
334 GhcRtsHcOpts=-optc-O2
335 GhcRtsCcOpts=-fomit-frame-pointer
336
337 # Include the front panel code?  Needs GTK+.
338 GhcRtsWithFrontPanel = NO
339
340 # Include support for CPU performance counters via the PAPI library in the RTS?
341 # (PAPI: http://icl.cs.utk.edu/papi/)
342 GhcRtsWithPapi = NO
343 PapiLibDir=
344 PapiIncludeDir=
345
346 ################################################################################
347 #
348 #               Paths (see paths.mk)
349 #
350 ################################################################################
351
352 # Directory used by GHC (and possibly other tools) for storing
353 # temporary files.  If your TMPDIR isn't big enough, either override
354 # this in build.mk or set your environment variable "TMPDIR" to point
355 # to somewhere with more space.  (TMPDIR=. is a good choice).
356
357 # DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
358 # override an environment variable with the value of the make variable
359 # of the same name (if it exists) when executing sub-processes, so
360 # setting the TMPDIR env var would have no effect in the build tree.
361
362 DEFAULT_TMPDIR          = /tmp
363 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
364 DEFAULT_TMPDIR          = /C/TEMP
365 endif
366 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
367 DEFAULT_TMPDIR          = /C/TEMP
368 endif
369
370 BIN_DIST_TOPDIR_ABS=$(TOP)
371 BIN_DIST_DIR=$(BIN_DIST_TOPDIR_ABS)/$(BIN_DIST_NAME)
372
373 BIN_DIST_NAME=ghc-$(ProjectVersion)
374 BIN_DIST_TAR=$(TOP)/$(BIN_DIST_NAME)-$(TARGETPLATFORM).tar
375 BIN_DIST_TAR_BZ2=$(BIN_DIST_TAR).bz2
376 BIN_DIST_PREP_DIR=$(TOP)/bindist-prep
377 BIN_DIST_PREP=$(BIN_DIST_PREP_DIR)/$(BIN_DIST_NAME)
378 BIN_DIST_LIST=$(TOP)/bindist-list
379
380 WINDOWS_INSTALLER_BASE = ghc-$(ProjectVersion)-i386-windows
381 WINDOWS_INSTALLER = $(WINDOWS_INSTALLER_BASE)$(exeext)
382
383 # -----------------------------------------------------------------------------
384 # Utilities programs: flags 
385
386 # If you want to give any standard flags to pretty much any utility
387 # (see utils.mk for a complete list), by adding a line here
388 #
389 #       SRC_P_OPTS += ...
390 #
391 # where P is the utility. For example, to add -O to all Haskell
392 # compilations, 
393 #
394 #       SRC_HC_OPTS += -O
395
396 SRC_HC_OPTS += -H32m -O
397
398 # These flags make flex 8-bit
399 SRC_FLEX_OPTS   += -8
400
401 # Default fptools options for dllwrap.
402 SRC_BLD_DLL_OPTS += --target=i386-mingw32
403
404 # Flags for CPP when running GreenCard on .pgc files
405 GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__
406
407
408 # -----------------------------------------------------------------------------
409 # Names of programs in the GHC tree
410 #
411 #      xxx_PGM          the name of an executable, without the path
412 #      xxx              the executable relative to the current dir
413
414 GHC_UNLIT_PGM           = unlit$(exeext)
415 GHC_HP2PS_PGM           = hp2ps$(exeext)
416 GHC_GHCTAGS_PGM         = ghctags$(exeext)
417 GHC_HSC2HS_PGM          = hsc2hs$(exeext)
418 GHC_TOUCHY_PGM          = touchy$(exeext)
419 GHC_MANGLER_PGM         = ghc-asm
420 GHC_SPLIT_PGM           = ghc-split
421 GHC_SYSMAN_PGM          = SysMan
422 GHC_GENPRIMOP_PGM       = genprimopcode$(exeext)
423 GHC_GENAPPLY_PGM        = genapply$(exeext)
424 GHC_CABAL_PGM           = ghc-cabal$(exeext)
425 GHC_PKG_PGM             = ghc-pkg$(exeext)
426 GHC_MKDEPENDC_PGM       = mkdependC
427 GHC_LTX_PGM             = ltx$(exeext)
428 GHC_MKDIRHIER_PGM       = mkdirhier
429 GHC_LNDIR_PGM           = lndir
430 GHC_DUMMY_GHC_PGM       = dummy-ghc$(exeext)
431
432 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
433 GHC_CP                  = "xcopy /y"
434 GHC_PERL                = perl
435 else
436 GHC_CP                  = $(CP)
437 GHC_PERL                = $(PERL)
438 endif
439
440 HP2PS                   = $(GHC_HP2PS_DIR)/$(GHC_HP2PS_PGM)
441 MANGLER                 = $(INPLACE_LIB)/$(GHC_MANGLER_PGM)
442 SPLIT                   = $(INPLACE_LIB)/$(GHC_SPLIT_PGM)
443 SYSMAN                  = $(GHC_SYSMAN_DIR)/$(GHC_SYSMAN_PGM)
444 LTX                     = $(GHC_LTX_DIR)/$(GHC_LTX_PGM)
445 LNDIR                   = $(GHC_LNDIR_DIR)/$(GHC_LNDIR_PGM)
446
447 UNLIT                   = $(INPLACE_LIB)/$(GHC_UNLIT_PGM)
448 TOUCHY                  = $(INPLACE_LIB)/$(GHC_TOUCHY_PGM)
449 MKDIRHIER               = $(INPLACE_BIN)/$(GHC_MKDIRHIER_PGM)
450 MKDEPENDC               = $(INPLACE_BIN)/$(GHC_MKDEPENDC_PGM)
451 GHC_CABAL_INPLACE       = $(INPLACE_BIN)/$(GHC_CABAL_PGM)
452 GENAPPLY_INPLACE        = $(INPLACE_BIN)/$(GHC_GENAPPLY_PGM)
453 GHC_PKG_INPLACE         = $(INPLACE_BIN)/$(GHC_PKG_PGM)
454 GHCTAGS_INPLACE         = $(INPLACE_BIN)/$(GHC_GHCTAGS_PGM)
455 HSC2HS_INPLACE          = $(INPLACE_BIN)/$(GHC_HSC2HS_PGM)
456 GENPRIMOP_INPLACE       = $(INPLACE_BIN)/$(GHC_GENPRIMOP_PGM)
457 DUMMY_GHC_INPLACE       = $(INPLACE_BIN)/$(GHC_DUMMY_GHC_PGM)
458
459 GENERATED_FILE  = chmod a-w
460 EXECUTABLE_FILE = chmod +x
461
462 #-----------------------------------------------------------------------------
463 # Haskell compilers and mkdependHS
464
465 # $(GHC), $(HBC) and $(NHC) point to installed versions of the relevant
466 # compilers, if available.
467 #
468 # $(HC) is a generic Haskell 98 compiler, set to $(GHC) by default.
469 # $(MKDEPENDHS) is the Haskell dependency generator (ghc -M).
470 #
471 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
472 # (because the version numbers have to be calculated).
473
474 GHC := @WithGhc@
475 # If we have a make dependency on c:/ghc/ghc, and the file is actually
476 # called c:/ghc/ghc.exe, then make will think that ghc doesn't exist
477 # and that it doesn't know how to create it.
478 ifneq "$(wildcard $(GHC).exe)" ""
479 GHC := $(GHC).exe
480 endif
481
482 GhcDir          = $(dir $(GHC))
483
484 # Set to YES if $(GHC) has the editline package installed
485 GhcHasEditline  = @GhcHasEditline@
486
487 HBC             = @HBC@
488 NHC             = @NHC@
489
490 # Sometimes we want to invoke ghc from the build tree in different
491 # places (eg. it's handy to have a nofib & a ghc build in the same
492 # tree).  We can refer to "this ghc" as $(GHC_INPLACE):
493
494 GHC_INPLACE = $(GHC_STAGE1)
495
496 GHC_STAGE0_ABS = $(GHC)
497 GHC_STAGE1_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage1$(exeext)
498 GHC_STAGE2_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage2$(exeext)
499 GHC_STAGE3_ABS = $(TOP)/$(INPLACE_BIN)/ghc-stage3$(exeext)
500
501 GHC_STAGE0  = $(GHC)
502 GHC_STAGE1  = $(INPLACE_BIN)/ghc-stage1$(exeext)
503 GHC_STAGE2  = $(INPLACE_BIN)/ghc-stage2$(exeext)
504 GHC_STAGE3  = $(INPLACE_BIN)/ghc-stage3$(exeext)
505
506 # Install stage 2 by default, can be changed to 3
507 INSTALL_GHC_STAGE=2
508
509 BOOTSTRAPPING_CONF = libraries/bootstrapping.conf
510
511 INPLACE_PACKAGE_CONF = $(INPLACE_LIB)/package.conf
512
513 GhcVersion      = @GhcVersion@
514 GhcPatchLevel   = @GhcPatchLevel@
515 GhcMajVersion   = @GhcMajVersion@
516 GhcMinVersion   = @GhcMinVersion@
517
518 ghc_ge_609 = @ghc_ge_609@
519
520 # Canonicalised ghc version number, used for easy (integer) version
521 # comparisons.  We must expand $(GhcMinVersion) to two digits by
522 # adding a leading zero if necessary:
523 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
524 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
525 else
526 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
527 endif
528
529 #-----------------------------------------------------------------------------
530 # C compiler
531 #
532 # NB. Don't override $(WhatGccIsCalled) using build.mk,  re-configure using
533 # the flag --with-gcc=<blah> instead.  The reason is that the configure script
534 # needs to know which gcc you're using in order to perform its tests.
535
536 HaveGcc         = @HaveGcc@
537 UseGcc          = YES
538 WhatGccIsCalled = @WhatGccIsCalled@
539 GccVersion      = @GccVersion@
540 GccLT34         = @GccLT34@
541 ifeq "$(strip $(HaveGcc))" "YES"
542 ifneq "$(strip $(UseGcc))"  "YES"
543   CC    = cc
544 else
545   CC    = $(WhatGccIsCalled)
546 endif
547 endif
548
549 # default C compiler and linker flags
550 SRC_CC_OPTS = @SRC_CC_OPTS@
551 SRC_LD_OPTS = @SRC_LD_OPTS@
552
553 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
554 SRC_CC_OPTS += -G0
555 endif
556
557 SRC_HSC2HS_OPTS += $(addprefix --cflag=,$(filter-out -O,$(SRC_CC_OPTS)))
558 SRC_HSC2HS_OPTS += $(foreach d,$(GMP_INCLUDE_DIRS),-I$(d))
559
560 #-----------------------------------------------------------------------------
561 # Mingwex Library
562 #
563 HaveLibMingwEx  = @HaveLibMingwEx@
564
565 #-----------------------------------------------------------------------------
566 # Flex (currently unused, could be moved to glafp-utils)
567
568 # FLEX                  = @LEX@
569 # Don't bother with -lfl, we define our own yywrap()s anyway.
570 # FLEX_LIB              = 
571 #WAS:FLEX_LIB           = @LEXLIB@
572
573 #-----------------------------------------------------------------------------
574 # Other standard (ha!) Unix utilities
575
576 AR                      = @ArCmd@
577 ArSupportsInput         = @ArSupportsInput@
578 # Yuckage: for ghc/utils/parallel -- todo: nuke this dependency!!
579 BASH                    = /usr/local/bin/bash
580
581 CONTEXT_DIFF            = @ContextDiffCmd@
582 CP                      = cp
583 CPP                     = @CPP@ @CPPFLAGS@
584 CTAGS                   = $(ETAGS)
585 #
586 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
587 # behave plausibly on Haskell sources.
588 #
589 RAWCPP_FLAGS            = -undef -traditional
590 FIND                    = @FindCmd@
591 SORT                    = @SortCmd@
592 INSTALL                 = @INSTALL@
593 #
594 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
595 # install-sh script (if chosen). This not terribly useful to us, so we convert
596 # it into an abs. path.
597
598 INSTALL                 := $(subst .././install-sh,$(TOP)/install-sh,$(INSTALL))
599 LATEX                   = latex
600 HEVEA                   = hevea
601 HACHA                   = hacha
602 LN_S                    = @LN_S@
603 MANMACROS               = -man
604 MSMACROS                = -ms
605 MV                      = mv
606 NROFF                   = nroff
607 PERL                    = @PerlCmd@
608 PYTHON                  = @PythonCmd@
609 PIC                     = pic
610 PREPROCESSCMD           = $(CC) -E
611 RANLIB                  = @RANLIB@
612 SED                     = @SedCmd@
613 SHELL                   = /bin/sh
614
615 LD                      = @LdCmd@
616
617 # Some ld's support the -x flag and some don't, so the configure
618 # script detects which we have and sets LdXFlag to "-x" or ""
619 # respectively.
620 LD_X                    = @LdXFlag@
621
622 # GNU ld supports input via a linker script, which is useful to avoid
623 # overflowing command-line length limits.
624 LdIsGNULd               = @LdIsGNULd@
625
626 # On MSYS, building with SplitObjs=YES fails with 
627 #   ar: Bad file number
628 # see #3201.  We need to specify a smaller max command-line size
629 # to work around it.  32767 doesn't work; 30000 does.
630 ifeq "$(Windows)" "YES"
631 XARGS = xargs -s 30000
632 else
633 XARGS = xargs
634 endif
635
636 #
637 # In emergency situations, REAL_SHELL is used to perform shell commands
638 # from within the ghc driver script, by scribbling the command line to
639 # a temp file and then having $(REAL_SHELL) execute it. 
640 #
641 # The reason for having to do this is that overly long command lines
642 # cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris
643 # 2.5.1), which is why this backdoor is provided. The situation of overly
644 # long command lines is either encountered while doing `make boot' in compiler/, 
645 # or when linking the compiler binary (`hsc'). 
646 #
647 # We do not use SHELL to execute long commands, as `make' will more than likely
648 # override whatever setting you have in your environment while executing. 
649
650 # By default, REAL_SHELL is set equal to SHELL, which is not really a smart move
651 # as it is SHELL that will show up the bogosity in the first place, but setting
652 # it to anything else isn't really portable.
653 #
654 #  ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise)
655 # with REAL_SHELL set to something else than /bin/sh, for instance, your favourite
656 # command shell.
657 #
658 REAL_SHELL=$(SHELL)
659 SIZE                    = size
660 STRIP                   = strip
661 PATCH                   = @PatchCmd@
662 TAR                     = @TarCmd@
663 ZIP                     = zip
664
665 HSCOLOUR = @HSCOLOUR@
666
667 #
668 # This is special to literate/, ToDo: add literate-specific
669 # configure setup to literate/.
670 #
671 TBL                     = tbl
672 TEX                     = tex
673 TGRIND                  = tgrind
674 TGRIND_HELPER           = /usr/local/lib/tgrind/tfontedpr # XXX
675 TIB                     = tib
676
677 TIME                    = @TimeCmd@
678 TROFF                   = troff
679 UNAME                   = uname
680
681 # GTK+
682 GTK_CONFIG = @GTK_CONFIG@
683
684 # Set this if you want to use Inno Setup to build a Windows installer
685 # when you make a bindist
686 ISCC                    =
687
688 #-----------------------------------------------------------------------------
689 # DocBook XML stuff
690
691 BUILD_DOCBOOK_HTML       = @BUILD_DOCBOOK_HTML@
692 BUILD_DOCBOOK_PS         = @BUILD_DOCBOOK_PS@
693 BUILD_DOCBOOK_PDF        = @BUILD_DOCBOOK_PDF@
694 DBLATEX                  = @DblatexCmd@
695 XSLTPROC                 = @XsltprocCmd@
696 XMLLINT                  = @XmllintCmd@
697 HAVE_DOCBOOK_XSL         = @HAVE_DOCBOOK_XSL@
698 XSLTPROC_HTML_STYLESHEET = http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl
699 XSLTPROC_LABEL_OPTS      = --stringparam toc.section.depth 3 \
700                            --stringparam section.autolabel 1 \
701                            --stringparam section.label.includes.component.label 1
702
703 #-----------------------------------------------------------------------------
704 #               FPtools support software
705
706 BLD_DLL                 = dllwrap
707
708 #
709 # ghc-pkg
710 #
711 GHC_PKG                 = @GhcPkgCmd@
712
713 #
714 # GreenCard
715 #
716 GREENCARD               = @GreenCardCmd@
717 GREENCARD_VERSION       = @GreenCardVersion@            
718
719 #
720 # Happy
721 #
722 HAPPY                   = @HappyCmd@
723 HAPPY_VERSION           = @HappyVersion@                
724 #
725 # Options to pass to Happy when we're going to compile the output with GHC
726 #
727 SRC_HAPPY_OPTS          = -agc --strict
728
729 # Temp. to work around performance problems in the HEAD around 8/12/2003,
730 # A Happy compiled with this compiler needs more stack.
731 SRC_HAPPY_OPTS          += +RTS -K2m -RTS
732
733 #
734 # Alex
735 #
736 ALEX                    = @AlexCmd@
737 ALEX_VERSION            = @AlexVersion@         
738 #
739 # Options to pass to Happy when we're going to compile the output with GHC
740 #
741 SRC_ALEX_OPTS           = -g
742
743 HSTAGS = @HstagsCmd@
744
745 # Should we build haddock docs?
746 HADDOCK_DOCS = YES
747 # And HsColour the sources?
748 ifeq "$(HSCOLOUR)" ""
749 HSCOLOUR_SRCS = NO
750 else
751 HSCOLOUR_SRCS = YES
752 endif
753
754 #
755 # Options for compiling in different `ways'. 
756
757 # To configure up your own way, have a look at some of the standard ways
758 # such as profiling, and create your own set of WAY_*_OPTS defs below.
759 # After having done that, add your way string to WAYS, and after having
760 # run the configure script, the different projects will add the new way
761 # to the list of ways they support.
762 #
763
764 #
765 # Definitions of the different ways:
766 #   
767 #   * their name:
768 #          - tag, e.g., p
769 #          - description, e.g., profiling
770 #   * what they mean to the driver:
771 #          - WAY_p_HC_OPTS gives the list of command-line options
772 #            to the driver.
773 #
774
775 #
776 # The ways currently defined.
777 #
778 ALL_WAYS=v p t l s mp mg debug dyn thr thr_l debug_dyn thr_dyn thr_debug_dyn thr_p thr_debug thr_debug_l debug_p thr_debug_p
779 USER_WAYS=a b c d e f g h j k l m n o A B
780
781 #
782 # The following ways currently have treated specially, p t mg,
783 # as the driver script treats these guys specially and needs to carefully be told
784 # about the options for these. Hence, we hide the required command line options
785 # for these in the driver, as this is the only place they are needed.
786
787 # If you want to add to these default options, fill in the variables below:
788
789 # Way 'v':
790 WAY_v_NAME=vanilla
791 WAY_v_HC_OPTS= 
792
793 # Way 'p':
794 WAY_p_NAME=profiling
795 WAY_p_HC_OPTS= -prof
796
797 # Way 't':
798 WAY_t_NAME=ticky-ticky profiling
799 WAY_t_HC_OPTS= -ticky
800
801 # Way 'l':
802 WAY_l_NAME=event logging
803 WAY_l_HC_OPTS= -eventlog
804
805 # Way `mp': 
806 WAY_mp_NAME=parallel
807 WAY_mp_HC_OPTS=-parallel
808
809 # Way `mg': 
810 WAY_mg_NAME=GranSim
811 WAY_mg_HC_OPTS=-gransim
812
813 #
814 # These ways apply to the RTS only:
815 #
816
817 # Way 'thr':
818 WAY_thr_NAME=threaded
819 WAY_thr_HC_OPTS=-optc-DTHREADED_RTS
820
821 # Way 'thr_p':
822 WAY_thr_p_NAME=threaded profiled
823 WAY_thr_p_HC_OPTS=-optc-DTHREADED_RTS -prof
824
825 # Way 'thr_l':
826 WAY_thr_l_NAME=threaded event logging
827 WAY_thr_l_HC_OPTS=-optc-DTHREADED_RTS -eventlog
828
829 # Way 'debug':
830 WAY_debug_NAME=debug
831 WAY_debug_HC_OPTS=-optc-DDEBUG
832
833 # Way 'debug_p':
834 WAY_debug_p_NAME=debug profiled
835 WAY_debug_p_HC_OPTS=-optc-DDEBUG -prof
836
837 # Way 'debug_t':
838 WAY_debug_t_NAME=debug ticky-ticky profiling
839 WAY_debug_t_HC_OPTS= -ticky -optc-DDEBUG
840
841 # Way 'thr_debug':
842 WAY_thr_debug_NAME=threaded
843 WAY_thr_debug_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG
844
845 # Way 'thr_debug_p':
846 WAY_thr_debug_p_NAME=threaded debug profiling
847 WAY_thr_debug_p_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -prof
848
849 # Way 'thr_debug_l':
850 WAY_thr_debug_l_NAME=threaded debug event logging
851 WAY_thr_debug_l_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -eventlog
852
853 # Way 'dyn': build dynamic shared libraries
854 WAY_dyn_NAME=dyn
855 WAY_dyn_HC_OPTS=-fPIC -dynamic
856
857 # Way 'thr_dyn':
858 WAY_thr_dyn_NAME=thr_dyn
859 WAY_thr_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS
860
861 # Way 'thr_debug_dyn':
862 WAY_thr_debug_dyn_NAME=thr_dyn
863 WAY_thr_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DTHREADED_RTS -optc-DDEBUG
864
865 # Way 'debug_dyn':
866 WAY_debug_dyn_NAME=thr_dyn
867 WAY_debug_dyn_HC_OPTS=-fPIC -dynamic -optc-DDEBUG
868
869 #
870 # Add user-way configurations here:
871 #
872 WAY_A_NAME=
873 WAY_A_HC_OPTS=
874
875 WAY_B_NAME=
876 WAY_B_HC_OPTS=
877
878 WAY_a_NAME=
879 WAY_a_HC_OPTS=
880
881 WAY_b_NAME=
882 WAY_b_HC_OPTS=
883
884 WAY_c_NAME=
885 WAY_c_HC_OPTS=
886
887 WAY_d_NAME=
888 WAY_d_HC_OPTS=
889
890 WAY_e_NAME=
891 WAY_e_HC_OPTS=
892
893 WAY_f_NAME=
894 WAY_f_HC_OPTS=
895
896 WAY_g_NAME=
897 WAY_g_HC_OPTS=
898
899 WAY_h_NAME=
900 WAY_h_HC_OPTS=
901
902 WAY_j_NAME=
903 WAY_j_HC_OPTS=
904
905 WAY_k_NAME=
906 WAY_k_HC_OPTS=
907
908 WAY_l_NAME=
909 WAY_l_HC_OPTS=
910
911 WAY_m_NAME=
912 WAY_m_HC_OPTS=
913
914 WAY_n_NAME=
915 WAY_n_HC_OPTS=
916
917 WAY_o_NAME=
918 WAY_o_HC_OPTS=
919
920 ################################################################################
921 #
922 #               31-bit-Int Core files
923 #
924 ################################################################################
925
926
927 # It is possible to configure the compiler and prelude to support 31-bit
928 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
929 # architecture.  Currently the only useful output from this option is external Core
930 # files.  The following additions to your build.mk will produce the
931 # 31-bit core output.  Note that this is *not* just a library "way"; the
932 # compiler must be built a special way too.
933
934 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
935 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
936 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
937 # SplitObjs=NO
938
939 ################################################################################
940 #
941 #    Library configure arguments
942 #
943 ################################################################################
944
945 CONFIGURE_ARGS = @CONFIGURE_ARGS@
946
947 ################################################################################
948 #
949 #    To be passed to sub-builds
950 #
951 ################################################################################
952
953 ICONV_INCLUDE_DIRS = @ICONV_INCLUDE_DIRS@
954 ICONV_LIB_DIRS = @ICONV_LIB_DIRS@
955
956 ################################################################################
957 #
958 #    Bindist testing directory
959 #
960 ################################################################################
961
962 ifeq "$(Windows)" "YES"
963 BIN_DIST_INST_SUBDIR = "install dir"
964 else
965 # I very much doubt that paths with spaces will work on Unix
966 BIN_DIST_INST_SUBDIR = installed
967 endif
968
969 BIN_DIST_INST_DIR = $(TOP)/bindisttest/$(BIN_DIST_INST_SUBDIR)
970