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