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