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