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