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