1 %************************************************************************
3 \section[mkworld-only4-ghc]{Extra things ``only for'' for the @ghc@ project}
5 %************************************************************************
8 /* Project identification - name and version */
11 #define ProjectName The Glorious Glasgow Haskell Compilation System
13 /* ProjectVersion is something printable */
14 #ifndef ProjectVersion
15 #define ProjectVersion 0.26
17 /* A patchlevel change is something *very minor* */
18 #ifndef ProjectPatchLevel
19 #define ProjectPatchLevel patchlevel 0
21 /* GhcBuildeeVersion is something CPP-testable (ProjectVersion * 100) */
22 #ifndef GhcBuildeeVersion
23 #define GhcBuildeeVersion 26
27 Make variables that say where the source to main pieces of the system live:
29 /* state of the source world */
30 GHC_DRIVERSRC = $(TOP)/ghc/driver
31 GHC_COMPILERSRC = $(TOP)/ghc/compiler
32 GHC_RUNTIMESRC = $(TOP)/ghc/runtime
33 GHC_LIBSRC = $(TOP)/ghc/lib
34 GHC_INCLUDESRC = $(TOP)/ghc/includes
35 GHC_UTILSRC = $(TOP)/ghc/utils
36 GHC_BOOKSRC = $(TOP)/ghc/book
39 Include definitions (usually to go with generated C):
41 #ifndef GhcIncludesDir
42 #define GhcIncludesDir $(GHC_INCLUDESRC)
44 GHC_INCLUDES = GhcIncludesDir
47 A make variable that's occasionally very important: we use \tr{GHC_*}
48 when we really mean GHC, rather than \tr{HC*}, which just means ``the
49 standard Haskell compiler'' (whatever that is).
51 #ifndef AllProjectsGhcOpts
52 #define AllProjectsGhcOpts /*none*/
55 #ifndef PlatformGhcOpts
56 #define PlatformGhcOpts /*none*/
59 #if HaskellCompilerType == HC_CHALMERS_HBC
62 # if HaskellCompilerType == HC_ROJEMO_NHC
63 GHC_RTS_STYLE = 'ghc' /* wrong, but more likely to trigger something */
69 #ifndef ProjectGhcOpts
70 #define ProjectGhcOpts -hi-diffs -dcore-lint -link-chk
71 #endif /* ! ProjectGhcOpts */
74 #define SetupGhcOpts /*none*/
77 GenerateOptionsMakeVars(GHC,OPTS,AllProjectsGhcOpts,PlatformGhcOpts,ProjectGhcOpts,SetupGhcOpts)
79 GHCFLAGS=$(GLUED_CPP_DEFINES) $(GLUED_GHC_OPTS)
82 %************************************************************************
84 \subsection{What to build}
86 %************************************************************************
88 %************************************************************************
90 \subsubsection{Include or leave out these individual ``features''}
92 %************************************************************************
95 /* build York interpreter as well as Glasgow compiler
97 #ifndef BuildYorkInterpreter
98 #define BuildYorkInterpreter NO
101 /* incorporate Semantique strictness analyser into the compiler;
102 it analyses, but the info generated is *UNUSED* :-(
104 #ifndef UseSemantiqueStrictnessAnalyser
105 #define UseSemantiqueStrictnessAnalyser NO
109 %************************************************************************
111 \subsection{Installation: whether to, where to, what to}
113 %************************************************************************
116 /* defaults for which pieces should be installed */
117 /* ToDo: possibly obsolete */
118 #ifndef DoInstallGHCSystem
119 #define DoInstallGHCSystem YES
120 #endif /* DoInstallGHCSystem */
124 /* ------------------------------------------------------------------ */
125 /* compiler-proper subsystem:
126 the lib/data bits are installed w/ a version number as well
129 #ifndef InstBinDir_GHC
131 # define InstBinDir_GHC $(exec_prefix_GHC)/bin/`/usr/local/gnu/bin/hw_os`
133 # define InstBinDir_GHC $(exec_prefix_GHC)/bin
137 /* scripts are platform-independent */
138 #ifndef InstScriptDir_GHC
139 #define InstScriptDir_GHC $(exec_prefix_GHC)/bin
142 /* main "internally-used-by-GHC" stuff */
143 #ifndef InstLibDir_GHC
144 #define InstLibDir_GHC $(prefix_GHC)/lib/ghc/$(PROJECTVERSION)/$(HOSTPLATFORM)
147 /* "data" is defined (by WDP) to be platform-independent library stuff */
148 #ifndef InstDataDir_GHC
149 #define InstDataDir_GHC $(prefix_GHC)/lib/ghc/$(PROJECTVERSION)
152 prefix_GHC = InstRootDir_GHC /* set by configure */
153 exec_prefix_GHC = InstBinRootDir_GHC /* ditto */
154 INSTBINDIR_GHC = InstBinDir_GHC
155 INSTSCRIPTDIR_GHC = InstScriptDir_GHC
156 INSTLIBDIR_GHC = InstLibDir_GHC
157 INSTDATADIR_GHC = InstDataDir_GHC
160 %************************************************************************
162 \subsection{Configuring the driver}
164 %************************************************************************
166 The driver script is the thing that glues the compilation system
167 together. It needs to know what is/isn't included in the system,
168 e.g., what garbage-collectors are catered for.
170 Mkworld records the needed information in make variables (e.g.,
171 \tr{$(GHC_HSCPP)}), and we then `msub' that into the driver (perl)
172 script. Note: ALL configuration info should be HERE (not hacked into
175 The first chunk of stuff here is mkworld boilerplate and probably
176 doesn't need fiddling. Once we get into what C compiler(s) to use for
177 compiling .hc files, what libraries are available, etc., there may be
178 something to tweak (but not here -- in a `setup' file, please!) There
179 are further comments where the tweakables begin...
181 First, the driver can be installed under any old name; here's the default:
183 #ifndef GhcDriverInstallName
184 #define GhcDriverInstallName ghc
185 #endif /* ! GhcDriverInstallName */
186 GHC_DRIVER_INST_NAME = GhcDriverInstallName
189 %************************************************************************
191 \subsubsection{Where to find the programs for the various phases}
193 %************************************************************************
195 First, the driver itself:
197 /* ghc: std driver for compilation system */
199 #define GhcDriverCmd $(GHC_DRIVERSRC)/ghc
202 /* macro to make sure it has been built */
203 #ifndef GhcDriverNeededHere
204 #define GhcDriverNeededHere(target) \
205 __SomeUtilNeededHere(target,$(GHC),$(GHC_DRIVERSRC),all)
208 /* could be GHC_DRIVER, but GHC is its common name */
212 \tr{unlit}, to de-literatise a source file, is from the HBC
213 distribution. See utils-ghc.
215 \tr{hscpp}: runs C pre-processor but converts \tr{#line}s to Haskell pragmas;
216 is platform-independent.
219 #define HsCppCmd $(GHC_HSCPPSRC)/hscpp
222 #ifndef HsCppNeededHere
223 #define HsCppNeededHere(target) \
224 __SomeUtilNeededHere(target,$(GHC_HSCPP),$(GHC_HSCPPSRC),hscpp)
227 GHC_HSCPP = HsCppCmd $(ALLPROJ_CPP_DEFINES)
228 GHC_HSCPPSRC = $(GHC_UTILSRC)/hscpp
231 \tr{hsp}: std Haskell parser.
234 #define HsParserCmd $(GHC_HSPSRC)/hsp
237 #ifndef HsParserNeededHere
238 #define HsParserNeededHere(target) \
239 __SomeUtilNeededHere(target,$(GHC_HSP),$(GHC_HSPSRC),hsp)
240 #endif /* HsParserNeededHere */
242 GHC_HSP = HsParserCmd
243 GHC_HSPSRC = $(GHC_HSCSRC)
246 \tr{hsc}: std Haskell compiler.
248 #ifndef HsCompilerCmd
249 #define HsCompilerCmd $(GHC_HSCSRC)/hsc
252 #ifndef HsCompilerNeededHere
253 #define HsCompilerNeededHere(target) \
254 __SomeUtilNeededHere(target,$(GHC_HSC),$(GHC_HSCSRC),hsc)
255 #endif /* HsCompilerNeededHere */
257 GHC_HSC = HsCompilerCmd
258 GHC_HSCSRC = $(GHC_COMPILERSRC)
261 \tr{SysMan}: PVM-controlling program for parallel Haskell.
264 #define SysManCmd $(GHC_RUNTIMESRC)/gum/SysMan
267 #ifndef SysManNeededHere
268 #define SysManNeededHere(target) \
269 __SomeUtilNeededHere(target,$(GHC_SYSMAN),$(GHC_SYSMANSRC),gum/SysMan)
270 #endif /* SysManNeededHere */
272 GHC_SYSMAN = SysManCmd
273 GHC_SYSMANSRC = $(GHC_RUNTIMESRC)
276 For an ``assembler'' and a ``linker,'' the driver uses the same
277 program as it used for C compilation; this means libraries and things
278 are likely to be picked up correctly.
280 %************************************************************************
282 \subsubsection{Stuff for the C-compiling phase in particular...}
284 %************************************************************************
286 {\em High-level assembler}: C compiler with which to compile \tr{.hc} files.
288 There are {\em three} things to set:
294 compiler to use for ``debugging'' compilation (@GHC_DEBUG_HILEV_ASM@)
296 compiler to use for ``optimising'' compiling (w/ regs magic, etc)
297 (@GHC_OPT_HILEV_ASM@)
298 This must be GCC; otherwise opt compiling must be turned off.
302 Whether or not you can do the ``optimising''-style compilation (set
303 @GHC_GCC_IS_AVAILABLE@).
306 For options that should always be applied {\em for this project},
307 set the @ProjectGhcOpts@ variable...
309 Similarly, for a particular {\em setup}, use @SetupGhcOpts@...
311 %************************************************************************
313 \subsubsubsection{Which C compiler to use (GCC is best)}
315 %************************************************************************
318 /* NON-OPTIMISING C COMPILATION: ==================================
320 We can use GCC 2.n for the non-optimising (normal) .hc C
321 compilation [use it if we have it]
323 #ifndef GhcUseGccForDebuggingAsm
325 #define GhcUseGccForDebuggingAsm YES
327 #define GhcUseGccForDebuggingAsm NO
331 #ifndef GhcDebuggingHighLevelAsmCmd
332 #if GhcUseGccForDebuggingAsm == YES
333 #define GhcDebuggingHighLevelAsmCmd WhatGccIsCalled
335 #define GhcDebuggingHighLevelAsmCmd $(CC)
337 #endif /* GhcDebuggingHighLevelAsmCmd */
338 GHC_DEBUG_HILEV_ASM = GhcDebuggingHighLevelAsmCmd
342 /* OPTIMISING C COMPILATION (regs, etc): ==========================
344 Must use GCC 2.n for this
345 compilation [OFF by default]
347 /* We have GCC, which is necessary for optimising the Haskell
350 #ifndef GhcUseGccForOptAsm
352 #define GhcUseGccForOptAsm YES
354 #define GhcUseGccForOptAsm NO
358 #ifndef GhcOptHighLevelAsmCmd
359 #if GhcUseGccForOptAsm == YES
360 #define GhcOptHighLevelAsmCmd WhatGccIsCalled
361 GHC_GCC_IS_AVAILABLE = 1
363 GHC_GCC_IS_AVAILABLE = 0
365 #endif /* GhcOptHighLevelAsmCmd */
366 GHC_OPT_HILEV_ASM = GhcOptHighLevelAsmCmd