2 %************************************************************************
4 \section[mkworld-only4-ghc]{Extra things ``only for'' for the @ghc@ project}
6 %************************************************************************
10 /* Project identification - name and version */
13 #define ProjectName The Glorious Glasgow Haskell Compilation System
15 /* ProjectVersion is something printable */
16 #ifndef ProjectVersion
17 #define ProjectVersion 2.01
19 /* A patchlevel change is something *very minor* */
20 #ifndef ProjectPatchLevel
21 #define ProjectPatchLevel patchlevel 0
23 /* GhcBuildeeVersion is something CPP-testable (ProjectVersion * 100) */
24 #ifndef GhcBuildeeVersion
25 #define GhcBuildeeVersion 201
30 Make variables that say where the source to main pieces of the system live:
33 /* state of the source world */
34 GHC_DRIVERSRC = $(TOP)/ghc/driver
35 GHC_COMPILERSRC = $(TOP)/ghc/compiler
36 GHC_RUNTIMESRC = $(TOP)/ghc/runtime
37 GHC_LIBSRC = $(TOP)/ghc/lib
38 GHC_INCLUDESRC = $(TOP)/ghc/includes
39 GHC_UTILSRC = $(TOP)/ghc/utils
40 GHC_BOOKSRC = $(TOP)/ghc/book
44 Include definitions (usually to go with generated C):
47 #ifndef GhcIncludesDir
48 #define GhcIncludesDir $(GHC_INCLUDESRC)
50 GHC_INCLUDES = GhcIncludesDir
54 A make variable that's occasionally very important: we use \tr{GHC_*}
55 when we really mean GHC, rather than \tr{HC*}, which just means ``the
56 standard Haskell compiler'' (whatever that is).
59 #ifndef AllProjectsGhcOpts
60 #define AllProjectsGhcOpts /*none*/
63 #ifndef PlatformGhcOpts
64 #define PlatformGhcOpts /*none*/
67 #if HaskellCompilerType == HC_CHALMERS_HBC
70 # if HaskellCompilerType == HC_ROJEMO_NHC
71 GHC_RTS_STYLE = 'ghc' /* wrong, but more likely to trigger something */
77 #ifndef ProjectGhcOpts
78 #define ProjectGhcOpts -hi-diffs -dcore-lint -link-chk
79 #endif /* ! ProjectGhcOpts */
82 #define SetupGhcOpts /*none*/
85 GenerateOptionsMakeVars(GHC,OPTS,AllProjectsGhcOpts,PlatformGhcOpts,ProjectGhcOpts,SetupGhcOpts)
87 GHCFLAGS=$(GLUED_CPP_DEFINES) $(GLUED_GHC_OPTS)
91 %************************************************************************
93 \subsection{What to build}
95 %************************************************************************
97 %************************************************************************
99 \subsubsection{Include or leave out these individual ``features''}
101 %************************************************************************
105 /* build York interpreter as well as Glasgow compiler
107 #ifndef BuildYorkInterpreter
108 #define BuildYorkInterpreter NO
111 /* incorporate Semantique strictness analyser into the compiler;
112 it analyses, but the info generated is *UNUSED* :-(
114 #ifndef UseSemantiqueStrictnessAnalyser
115 #define UseSemantiqueStrictnessAnalyser NO
120 %************************************************************************
122 \subsection{Installation: whether to, where to, what to}
124 %************************************************************************
128 /* defaults for which pieces should be installed */
129 /* ToDo: possibly obsolete */
130 #ifndef DoInstallGHCSystem
131 #define DoInstallGHCSystem YES
132 #endif /* DoInstallGHCSystem */
134 /* ------------------------------------------------------------------ */
135 /* compiler-proper subsystem:
136 the lib/data bits are installed w/ a version number as well
139 #ifndef InstBinDir_GHC
141 # define InstBinDir_GHC $(exec_prefix_GHC)/bin/`/usr/local/gnu/bin/hw_os`
143 # define InstBinDir_GHC $(exec_prefix_GHC)/bin
147 /* scripts are platform-independent */
148 #ifndef InstScriptDir_GHC
149 #define InstScriptDir_GHC $(exec_prefix_GHC)/bin
152 /* main "internally-used-by-GHC" stuff */
153 #ifndef InstLibDir_GHC
154 #define InstLibDir_GHC $(prefix_GHC)/lib/ghc/$(PROJECTVERSION)/$(HOSTPLATFORM)
157 /* "data" is defined (by WDP) to be platform-independent library stuff */
158 #ifndef InstDataDir_GHC
159 #define InstDataDir_GHC $(prefix_GHC)/lib/ghc/$(PROJECTVERSION)
162 prefix_GHC = InstRootDir_GHC /* set by configure */
163 exec_prefix_GHC = InstBinRootDir_GHC /* ditto */
164 INSTBINDIR_GHC = InstBinDir_GHC
165 INSTSCRIPTDIR_GHC = InstScriptDir_GHC
166 INSTLIBDIR_GHC = InstLibDir_GHC
167 INSTDATADIR_GHC = InstDataDir_GHC
171 %************************************************************************
173 \subsection{Configuring the driver}
175 %************************************************************************
177 The driver script is the thing that glues the compilation system
178 together. It needs to know what is/isn't included in the system,
179 e.g., what garbage-collectors are catered for.
181 Mkworld records the needed information in make variables (e.g.,
182 \tr{$(GHC_HSCPP)}), and we then `msub' that into the driver (perl)
183 script. Note: ALL configuration info should be HERE (not hacked into
186 The first chunk of stuff here is mkworld boilerplate and probably
187 doesn't need fiddling. Once we get into what C compiler(s) to use for
188 compiling .hc files, what libraries are available, etc., there may be
189 something to tweak (but not here -- in a `setup' file, please!) There
190 are further comments where the tweakables begin...
192 First, the driver can be installed under any old name; here's the default:
195 #ifndef GhcDriverInstallName
196 #define GhcDriverInstallName ghc
197 #endif /* ! GhcDriverInstallName */
198 GHC_DRIVER_INST_NAME = GhcDriverInstallName
202 %************************************************************************
204 \subsubsection{Where to find the programs for the various phases}
206 %************************************************************************
208 First, the driver itself:
211 /* ghc: std driver for compilation system */
213 #define GhcDriverCmd $(GHC_DRIVERSRC)/ghc
216 /* macro to make sure it has been built */
217 #ifndef GhcDriverNeededHere
218 #define GhcDriverNeededHere(target) \
219 __SomeUtilNeededHere(target,$(GHC),$(GHC_DRIVERSRC),all)
222 /* could be GHC_DRIVER, but GHC is its common name */
227 \tr{unlit}, to de-literatise a source file, is from the HBC
228 distribution. See utils-ghc.
230 \tr{hscpp}: runs C pre-processor but converts \tr{#line}s to Haskell pragmas;
231 is platform-independent.
235 #define HsCppCmd $(GHC_HSCPPSRC)/hscpp
238 #ifndef HsCppNeededHere
239 #define HsCppNeededHere(target) \
240 __SomeUtilNeededHere(target,$(GHC_HSCPP),$(GHC_HSCPPSRC),hscpp)
243 GHC_HSCPP = HsCppCmd $(ALLPROJ_CPP_DEFINES)
244 GHC_HSCPPSRC = $(GHC_UTILSRC)/hscpp
248 \tr{hsp}: std Haskell parser.
252 #define HsParserCmd $(GHC_HSPSRC)/hsp
255 #ifndef HsParserNeededHere
256 #define HsParserNeededHere(target) \
257 __SomeUtilNeededHere(target,$(GHC_HSP),$(GHC_HSPSRC),hsp)
258 #endif /* HsParserNeededHere */
260 GHC_HSP = HsParserCmd
261 GHC_HSPSRC = $(GHC_HSCSRC)
265 \tr{hsc}: std Haskell compiler.
268 #ifndef HsCompilerCmd
269 #define HsCompilerCmd $(GHC_HSCSRC)/hsc
272 #ifndef HsCompilerNeededHere
273 #define HsCompilerNeededHere(target) \
274 __SomeUtilNeededHere(target,$(GHC_HSC),$(GHC_HSCSRC),hsc)
275 #endif /* HsCompilerNeededHere */
277 GHC_HSC = HsCompilerCmd
278 GHC_HSCSRC = $(GHC_COMPILERSRC)
282 \tr{SysMan}: PVM-controlling program for parallel Haskell.
286 #define SysManCmd $(GHC_RUNTIMESRC)/gum/SysMan
289 #ifndef SysManNeededHere
290 #define SysManNeededHere(target) \
291 __SomeUtilNeededHere(target,$(GHC_SYSMAN),$(GHC_SYSMANSRC),gum/SysMan)
292 #endif /* SysManNeededHere */
294 GHC_SYSMAN = SysManCmd
295 GHC_SYSMANSRC = $(GHC_RUNTIMESRC)
299 For an ``assembler'' and a ``linker,'' the driver uses the same
300 program as it used for C compilation; this means libraries and things
301 are likely to be picked up correctly.
303 %************************************************************************
305 \subsubsection{Stuff for the C-compiling phase in particular...}
307 %************************************************************************
309 {\em High-level assembler}: C compiler with which to compile \tr{.hc} files.
311 There are {\em three} things to set:
317 compiler to use for ``debugging'' compilation (@GHC_DEBUG_HILEV_ASM@)
319 compiler to use for ``optimising'' compiling (w/ regs magic, etc)
320 (@GHC_OPT_HILEV_ASM@)
321 This must be GCC; otherwise opt compiling must be turned off.
325 Whether or not you can do the ``optimising''-style compilation (set
326 @GHC_GCC_IS_AVAILABLE@).
329 For options that should always be applied {\em for this project},
330 set the @ProjectGhcOpts@ variable...
332 Similarly, for a particular {\em setup}, use @SetupGhcOpts@...
334 %************************************************************************
336 \subsubsubsection{Which C compiler to use (GCC is best)}
338 %************************************************************************
342 /* NON-OPTIMISING C COMPILATION: ==================================
344 We can use GCC 2.n for the non-optimising (normal) .hc C
345 compilation [use it if we have it]
347 #ifndef GhcUseGccForDebuggingAsm
349 #define GhcUseGccForDebuggingAsm YES
351 #define GhcUseGccForDebuggingAsm NO
355 #ifndef GhcDebuggingHighLevelAsmCmd
356 #if GhcUseGccForDebuggingAsm == YES
357 #define GhcDebuggingHighLevelAsmCmd WhatGccIsCalled
359 #define GhcDebuggingHighLevelAsmCmd $(CC)
361 #endif /* GhcDebuggingHighLevelAsmCmd */
362 GHC_DEBUG_HILEV_ASM = GhcDebuggingHighLevelAsmCmd
364 /* OPTIMISING C COMPILATION (regs, etc): ==========================
366 Must use GCC 2.n for this
367 compilation [OFF by default]
369 /* We have GCC, which is necessary for optimising the Haskell
372 #ifndef GhcUseGccForOptAsm
374 #define GhcUseGccForOptAsm YES
376 #define GhcUseGccForOptAsm NO
380 #ifndef GhcOptHighLevelAsmCmd
381 #if GhcUseGccForOptAsm == YES
382 #define GhcOptHighLevelAsmCmd WhatGccIsCalled
383 GHC_GCC_IS_AVAILABLE = 1
385 GHC_GCC_IS_AVAILABLE = 0
387 #endif /* GhcOptHighLevelAsmCmd */
388 GHC_OPT_HILEV_ASM = GhcOptHighLevelAsmCmd