[project @ 2005-03-30 10:28:08 by simonmar]
[ghc-hetmet.git] / mk / config.mk.in
1 #                                                                -*-makefile-*-
2 # @configure_input@
3 #
4 ################################################################################
5 #
6 # config.mk.in
7 #
8 # This file supplies defaults for many tweakable build configuration
9 # options.  Some of the defaults are filled in by the autoconf-generated
10 # configure script.
11 #
12 # DO NOT EDIT THIS FILE!
13 #
14 #       - config.mk is auto-generated from config.mk.in by configure.
15 #         This may be triggered automatically by the build system (say
16 #         if config.mk.in has changed more recently than config.mk),
17 #         so if you edit config.mk your changes will be spammed.
18 #
19 #       - Settings in this file may be overriden by giving replacement
20 #         definitions in build.mk.  See build.mk.sample for a good
21 #         starting point for a build.mk file.
22 #
23 #         If you don't have a build.mk file then you get defaults for everything.
24 #         The defaults should provide a reasonable vanilla build.
25 #
26 # This is one of only two files that configure generates (the other is config.h)
27 #
28 # There is a section below for each project within the fptools suite
29 #
30 #       PLUS
31 #
32 # a section corresponding to each of the main .mk files 
33 # included by boilerplate.mk (see boilerplate.mk for a list).
34
35
36 ################################################################################
37 #
38 #               Project-wide platform variables
39 #
40 ################################################################################
41
42 # A "platform" is the GNU cpu-type/manufacturer/operating-system target machine
43 # specifier.  E.g. sparc-sun-solaris2
44 #
45 # Build  platform: the platform on which we are doing this build
46 # Host   platform: the platform on which these binaries will run
47 # Target platform: the platform for which this compiler will generate code
48 #
49 # We don't support build & host being different, because the build
50 # process creates binaries that are run during the build, and also
51 # installed.
52 #
53 # If host & target are different, then we are building a compiler
54 # which will generate intermediate .hc files to port to the target
55 # architecture for bootstrapping.  The libraries and stage 2 compiler
56 # will be built as HC files for the target system, and likely won't
57 # build on this host platform.
58 #
59 # An important invariant is that for any piece of source code, the
60 # platform on which the code is going to run is the HOST platform,
61 # and the platform on which we are building is the BUILD platform.
62 # Additionally for the compiler, the platform this compiler will
63 # generate code for is the TARGET.  TARGET is not meaningful outside
64 # the compiler sources.
65 #
66 # Guidelines for when to use HOST vs. TARGET:
67 #
68 #  - In the build system (Makefile, foo.mk), normally we should test
69 #    $(HOSTPLATFORM).  There are some cases (eg. installation), where
70 #    we expect $(HOSTPLATFORM)==$(TARGETPLATFORM), so in those cases it
71 #    doesn't matter which is used.
72 #
73 #  - In the compiler itself, we should test HOST or TARGET depending
74 #    on whether the conditional relates to the code being generated, or
75 #    the platform on which the compiler is running.  See the section
76 #    on "Coding Style" in the commentary for more details.
77 #
78 #  - In all other code, we should be testing HOST only.
79 #
80 # NOTE: cross-compiling is not well supported by the build system.
81 # You have to do a lot of work by hand to cross compile: see the
82 # section on "Porting GHC" in the Building Guide.
83
84 HOSTPLATFORM                    = @HostPlatform@
85 TARGETPLATFORM                  = @TargetPlatform@
86 BUILDPLATFORM                   = @BuildPlatform@
87
88 # Hack alert:
89 # in one or two places, we need to get at the OS version (major and
90 # perhaps even minor), HostOS_Full is the OS name reported by
91 # AC_CANONICAL_SYSTEM.
92 #
93 HostPlatform_CPP                = @HostPlatform_CPP@
94 HostArch_CPP                    = @HostArch_CPP@
95 HostOS_CPP                      = @HostOS_CPP@
96 HostOS_Full                     = @HostOS_Full@
97 HostVendor_CPP                  = @HostVendor_CPP@
98
99 TargetPlatform_CPP              = @TargetPlatform_CPP@
100 TargetArch_CPP                  = @TargetArch_CPP@
101 TargetOS_CPP                    = @TargetOS_CPP@
102 TargetVendor_CPP                = @TargetVendor_CPP@
103
104 BuildPlatform_CPP               = @BuildPlatform_CPP@
105 BuildArch_CPP                   = @BuildArch_CPP@
106 BuildOS_CPP                     = @BuildOS_CPP@
107 BuildVendor_CPP                 = @BuildVendor_CPP@
108
109 @HostPlatform_CPP@_HOST           = 1
110 @TargetPlatform_CPP@_TARGET       = 1
111 @BuildPlatform_CPP@_BUILD         = 1
112
113 @HostArch_CPP@_HOST_ARCH          = 1
114 @TargetArch_CPP@_TARGET_ARCH      = 1
115 @BuildArch_CPP@_BUILD_ARCH        = 1
116
117 @HostOS_CPP@_HOST_OS              = 1
118 @TargetOS_CPP@_TARGET_OS          = 1
119 @BuildOS_CPP@_BUILD_OS            = 1
120
121 @HostVendor_CPP@_HOST_VENDOR      = 1
122 @TargetVendor_CPP@_TARGET_VENDOR  = 1
123 @BuildVendor_CPP@_BUILD_VENDOR    = 1
124
125 # Leading underscores on symbol names in object files
126 # Valid options: YES/NO
127 #
128 LeadingUnderscore=@LeadingUnderscore@
129
130 # Pin a suffix on executables? If so, what (Windows only).
131 exeext=@exeext@
132
133 # Windows=YES if on a Windows platform
134 ifneq "$(findstring $(HostOS_CPP), mingw32 cygwin32)" ""
135 Windows=YES
136 else
137 Windows=NO
138 endif
139
140 ################################################################################
141 #
142 #               project-wide flags
143 #
144 #       Set of options applicable to all fptools projects
145 #
146 ################################################################################
147
148 # BootingFromHc - build GHC and the libraries from .hc files?
149 BootingFromHc = @BootingFromHc@
150
151 # BootingFromUnregisterisedHc - treat .hc files as containing unregisterised
152 # rather than registerised code, i.e., disable the mangler?
153 BootingFromUnregisterisedHc = @BootingFromUnregisterisedHc@
154
155 # Build Order: we build Happy, Haddock and Alex before GHC if they are
156 # in this source tree, just in case our GHC build depends on these
157 # local builds rather than installed versions of the tools.
158 #
159 # Build the libs first if we're bootstrapping from .hc files.
160 ifeq "$(BootingFromHc)" "YES"
161 AllProjects = glafp-utils happy alex haddock libraries hslibs ghc greencard hdirect hood nofib docs
162 else
163 AllProjects = glafp-utils happy alex haddock ghc libraries hslibs greencard hdirect hood nofib docs
164 endif
165
166 #
167 # (OPTIONAL) set ProjectsToBuild to a list of projects to be built.  If this
168 # list is empty, then all projects present in the source tree will be built.
169 #
170 ProjectsToBuild =
171
172 #
173 # set ProjectsDontInstall to a list of projects which are normally built but
174 # not installed.
175 #
176 ProjectsDontInstall = glafp-utils nofib
177
178 #
179 # Should the various project tests directories be built?
180 #
181 IncludeTestDirsInBuild=NO
182
183 #
184 # Should the various project example directories be built?
185 #
186 IncludeExampleDirsInBuild=NO
187
188 #
189 # Which ways should DocBook XML documents be built?
190 # options are: dvi ps pdf html
191 #
192 XMLDocWays=
193
194 ################################################################################
195 #
196 #               GHC project
197
198 #       Set of (configurable) options needed by the ghc tree
199 #       plus their default options (if any).
200 #
201 ################################################################################
202
203 #---------------------------------------------------------------
204 #
205 # Variables that control how the compiler itself is built
206 #
207 #---------------------------------------------------------------
208
209 # The compiler used to build GHC is $(GHC).  To change the actual compiler
210 # used, re-configure with --with-ghc=<path-to-ghc>.
211
212 # Extra ways in which to build the compiler (for example, you might want to
213 # build a profiled compiler so you can see where it spends its time)
214 GhcCompilerWays=
215
216 # Extra option flags to pass to the compiler that compiles the compiler
217 # (Ones that are essential are wired into ghc/compiler/Makefile)
218 # Typical options to use here:
219 #
220 #       -DDEBUG         include debugging code and assertions (will make the
221 #                       compiler slower and produce debugging output, but useful
222 #                       for development)
223 #
224 #       -dcore-lint     check the types after every pass of the compiler;
225 #                       a pretty strong internal check of the compiler being
226 #                       used to compile GHC.  Useful when bootstrapping.
227 GhcHcOpts=-Rghc-timing
228
229 # Extra options added to specific stages of the compiler bootstrap.
230 # These are placed later on the command line, and may therefore
231 # override options from $(GhcHcOpts).
232 GhcStage1HcOpts=
233 GhcStage2HcOpts=
234 GhcStage3HcOpts=
235
236 # Build a compiler that will build *unregisterised* libraries and
237 # binaries by default.  Unregisterised code is supposed to compile and
238 # run without any support for architecture-specific assembly mangling,
239 # register assignment or tail-calls, and is therefore a good way to get
240 # started when porting GHC to new architectures.
241 #
242 # If this is set to NO, you can still use the unregisterised way
243 # (way 'u') to get unregisterised code, but the default way will be
244 # registerised.
245 #
246 # NOTE: the stage1 compiler will be a registerised binary (assuming
247 # the compiler you build with is generating registerised binaries), but
248 # the stage2 compiler will be an unregisterised binary.
249 #
250 GhcUnregisterised=NO
251
252 # Build a compiler with a native code generator backend
253 # (as well as a C backend)
254 #
255 # Target platforms supported:
256 #   i386, powerpc
257 #   sparc has bitrotted
258 ifneq "$(findstring $(HostArch_CPP), i386 x86_64 powerpc)" ""
259 GhcWithNativeCodeGen=YES
260 else
261 GhcWithNativeCodeGen=NO
262 endif
263
264 # Include support for generating Java
265 GhcWithJavaGen=NO
266
267 HaveLibDL = @HaveLibDL@
268 HaveRtldNext = @HaveRtldNext@
269 HaveRtldLocal = @HaveRtldLocal@
270
271 # Whether to include GHCi in the compiler.  Depends on whether the RTS linker
272 # has support for this OS/ARCH combination.
273
274 OsSupportsGHCi=$(strip $(patsubst $(HostOS_CPP), YES, $(findstring $(HostOS_CPP), mingw32 cygwin32 linux solaris2 freebsd netbsd openbsd darwin)))
275 ArchSupportsGHCi=$(strip $(patsubst $(HostArch_CPP), YES, $(findstring $(HostArch_CPP), i386 powerpc powerpc64 sparc sparc64)))
276
277 ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
278 GhcWithInterpreter=YES
279 else 
280 GhcWithInterpreter=NO
281 endif
282
283 #
284 # Building various ways?
285 # (right now, empty if not).
286 BuildingParallel=$(subst mp,YES,$(filter mp,$(WAYS)))
287 BuildingGranSim=$(subst mg,YES,$(filter mg,$(WAYS)))
288
289 #------------------------------------------------------------------------------
290 # Options for Libraries
291
292 # What extra ways to build the libraries in
293 # In addition to the normal sequential way, the default is to also build
294 # profiled prelude libraries.
295 # When booting from .hc files, turn this off.
296 ifeq "$(BootingFromHc)" "YES"
297 GhcLibWays=
298 else
299 GhcLibWays=p
300 endif
301
302 # In addition, the RTS is built in some further variations.  Ways that
303 # make sense here:
304
305 #   thr         : threaded
306 #   thr_p       : threaded profiled
307 #   debug       : debugging (compile with -g for the C compiler, and -DDEBUG)
308 #   debug_p     : debugging profiled
309 #   debug_u     : debugging unregisterised
310 #   thr_debug   : debugging threaded
311 #   thr_debug_p : debugging threaded profiled
312 #
313 ifeq "$(BootingFromHc)" "YES"
314 GhcRTSWays=
315 else
316 GhcRTSWays=thr thr_p debug
317 endif
318
319 # Option flags to pass to GHC when it's compiling modules in
320 # fptools/libraries.  Typically these are things like -O or
321 # -dcore-lint or -H32m.  The ones that are *essential* are wired into
322 # the build system.
323 #
324 #       -O is pretty desirable, otherwise no inlining of prelude
325 #               things (incl "+") happens when compiling with this compiler
326 #
327 #       -fgenerics switches on generation of support code for 
328 #               derivable type classes.  This is now off by default,
329 #               but we switch it on for the libraries so that we generate
330 #               the code in case someone importing wants it
331
332 GhcLibHcOpts=-O -Rghc-timing -fgenerics
333
334 # Win32 only: Enable the RTS and libraries to be built as DLLs
335 DLLized=@EnableWin32DLLs@
336
337 # Strip local symbols from libraries?  This can make the libraries smaller,
338 # but makes debugging somewhat more difficult.  Doesn't work with all ld's.
339 #
340 StripLibraries=NO
341
342
343 # ----------------------------------------------------------------------------
344 # Object-file splitting
345 #
346 #       Set SplitObjs=YES or NO in your build.mk
347 #
348 #       Don't use -split-objs in in GhcLibHcOpts, because the build
349 #               system needs to do other special magic if you are
350 #               doing object-file splitting
351
352 # Don't split object files for libs if we're building DLLs, or booting from
353 # .hc files.
354 SplitObjs=YES
355
356 ifeq "$(DLLized)" "YES"
357 SplitObjs=NO
358 endif
359 ifeq "$(BootingFromHc)" "YES"
360 SplitObjs=NO
361 endif
362 ifeq "$(GhcUnregisterised)" "YES"
363 SplitObjs=NO
364 endif
365 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
366 SplitObjs=NO
367 endif
368
369 # ----------------------------------------------------------------------------
370 # Options for GHC's RTS
371
372 # For an optimised RTS (you probably don't want to change these; we build
373 # a debugging RTS by default now.  Use -package rts_debug to get it).
374 GhcRtsHcOpts=-O2
375 GhcRtsCcOpts=-fomit-frame-pointer
376
377 # Include the front panel code?  Needs GTK+.
378 GhcRtsWithFrontPanel = NO
379
380 ################################################################################
381 #
382 # libraries project
383 #
384 ################################################################################
385
386 # Build the Haskell Readline bindings?
387 #
388 GhcLibsWithReadline=@GhcLibsWithReadline@
389
390 # Libraries needed for linking with readline
391 LibsReadline=@LibsReadline@
392
393 # Include path to readline.h
394 # (no path == in standard include path)
395 #
396 ReadlineIncludePath=
397
398 # Math library
399 LIBM=@LIBM@
400
401 # Build the ObjectIO ?
402 #
403 GhcLibsWithObjectIO=@GhcLibsWithObjectIO@
404
405 # .NET interop support?
406 #
407 DotnetSupport=@DotnetSupport@
408
409 # Build unix package?
410 #
411 GhcLibsWithUnix=@GhcLibsWithUnix@
412
413 ################################################################################
414 #
415 #               happy project
416 #
417 #       Happy specific options
418 #
419 ################################################################################
420
421 # The compiler you'd like to use to compile Happy
422 WithHappyHc = @WithHc@
423
424 # HappyHcOpts gives the flags to pass to the Haskell compiler used
425 #             to compile the Happy sources with.
426 #
427 HappyHcOpts = -O
428
429 ################################################################################
430 #
431 #               haggis project
432 #
433 #       Haggis specific options
434 #
435 ################################################################################
436
437 ################################################################################
438 #
439 #               greencard project
440 #
441 #       GreenCard specific options
442 #
443 ################################################################################
444
445 ################################################################################
446 #
447 #               nofib project
448 #
449 #       nofib specific options
450 #
451 ################################################################################
452
453 WithNofibHc = $(GHC_INPLACE)
454
455 # NoFibSubDirs controls which set of tests should be run
456 # You can run one or more of
457 #       imaginary 
458 #       spectral
459 #       real
460 #       parallel
461 #       PRIVATE
462 #       PENDING
463 #       UNUSED
464 NoFibSubDirs = imaginary spectral real
465
466 # The different ways to build nofib. Default is just to mirror
467 # what is done for the ghc prelude libraries.
468 #
469 NoFibWays = $(GhcLibWays)
470
471 # Haskell compiler options for nofib
472 NoFibHcOpts = -O
473
474 # ==============================================================================
475 #
476 #                       END OF PROJECT-SPECIFIC STUFF
477 #
478 #               Now come the generic configuration options
479 #
480 # ==============================================================================
481
482 ################################################################################
483 #
484 #               Paths (see paths.mk)
485 #
486 ################################################################################
487
488 # Directory used by GHC (and possibly other tools) for storing
489 # temporary files.  If your TMPDIR isn't big enough, either override
490 # this in build.mk or set your environment variable "TMPDIR" to point
491 # to somewhere with more space.  (TMPDIR=. is a good choice).
492
493 # DEFAULT_TMPDIR isn't called TMPDIR because GNU make tends to
494 # override an environment variable with the value of the make variable
495 # of the same name (if it exists) when executing sub-processes, so
496 # setting the TMPDIR env var would have no effect in the build tree.
497
498 DEFAULT_TMPDIR          = /tmp
499 ifeq "$(TARGETPLATFORM)" "i386-unknown-cygwin32"
500 DEFAULT_TMPDIR          = C:/TEMP
501 endif
502 ifeq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
503 DEFAULT_TMPDIR          = C:/TEMP
504 endif
505
506 # FPTOOLS_TOP: the top of the fptools hierarchy, absolute path. (POSIX / unix-style path).
507 FPTOOLS_TOP_ABS         = @hardtop@
508 # The platform specific version of 'hardtop'.
509 FPTOOLS_TOP_ABS_PLATFORM = @hardtop_plat@
510
511 #
512 # Installation directories, we don't use half of these,
513 # but since the configure script has them on offer while
514 # passing through, we might as well set them.
515
516 prefix                  = @prefix@
517 exec_prefix             = @exec_prefix@
518 bindir                  = @bindir@
519 datadir0                = @datadir@
520 libdir0                 = @libdir@
521 includedir              = @includedir@
522 oldincludedir           = @oldincludedir@
523 mandir                  = @mandir@
524
525 ifeq "$(Windows)" "YES"
526
527 ifeq "$(strip $(prefix))" ""
528 prefix          = c:/ghc
529 endif
530
531 # Hack: our directory layouts tend to be different on Windows, so
532 # hack around configure's bogus assumptions here.
533 datadir         = $(prefix)
534 libdir          = $(prefix)
535
536 else
537
538 #
539 # Unix: override libdir and datadir to put project-specific stuff in
540 # a subdirectory with the version number included.
541 #
542 libdir     = $(if $(ProjectNameShort),$(libdir0)/$(ProjectNameShort)-$(ProjectVersion),$(libdir0))
543 datadir    = $(if $(ProjectNameShort),$(datadir0)/$(ProjectNameShort)-$(ProjectVersion),$(datadir0))
544
545 endif # Windows
546
547 # Default place for putting interface files is $(libdir)
548 # (overriden for packages in package.mk)
549 ifacedir                = $(libdir)
550
551
552 # Default values for most of the above are only set if
553 # they weren't configured to anything in particular
554 # via the configure script. (i.e., we make no assumption
555 # that the autoconf-generated script will assign defaults
556 # to all of the above).
557 #
558 ifeq "$(strip $(exec_prefix))" ""
559 exec_prefix             = $(prefix)
560 endif
561 ifeq "$(strip $(bindir))" ""
562 bindir                  = $(exec_prefix)/bin
563 endif
564
565 #
566 # NOTE: by intention, libexecdir and libdir point to 
567 # the same place.
568 #  => Only way to override this is to set libexecdir= on the command line.
569 #     (NOTE: configure script setting is ignored).
570 libexecdir              = $(libdir)
571
572 ifeq "$(strip $(datadir))" ""
573 datadir         = $(prefix)/share
574 endif
575 ifeq "$(strip $(libdir))" ""
576 libdir          = $(exec_prefix)/lib
577 endif
578 ifeq "$(strip $(includedir))" ""
579 includedir      = $(prefix)/include
580 endif
581 ifeq "$(strip $(oldincludedir))" ""
582 oldincludedir   = /usr/include
583 endif
584 ifeq "$(strip $(mandir))" ""
585 mandir          = $(prefix)/man
586 endif
587
588 #-----------------------------------------------------------------------------
589 # install configuration
590
591 #
592 # Set this to have files installed with a specific owner
593 #
594 INSTALL_OWNER =
595
596
597 # Set this to have files installed with a specific group
598 #
599 INSTALL_GROUP =
600
601 #
602 # Invocations of `install' for the four different classes
603 # of targets:
604 #
605 INSTALL_PROGRAM = $(INSTALL) -m 755
606 INSTALL_SCRIPT  = $(INSTALL) -m 755
607 INSTALL_SHLIB   = $(INSTALL) -m 755
608 INSTALL_DATA    = $(INSTALL) -m 644
609 INSTALL_DIR     = $(MKDIRHIER)
610
611 # -----------------------------------------------------------------------------
612 # Utilities programs: flags 
613
614 # If you want to give any standard flags to pretty much any utility
615 # (see utils.mk for a complete list), by adding a line here
616 #
617 #       SRC_P_OPTS += ...
618 #
619 # where P is the utility. For example, to add -O to all Haskell
620 # compilations, 
621 #
622 #       SRC_HC_OPTS += -O
623
624 SRC_HC_OPTS += -H16m -O
625
626 # These flags make flex 8-bit
627 SRC_FLEX_OPTS   += -8
628
629 SRC_INSTALL_BIN_OPTS    += -s
630
631 # lint gets all CPP's flags too
632 SRC_LINT_OPTS           += -axz -DLINT $(SRC_CPP_OPTS)
633 WAY$(_way)_LINT_OPTS    += WAY$(_way)_CPP_OPTS
634
635 # Default fptools options for dllwrap.
636 SRC_BLD_DLL_OPTS += -mno-cygwin --target=i386-mingw32
637
638 # Flags for CPP when running GreenCard on .pgc files
639 GC_CPP_OPTS += -P -E -x c -traditional -D__GLASGOW_HASKELL__
640
641
642 ################################################################################
643 #
644 #               Utilities programs: where to find them
645 #
646 ################################################################################
647
648 #-----------------------------------------------------------------------------
649 # FPtools Utility locations
650
651 # By default, the various utils needed to be build ghc and chums
652 # is set up to point to the utils/ directory. Define here the
653 # path prefix for the utilities. Notice that it's a prefix with
654 # a trailing slash, so that it can be concatenated directly on
655 # front of a program name; if it's not set then we just look
656 # along the shell's $(PATH)
657 #
658 # If instead you want to use installed or your own versions of these,
659 # override the various *_PREFIX in build.mk, i.e., having the following
660 # in build.mk:
661 #
662 #   MKDEPENDC_PREFIX=
663 #
664 # will force `make' to rummage around in your PATH to find `mkdependC' (not
665 # sure it would need it in the first place, but still).
666 #
667 GLAFP_UTILS             = $(FPTOOLS_TOP)/glafp-utils
668
669 SCRIPT_PREFIX           = $(GLAFP_UTILS)/scripts/
670 MKDEPENDC_PREFIX        = $(GLAFP_UTILS)/mkdependC/
671 LTX_PREFIX              = $(GLAFP_UTILS)/ltx/
672 RUNTEST_PREFIX          = $(GLAFP_UTILS)/runstdtest/
673 VERBATIM_PREFIX         = $(GLAFP_UTILS)/verbatim/
674 SGMLVERB_PREFIX         = $(GLAFP_UTILS)/sgmlverb/
675 ETAGS_PREFIX            = $(GLAFP_UTILS)/etags/
676 LNDIR_PREFIX            = $(GLAFP_UTILS)/lndir/
677 MKDIRHIER_PREFIX        = $(GLAFP_UTILS)/mkdirhier/
678 DOCBOOK_PREFIX          = $(GLAFP_UTILS)/docbook/
679
680 HADDOCK_PREFIX          = $(FPTOOLS_TOP)/haddock/
681
682 LITERATE_PREFIX         = $(FPTOOLS_TOP)/literate/
683
684 UNLIT_PREFIX            = $(FPTOOLS_TOP)/ghc/utils/unlit/
685 HP2PS_PREFIX            = $(FPTOOLS_TOP)/ghc/utils/hp2ps/
686 HSTAGS_PREFIX           = $(FPTOOLS_TOP)/ghc/utils/hasktags/
687 HSC2HS_PREFIX           = $(FPTOOLS_TOP)/ghc/utils/hsc2hs/
688
689 #-----------------------------------------------------------------------------
690 # Haskell compilers and mkdependHS
691
692 # $(GHC), $(HBC) and $(NHC) point to installed versions of the relevant
693 # compilers, if available.
694 #
695 # $(HC) is a generic Haskell 98 compiler, set to $(GHC) by default.
696 # $(MKDEPENDHS) is the Haskell dependency generator (ghc -M).
697 #
698 # NOTE: Don't override $(GHC) in build.mk, use configure --with-ghc instead
699 # (because the version numbers have to be calculated).
700
701 GHC             = @WithGhc@
702 GhcDir          = $(dir $(GHC))
703 GhcVersion      = @GhcVersion@
704 GhcMajVersion   = @GhcMajVersion@
705 GhcMinVersion   = @GhcMinVersion@
706 GhcPatchLevel   = @GhcPatchLevel@
707
708 # Canonicalised ghc version number, used for easy (integer) version
709 # comparisons.  We must expand $(GhcMinVersion) to two digits by
710 # adding a leading zero if necessary:
711 ifneq "$(findstring $(GhcMinVersion), 0 1 2 3 4 5 6 7 8 9)" ""
712 GhcCanonVersion = $(GhcMajVersion)0$(GhcMinVersion)
713 else
714 GhcCanonVersion = $(GhcMajVersion)$(GhcMinVersion)
715 endif
716
717 HBC             = @HBC@
718 NHC             = @NHC@
719
720 HC              = @WithHc@
721 MKDEPENDHS      = $(GHC)
722
723 # Sometimes we want to invoke ghc from the build tree in different
724 # projects (eg. it's handy to have a nofib & a ghc build in the same
725 # tree).  We can refer to "this ghc" as $(GHC_INPLACE):
726
727 GHC_INPLACE     = $(FPTOOLS_TOP)/ghc/compiler/ghc-inplace
728 GHC_STAGE1      = $(FPTOOLS_TOP)/ghc/compiler/stage1/ghc-inplace
729 GHC_STAGE2      = $(FPTOOLS_TOP)/ghc/compiler/stage2/ghc-inplace
730 GHC_STAGE3      = $(FPTOOLS_TOP)/ghc/compiler/stage3/ghc-inplace
731
732 #-----------------------------------------------------------------------------
733 # C compiler
734 #
735 # NB. Don't override $(WhatGccIsCalled) using build.mk,  re-configure using
736 # the flag --with-gcc=<blah> instead.  The reason is that the configure script
737 # needs to know which gcc you're using in order to perform its tests.
738
739 HaveGcc         = @HaveGcc@
740 UseGcc          = YES
741 WhatGccIsCalled = @WhatGccIsCalled@
742 GccVersion      = @GccVersion@
743 ifeq "$(strip $(HaveGcc))" "YES"
744 ifneq "$(strip $(UseGcc))"  "YES"
745   CC    = cc
746 else
747   CC    = $(WhatGccIsCalled)
748   GccDir = $(dir $(WhatGccIsCalled))
749 endif
750 endif
751
752 # default C compiler flags
753 SRC_CC_OPTS = @SRC_CC_OPTS@
754
755 ifeq "$(TARGETPLATFORM)" "ia64-unknown-linux"
756 SRC_CC_OPTS += -G0
757 endif
758
759 #-----------------------------------------------------------------------------
760 # GMP Library (version 2.0.x or above)
761 #
762 HaveLibGmp      = @HaveLibGmp@
763 LibGmp          = @LibGmp@
764
765 #-----------------------------------------------------------------------------
766 # GMP framework (Mac OS X)
767 #
768 HaveFrameworkGMP = @HaveFrameworkGMP@
769
770 #-----------------------------------------------------------------------------
771 # Mingwex Library
772 #
773 HaveLibMingwEx  = @HaveLibMingwEx@
774
775 #-----------------------------------------------------------------------------
776 # Flex (currently unused, could be moved to glafp-utils)
777
778 # FLEX                  = @LEX@
779 # Don't bother with -lfl, we define our own yywrap()s anyway.
780 # FLEX_LIB              = 
781 #WAS:FLEX_LIB           = @LEXLIB@
782
783 #-----------------------------------------------------------------------------
784 # Other standard (ha!) Unix utilities
785
786 AR                      = @ArCmd@
787 ArSupportsInput         = @ArSupportsInput@
788 # Yuckage: for ghc/utils/parallel -- todo: nuke this dependency!!
789 BASH                    = /usr/local/bin/bash
790
791 CONTEXT_DIFF            = @ContextDiffCmd@
792 CP                      = cp
793 CPP                     = @CPP@ @CPPFLAGS@
794 CTAGS                   = $(ETAGS)
795 #
796 # RAWCPP_FLAGS are the flags to give to cpp (viz, gcc -E) to persuade it to
797 # behave plausibly on Haskell sources.
798 #
799 RAWCPP_FLAGS            = -undef -traditional
800 FIND                    = @FindCmd@
801 SORT                    = @SortCmd@
802 INSTALL                 = @INSTALL@
803 #
804 # Sigh - the autoconf macro for INSTALL will subst a relative path to the fallback
805 # install-sh script (if chosen). This not terribly useful to us, so we convert
806 # it into an abs. path.
807
808 INSTALL                 := $(subst .././install-sh,$(FPTOOLS_TOP_ABS)/install-sh,$(INSTALL))
809 LATEX                   = latex
810 HEVEA                   = hevea
811 HACHA                   = hacha
812 LN_S                    = @LN_S@
813 MANMACROS               = -man
814 MSMACROS                = -ms
815 MV                      = mv
816 NROFF                   = nroff
817 PERL                    = @PerlCmd@
818 PYTHON                  = @PythonCmd@
819 PIC                     = pic
820 PREPROCESSCMD           = $(CC) -E
821 RANLIB                  = @RANLIB@
822 RM                      = rm -f
823 SED                     = @SedCmd@
824 SHELL                   = /bin/sh
825
826 LD                      = @LdCmd@
827
828 # Some ld's support the -x flag and some don't, so the configure
829 # script detects which we have and sets LdXFlag to "-x" or ""
830 # respectively.
831 LD_X                    = @LdXFlag@
832
833 # GNU ld supports input via a linker script, which is useful to avoid
834 # overflowing command-line length limits.
835 LdIsGNULd               = @LdIsGNULd@
836
837 #
838 # In emergency situations, REAL_SHELL is used to perform shell commands
839 # from within the ghc driver script, by scribbling the command line to
840 # a temp file and then having $(REAL_SHELL) execute it. 
841 #
842 # The reason for having to do this is that overly long command lines
843 # cause unnecessary trouble with some shells (e.g., /bin/sh on Solaris
844 # 2.5.1), which is why this backdoor is provided. The situation of overly
845 # long command lines is either encountered while doing `make boot' in ghc/compiler, 
846 # or when linking the compiler binary (`hsc'). 
847 #
848 # We do not use SHELL to execute long commands, as `make' will more than likely
849 # override whatever setting you have in your environment while executing. 
850
851 # By default, REAL_SHELL is set equal to SHELL, which is not really a smart move
852 # as it is SHELL that will show up the bogosity in the first place, but setting
853 # it to anything else isn't really portable.
854 #
855 #  ====> If long command lines cause you trouble, invoke `ghc' (via `make' or otherwise)
856 # with REAL_SHELL set to something else than /bin/sh, for instance, your favourite
857 # command shell.
858 #
859 REAL_SHELL=$(SHELL)
860 SIZE                    = size
861 STRIP                   = strip
862 TAR                     = @TarCmd@
863 ZIP                     = zip
864
865 #
866 # This is special to literate/, ToDo: add literate-specific
867 # configure setup to literate/.
868 #
869 TBL                     = tbl
870 TEX                     = tex
871 TGRIND                  = tgrind
872 TGRIND_HELPER           = /usr/local/lib/tgrind/tfontedpr # XXX
873 TIB                     = tib
874
875 TIME                    = @TimeCmd@
876 TROFF                   = troff
877 UNAME                   = uname
878
879 #-----------------------------------------------------------------------------
880 # DocBook XML stuff
881
882 XSLTPROC                = @XsltprocCmd@
883 XMLLINT                 = @XmllintCmd@
884 FOP                     = @FopCmd@
885 XMLTEX                  = @XmltexCmd@
886 PDFXMLTEX               = @PdfxmltexCmd@
887 DVIPS                   = @DvipsCmd@
888
889 DIR_DOCBOOK_XSL         = @DIR_DOCBOOK_XSL@
890
891 XSLTPROC_LABEL_OPTS     = --stringparam toc.section.depth 3 \
892                           --stringparam section.autolabel 1 \
893                           --stringparam section.label.includes.component.label 1
894
895 #-----------------------------------------------------------------------------
896 #               FPtools support software
897
898 # Stuff from fptools/glafp-utils
899 MKDEPENDC               = $(MKDEPENDC_PREFIX)mkdependC
900 LTX                     = $(LTX_PREFIX)ltx
901 MKDIRHIER               = $(MKDIRHIER_PREFIX)mkdirhier
902 LNDIR                   = $(LNDIR_PREFIX)lndir
903 ETAGS                   = $(ETAGS_PREFIX)etags
904 VERBATIM                = $(VERBATIM_PREFIX)verbatim
905 SGMLVERB                = $(SGMLVERB_PREFIX)sgmlverb
906 RUNTEST                 = $(RUNTEST_PREFIX)runstdtest
907
908 BLD_DLL                 = dllwrap
909
910 #
911 # .NET support software
912 #
913 ILX2IL                  = ilx2il
914 ILASM                   = ilasm
915
916 #
917 # ghc-pkg
918 #
919 GHC_PKG                 = @GhcPkgCmd@
920
921 #
922 # GreenCard
923 #
924 GREENCARD               = @GreenCardCmd@
925 GREENCARD_VERSION       = @GreenCardVersion@            
926
927 #
928 # Happy
929 #
930 HAPPY                   = @HappyCmd@
931 HAPPY_VERSION           = @HappyVersion@                
932 #
933 # Options to pass to Happy when we're going to compile the output with GHC
934 #
935 GHC_HAPPY_OPTS          = -agc
936
937 # Temp. to work around performance problems in the HEAD around 8/12/2003,
938 # A Happy compiled with this compiler needs more stack.
939 SRC_HAPPY_OPTS          = +RTS -K2m -RTS
940
941 #
942 # Alex
943 #
944 ALEX                    = @AlexCmd@
945 ALEX_VERSION            = @AlexVersion@         
946 #
947 # Options to pass to Happy when we're going to compile the output with GHC
948 #
949 GHC_ALEX_OPTS           = -g
950
951 #
952 # Haddock
953
954 HADDOCK                 = @HaddockCmd@
955 HADDOCK_INPLACE         = $(HADDOCK_PREFIX)/src/haddock-inplace
956
957 #
958 # Stuff from fptools/literate
959 #
960 LIT2PGM                 = $(LITERATE_PREFIX)lit2pgm
961 LIT2HTML                = $(LITERATE_PREFIX)lit2html
962 LIT2LATEX               = $(LITERATE_PREFIX)lit2latex
963 MKDEPENDLIT             = $(LITERATE_PREFIX)mkdependlit
964 LIT2CHANGELOG           = $(LITERATE_PREFIX)lit2changelog
965 LIT2TEXT                = $(LITERATE_PREFIX)lit2text
966
967 #
968 # Stuff from fptools/ghc/utils
969 #
970 UNLIT                   = $(UNLIT_PREFIX)unlit$(exeext)
971 HP2PS                   = $(HP2PS_PREFIX)hp2ps$(exeext)
972 HSTAGS                  = $(HSTAGS_PREFIX)hasktags
973 HSC2HS                  = $(HSC2HS_PREFIX)hsc2hs-inplace
974
975 #
976 # Options for the compiling different `ways'. Various projects within
977 # the glorious fptools tree support building in various user-configured
978 # ways. For instance, you could set up one `way' such that the prelude
979 # libraries all were built with the option -ffoldr-build-on.
980
981 # To configure up your own way, have a look at some of the standard ways
982 # such as profiling, and create your own set of WAY_*_OPTS defs below.
983 # After having done that, add your way string to WAYS, and after having
984 # run the configure script, the different projects will add the new way
985 # to the list of ways they support.
986 #
987
988 #
989 # IMPORTANT! The WAYS variable configures the different `ways'
990 # you want to build a project (or maybe just parts of it, as is
991 # the case for ghc/). This variable is intended set inside the
992 # project mk setup, enforcing a global fptools WAYS is a bit too
993 # much (do you *really* want to build glafp-utils the profiled-concurrent 
994 # way?)
995 #
996
997 #
998 # Definitions of the different ways:
999 #   
1000 #   * their name:
1001 #          - tag, e.g., p
1002 #          - description, e.g., profiling
1003 #   * what they mean to the driver:
1004 #          - WAY_p_HC_OPTS gives the list of command-line options
1005 #            to the driver.
1006 #
1007
1008 #
1009 # The ways currently defined.
1010 #
1011 ALL_WAYS=p t u s mp mg a b c d e f g h i j k l m n o A B
1012 USER_WAYS=a b c d e f g h j k l m n o A B
1013
1014 #
1015 # The following ways currently have treated specially, p u t mg,
1016 # as the driver script treats these guys specially and needs to carefully be told
1017 # about the options for these. Hence, we hide the required command line options
1018 # for these in the ghc/driver, as this is the only place they are needed.
1019
1020 # If you want to add to these default options, fill in the variables below:
1021
1022 # Way 'i':
1023 WAY_i_NAME=ILX
1024 WAY_i_HC_OPTS= -filx -fruntime-types
1025
1026 # Way 'p':
1027 WAY_p_NAME=profiling
1028 WAY_p_HC_OPTS= -prof
1029
1030 # Way 't':
1031 WAY_t_NAME=ticky-ticky profiling
1032 WAY_t_HC_OPTS= -ticky
1033
1034 # Way `u':
1035 WAY_u_NAME=unregisterized (using portable C only)
1036 WAY_u_HC_OPTS=-unreg
1037
1038 # Way `s':
1039 WAY_s_NAME=threads (for SMP)
1040 WAY_s_HC_OPTS=-smp
1041
1042 # Way `mp': 
1043 WAY_mp_NAME=parallel
1044 WAY_mp_HC_OPTS=-parallel
1045
1046 # Way `mg': 
1047 WAY_mg_NAME=GranSim
1048 WAY_mg_HC_OPTS=-gransim
1049
1050 #
1051 # These ways apply to the RTS only:
1052 #
1053
1054 # Way 'thr':
1055 WAY_thr_NAME=threaded
1056 WAY_thr_HC_OPTS=-optc-DTHREADED_RTS
1057
1058 # Way 'thr_p':
1059 WAY_thr_p_NAME=threaded profiled
1060 WAY_thr_p_HC_OPTS=-optc-DTHREADED_RTS -prof
1061
1062 # Way 'debug':
1063 WAY_debug_NAME=debug
1064 WAY_debug_HC_OPTS=-optc-DDEBUG
1065
1066 # Way 'debug_p':
1067 WAY_debug_p_NAME=debug profiled
1068 WAY_debug_p_HC_OPTS=-optc-DDEBUG -prof
1069
1070 # Way 'debug_u':
1071 WAY_debug_u_NAME=debug unregisterised
1072 WAY_debug_u_HC_OPTS=-optc-DDEBUG -unreg
1073
1074 # Way 'thr_debug':
1075 WAY_thr_debug_NAME=threaded
1076 WAY_thr_debug_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG
1077
1078 # Way 'thr_debug_p':
1079 WAY_thr_debug_p_NAME=threaded
1080 WAY_thr_debug_p_HC_OPTS=-optc-DTHREADED_RTS -optc-DDEBUG -prof
1081
1082 #
1083 # Add user-way configurations here:
1084 #
1085 WAY_A_NAME=
1086 WAY_A_HC_OPTS=
1087
1088 WAY_B_NAME=
1089 WAY_B_HC_OPTS=
1090
1091 WAY_a_NAME=
1092 WAY_a_HC_OPTS=
1093
1094 WAY_b_NAME=
1095 WAY_b_HC_OPTS=
1096
1097 WAY_c_NAME=
1098 WAY_c_HC_OPTS=
1099
1100 WAY_d_NAME=
1101 WAY_d_HC_OPTS=
1102
1103 WAY_e_NAME=
1104 WAY_e_HC_OPTS=
1105
1106 WAY_f_NAME=
1107 WAY_f_HC_OPTS=
1108
1109 WAY_g_NAME=
1110 WAY_g_HC_OPTS=
1111
1112 WAY_h_NAME=
1113 WAY_h_HC_OPTS=
1114
1115 WAY_j_NAME=
1116 WAY_j_HC_OPTS=
1117
1118 WAY_k_NAME=
1119 WAY_k_HC_OPTS=
1120
1121 WAY_l_NAME=
1122 WAY_l_HC_OPTS=
1123
1124 WAY_m_NAME=
1125 WAY_m_HC_OPTS=
1126
1127 WAY_n_NAME=
1128 WAY_n_HC_OPTS=
1129
1130 WAY_o_NAME=
1131 WAY_o_HC_OPTS=
1132
1133 ################################################################################
1134 #
1135 #               31-bit-Int Core files
1136 #
1137 ################################################################################
1138
1139
1140 # It is possible to configure the compiler and prelude to support 31-bit
1141 # integers, suitable for a back-end and RTS using a tag bit on a 32-bit
1142 # architecture.  Currently the only useful output from this option is external Core
1143 # files.  The following additions to your build.mk will produce the
1144 # 31-bit core output.  Note that this is *not* just a library "way"; the
1145 # compiler must be built a special way too.
1146
1147 # GhcCppOpts +=-DWORD_SIZE_IN_BITS=31
1148 # GhcLibHcOpts +=-fext-core -fno-code -DWORD_SIZE_IN_BITS=31
1149 # GhcLibCppOpts += -DWORD_SIZE_IN_BITS=31
1150 # SplitObjs=NO
1151