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