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