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