[project @ 1996-01-08 20:28:12 by partain]
[ghc-hetmet.git] / ghc / mkworld / only4-ghc.ljm
1 %************************************************************************
2 %*                                                                      *
3 \section[mkworld-only4-ghc]{Extra things ``only for'' for the @ghc@ project}
4 %*                                                                      *
5 %************************************************************************
6
7 \begin{code}
8 /* Project identification - name and version */
9
10 #ifndef ProjectName
11 #define ProjectName     The Glorious Glasgow Haskell Compilation System
12 #endif
13 /* ProjectVersion is something printable */
14 #ifndef ProjectVersion
15 #define ProjectVersion  0.26
16 #endif
17 /* A patchlevel change is something *very minor* */
18 #ifndef ProjectPatchLevel
19 #define ProjectPatchLevel patchlevel 0
20 #endif
21 /* GhcBuildeeVersion is something CPP-testable (ProjectVersion * 100) */
22 #ifndef GhcBuildeeVersion
23 #define GhcBuildeeVersion  26
24 #endif
25 \end{code}
26
27 Make variables that say where the source to main pieces of the system live:
28 \begin{code}
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
37 \end{code}
38
39 Include definitions (usually to go with generated C):
40 \begin{code}
41 #ifndef GhcIncludesDir
42 #define GhcIncludesDir $(GHC_INCLUDESRC)
43 #endif
44 GHC_INCLUDES = GhcIncludesDir
45 \end{code}
46
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).
50 \begin{code}
51 #ifndef AllProjectsGhcOpts
52 #define AllProjectsGhcOpts /*none*/
53 #endif
54
55 #ifndef PlatformGhcOpts
56 #define PlatformGhcOpts /*none*/
57 #endif
58
59 #if HaskellCompilerType == HC_CHALMERS_HBC
60 GHC_RTS_STYLE = 'hbc'
61 #else
62 # if HaskellCompilerType == HC_ROJEMO_NHC
63 GHC_RTS_STYLE = 'ghc' /* wrong, but more likely to trigger something */
64 # else
65 GHC_RTS_STYLE = 'ghc'
66 # endif
67 #endif
68
69 #ifndef ProjectGhcOpts
70 #define ProjectGhcOpts -hi-diffs -dcore-lint -link-chk
71 #endif /* ! ProjectGhcOpts */
72
73 #ifndef SetupGhcOpts
74 #define SetupGhcOpts /*none*/
75 #endif
76
77 GenerateOptionsMakeVars(GHC,OPTS,AllProjectsGhcOpts,PlatformGhcOpts,ProjectGhcOpts,SetupGhcOpts)
78
79 GHCFLAGS=$(GLUED_CPP_DEFINES) $(GLUED_GHC_OPTS)
80 \end{code}
81
82 %************************************************************************
83 %*                                                                      *
84 \subsection{What to build}
85 %*                                                                      *
86 %************************************************************************
87
88 %************************************************************************
89 %*                                                                      *
90 \subsubsection{Include or leave out these individual ``features''}
91 %*                                                                      *
92 %************************************************************************
93
94 \begin{code}
95 /* build York interpreter as well as Glasgow compiler
96 */
97 #ifndef BuildYorkInterpreter
98 #define BuildYorkInterpreter NO
99 #endif
100
101 /* incorporate Semantique strictness analyser into the compiler;
102    it analyses, but the info generated is *UNUSED* :-(
103  */
104 #ifndef UseSemantiqueStrictnessAnalyser
105 #define UseSemantiqueStrictnessAnalyser NO
106 #endif
107 \end{code}
108
109 %************************************************************************
110 %*                                                                      *
111 \subsection{Installation: whether to, where to, what to}
112 %*                                                                      *
113 %************************************************************************
114
115 \begin{code}
116 /* defaults for which pieces should be installed */
117 /* ToDo: possibly obsolete */
118 #ifndef DoInstallGHCSystem
119 #define DoInstallGHCSystem      YES
120 #endif /* DoInstallGHCSystem */
121 \end{code}
122
123 \begin{code}
124 /* ------------------------------------------------------------------ */
125 /* compiler-proper subsystem:
126     the lib/data bits are installed w/ a version number as well
127 */
128
129 #ifndef InstBinDir_GHC
130 # if AT_GLASGOW
131 #  define InstBinDir_GHC $(exec_prefix_GHC)/bin/`/usr/local/gnu/bin/hw_os`
132 # else
133 #  define InstBinDir_GHC $(exec_prefix_GHC)/bin
134 # endif
135 #endif
136
137 /* scripts are platform-independent */
138 #ifndef InstScriptDir_GHC
139 #define InstScriptDir_GHC $(exec_prefix_GHC)/bin
140 #endif
141
142 /* main "internally-used-by-GHC" stuff */
143 #ifndef InstLibDir_GHC
144 #define InstLibDir_GHC $(prefix_GHC)/lib/ghc/$(PROJECTVERSION)/$(HOSTPLATFORM)
145 #endif
146
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)
150 #endif
151
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
158 \end{code}
159
160 %************************************************************************
161 %*                                                                      *
162 \subsection{Configuring the driver}
163 %*                                                                      *
164 %************************************************************************
165
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.
169
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
173 the script)!
174
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...
180
181 First, the driver can be installed under any old name; here's the default:
182 \begin{code}
183 #ifndef GhcDriverInstallName
184 #define GhcDriverInstallName ghc
185 #endif /* ! GhcDriverInstallName */
186 GHC_DRIVER_INST_NAME = GhcDriverInstallName
187 \end{code}
188
189 %************************************************************************
190 %*                                                                      *
191 \subsubsection{Where to find the programs for the various phases}
192 %*                                                                      *
193 %************************************************************************
194
195 First, the driver itself:
196 \begin{code}
197 /* ghc: std driver for compilation system */
198 #ifndef GhcDriverCmd
199 #define GhcDriverCmd $(GHC_DRIVERSRC)/ghc
200 #endif
201
202 /* macro to make sure it has been built */
203 #ifndef GhcDriverNeededHere
204 #define GhcDriverNeededHere(target) \
205 __SomeUtilNeededHere(target,$(GHC),$(GHC_DRIVERSRC),all)
206 #endif
207
208 /* could be GHC_DRIVER, but GHC is its common name */
209 GHC = GhcDriverCmd
210 \end{code}
211
212 \tr{unlit}, to de-literatise a source file, is from the HBC
213 distribution.  See utils-ghc.
214
215 \tr{hscpp}: runs C pre-processor but converts \tr{#line}s to Haskell pragmas;
216 is platform-independent.
217 \begin{code}
218 #ifndef HsCppCmd
219 #define HsCppCmd $(GHC_HSCPPSRC)/hscpp
220 #endif
221
222 #ifndef HsCppNeededHere
223 #define HsCppNeededHere(target) \
224 __SomeUtilNeededHere(target,$(GHC_HSCPP),$(GHC_HSCPPSRC),hscpp)
225 #endif
226
227 GHC_HSCPP    = HsCppCmd $(ALLPROJ_CPP_DEFINES)
228 GHC_HSCPPSRC = $(GHC_UTILSRC)/hscpp
229 \end{code}
230
231 \tr{hsp}: std Haskell parser.
232 \begin{code}
233 #ifndef HsParserCmd
234 #define HsParserCmd $(GHC_HSPSRC)/hsp
235 #endif
236
237 #ifndef HsParserNeededHere
238 #define HsParserNeededHere(target) \
239 __SomeUtilNeededHere(target,$(GHC_HSP),$(GHC_HSPSRC),hsp)
240 #endif /* HsParserNeededHere */
241
242 GHC_HSP    = HsParserCmd
243 GHC_HSPSRC = $(GHC_HSCSRC)
244 \end{code}
245
246 \tr{hsc}: std Haskell compiler.
247 \begin{code}
248 #ifndef HsCompilerCmd
249 #define HsCompilerCmd $(GHC_HSCSRC)/hsc
250 #endif
251
252 #ifndef HsCompilerNeededHere
253 #define HsCompilerNeededHere(target) \
254 __SomeUtilNeededHere(target,$(GHC_HSC),$(GHC_HSCSRC),hsc)
255 #endif /* HsCompilerNeededHere */
256
257 GHC_HSC    = HsCompilerCmd
258 GHC_HSCSRC = $(GHC_COMPILERSRC)
259 \end{code}
260
261 \tr{SysMan}: PVM-controlling program for parallel Haskell.
262 \begin{code}
263 #ifndef SysManCmd
264 #define SysManCmd $(GHC_RUNTIMESRC)/gum/SysMan
265 #endif
266
267 #ifndef SysManNeededHere
268 #define SysManNeededHere(target) \
269 __SomeUtilNeededHere(target,$(GHC_SYSMAN),$(GHC_SYSMANSRC),gum/SysMan)
270 #endif /* SysManNeededHere */
271
272 GHC_SYSMAN    = SysManCmd
273 GHC_SYSMANSRC = $(GHC_RUNTIMESRC)
274 \end{code}
275
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.
279
280 %************************************************************************
281 %*                                                                      *
282 \subsubsection{Stuff for the C-compiling phase in particular...}
283 %*                                                                      *
284 %************************************************************************
285
286 {\em High-level assembler}: C compiler with which to compile \tr{.hc} files.
287
288 There are {\em three} things to set:
289 \begin{enumerate}
290 \item
291 C compilers to use:
292 \begin{itemize}
293 \item
294 compiler to use for ``debugging'' compilation (@GHC_DEBUG_HILEV_ASM@)
295 \item
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.
299 \end{itemize}
300
301 \item
302 Whether or not you can do the ``optimising''-style compilation (set
303 @GHC_GCC_IS_AVAILABLE@).
304 \end{enumerate}
305
306 For options that should always be applied {\em for this project},
307 set the @ProjectGhcOpts@ variable...
308       
309 Similarly, for a particular {\em setup}, use @SetupGhcOpts@...
310
311 %************************************************************************
312 %*                                                                      *
313 \subsubsubsection{Which C compiler to use (GCC is best)}
314 %*                                                                      *
315 %************************************************************************
316
317 \begin{code}
318 /*  NON-OPTIMISING C COMPILATION: ==================================
319
320     We can use GCC 2.n for the non-optimising (normal) .hc C
321     compilation [use it if we have it]
322 */
323 #ifndef GhcUseGccForDebuggingAsm
324 #if HaveGcc == YES
325 #define GhcUseGccForDebuggingAsm YES
326 #else
327 #define GhcUseGccForDebuggingAsm NO
328 #endif
329 #endif
330
331 #ifndef GhcDebuggingHighLevelAsmCmd
332 #if GhcUseGccForDebuggingAsm == YES
333 #define GhcDebuggingHighLevelAsmCmd WhatGccIsCalled
334 #else
335 #define GhcDebuggingHighLevelAsmCmd $(CC)
336 #endif /* ! gcc */
337 #endif /* GhcDebuggingHighLevelAsmCmd */
338 GHC_DEBUG_HILEV_ASM = GhcDebuggingHighLevelAsmCmd
339 \end{code}
340
341 \begin{code}
342 /*  OPTIMISING C COMPILATION (regs, etc): ==========================
343
344     Must use GCC 2.n for this
345     compilation [OFF by default]
346 */
347 /* We have GCC, which is necessary for optimising the Haskell
348     compiler's C output.
349 */
350 #ifndef GhcUseGccForOptAsm
351 #if HaveGcc == YES
352 #define GhcUseGccForOptAsm YES
353 #else
354 #define GhcUseGccForOptAsm NO
355 #endif
356 #endif
357
358 #ifndef GhcOptHighLevelAsmCmd
359 #if GhcUseGccForOptAsm == YES
360 #define GhcOptHighLevelAsmCmd WhatGccIsCalled
361 GHC_GCC_IS_AVAILABLE = 1
362 #else
363 GHC_GCC_IS_AVAILABLE = 0
364 #endif /* ! gcc */
365 #endif /* GhcOptHighLevelAsmCmd */
366 GHC_OPT_HILEV_ASM = GhcOptHighLevelAsmCmd
367 \end{code}