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