6d8f4c0376f70c3cbc6ec9211f015c299b58e158
[ghc-hetmet.git] / ghc / compiler / Jmakefile
1 /* preliminaries */
2
3 /* (only subdir is the test suite) */
4
5 #if IncludeTestDirsInBuild == YES
6 # define IHaveSubdirs
7
8 # define __ghc_compiler_tests_dir tests
9 #else
10 # define __ghc_compiler_tests_dir /* nothing */
11 #endif
12 SUBDIRS = __ghc_compiler_tests_dir
13 #undef __ghc_compiler_tests_dir
14 /* ?????? ToDo: something about test dirs underneath yaccParser ????? */
15
16 #if BuildDataParallelHaskell != YES
17     /* DPH likes to play around in subdirs */
18 # define NoAllTargetForSubdirs
19 # define NoDocsTargetForSubdirs
20 # define NoInstallDocsTargetForSubdirs
21 # define NoDependTargetForSubdirs
22 #endif
23     /* these always apply */
24 # define NoInstallTargetForSubdirs
25 #define NoTagTargetForSubdirs
26
27 /* Suffix rules: we do not use them much at all in GHC.
28    We need some magic stuff (from suffixes-GEN.ljm) for
29    the parser files.
30 */
31 SuffixRules_flexish()
32 SuffixRule_c_o()
33 LitSuffixRule(.lprl,.prl) /* for makeSymbolList.prl */
34
35 /* assume ALL source is in subdirectories one level below
36    they don't have Jmakefiles; this Jmakefile controls everything
37 */
38
39 SUBDIR_LIST = \ /* here they are, colon separated (for mkdependHS) */
40 utils:basicTypes:uniType:abstractSyn:prelude:envs:rename:typecheck:deSugar:coreSyn:specialise:simplCore:stranal:stgSyn:simplStg:codeGen:nativeGen:absCSyn:main:reader:profiling:deforest:podizeCore:yaccParser:nhcParser:interpreter
41
42 DASH_I_SUBDIR_LIST = \ /* same thing, in -I<dir> format */
43 -Iutils -IbasicTypes -IuniType -IabstractSyn -Iprelude -Ienvs -Irename -Itypecheck -IdeSugar -IcoreSyn -Ispecialise -IsimplCore -Istranal -IstgSyn -IsimplStg -IcodeGen -InativeGen -IabsCSyn -Imain -Ireader -Iprofiling -Ideforest -IpodizeCore -IyaccParser -InhcParser -Iinterpreter
44
45 #ifdef MainIncludeDir
46 MAIN_INCLUDE_DIR=MainIncludeDir
47 #else
48 MAIN_INCLUDE_DIR=$(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES)
49 #endif
50
51 /* helps to find GhcConstants.h in codeGen/CgCompInfo.lhs */
52 #ifdef CompInfoDir
53 COMPINFO_DIR=CompInfoDir
54 #else
55 COMPINFO_DIR=$(TOP_PWD)/$(CURRENT_DIR)/codeGen
56 #endif
57 /* nativeGen, elsewhere */
58 #ifdef NativeGenDir
59 NATIVEGEN_DIR=NativeGenDir
60 #else
61 NATIVEGEN_DIR=$(TOP_PWD)/$(CURRENT_DIR)/nativeGen
62 #endif
63
64 /* in order-of-passes order, utility modules at the end */
65
66 #if GhcBuilderVersion >= 23 && GhcBuildeeVersion >= 23
67 # define USE_NEW_READER YES
68 # define __new_reader_flag -DUSE_NEW_READER=1
69 #else
70 # define __new_reader_flag /*none*/
71 #endif
72 #if USE_NEW_READER == YES
73 # define READERSRCS_HS  \
74 yaccParser/U_atype.hs   \
75 yaccParser/U_binding.hs \
76 yaccParser/U_coresyn.hs \
77 yaccParser/U_entidt.hs  \
78 yaccParser/U_finfot.hs  \
79 yaccParser/U_hpragma.hs \
80 yaccParser/U_list.hs    \
81 yaccParser/U_literal.hs \
82 yaccParser/U_pbinding.hs \
83 yaccParser/U_treeHACK.hs \
84 yaccParser/U_ttype.hs
85 #define READERSRCS_LHS  \
86 yaccParser/UgenUtil.lhs \
87 yaccParser/UgenAll.lhs  \
88 reader/ReadPrefix2.lhs  \
89 reader/ReadPragmas2.lhs
90 #define hsp_library libhsp.a
91 #else
92 #define READERSRCS_HS   /* none */
93 #define READERSRCS_LHS  \
94 reader/ReadPrefix.lhs   \
95 reader/ReadPragmas.lhs
96 #define hsp_library /*none*/
97 #endif
98
99 #define FRONTSRCS_LHS   \
100 reader/PrefixSyn.lhs    \
101 reader/PrefixToHs.lhs   \
102 \
103 basicTypes/Unique.lhs   \
104 basicTypes/SplitUniq.lhs \
105 basicTypes/ProtoName.lhs \
106 basicTypes/NameTypes.lhs \
107 basicTypes/SrcLoc.lhs   \
108 basicTypes/Id.lhs       \
109 basicTypes/IdInfo.lhs   \
110 basicTypes/Inst.lhs     \
111 basicTypes/BasicLit.lhs \
112 basicTypes/CLabelInfo.lhs \
113 basicTypes/OrdList.lhs \
114 \
115 uniType/TyVar.lhs       \
116 uniType/TyCon.lhs       \
117 uniType/Class.lhs       \
118 uniType/UniType.lhs     \
119 uniType/UniTyFuns.lhs   \
120 uniType/AbsUniType.lhs  \
121 \
122 abstractSyn/Name.lhs /* abstract Haskell syntax */ \
123 abstractSyn/HsCore.lhs \
124 abstractSyn/HsPragmas.lhs \
125 abstractSyn/HsImpExp.lhs \
126 abstractSyn/HsDecls.lhs \
127 abstractSyn/HsBinds.lhs \
128 abstractSyn/HsMatches.lhs \
129 abstractSyn/HsLit.lhs \
130 abstractSyn/HsExpr.lhs \
131 abstractSyn/HsPat.lhs \
132 abstractSyn/HsTypes.lhs \
133 abstractSyn/AbsSyn.lhs \
134 abstractSyn/AbsSynFuns.lhs \
135 \
136 rename/Rename.lhs \
137 rename/Rename1.lhs \
138 rename/Rename2.lhs \
139 rename/Rename3.lhs \
140 rename/Rename4.lhs \
141 rename/RenameAuxFuns.lhs \
142 rename/RenameMonad12.lhs \
143 rename/RenameMonad3.lhs \
144 rename/RenameMonad4.lhs \
145 rename/RenameBinds4.lhs \
146 rename/RenameExpr4.lhs
147
148 #define TCSRCS_LHS \
149 prelude/PrelFuns.lhs \
150 prelude/PrimKind.lhs \
151 prelude/PrimOps.lhs \
152 prelude/TysPrim.lhs \
153 prelude/TysWiredIn.lhs \
154 prelude/PrelVals.lhs \
155 prelude/AbsPrel.lhs \
156 \
157 envs/IdEnv.lhs \
158 envs/TyVarEnv.lhs \
159 envs/LIE.lhs \
160 envs/CE.lhs \
161 envs/E.lhs \
162 envs/InstEnv.lhs \
163 envs/TCE.lhs \
164 envs/TVE.lhs \
165 \
166 typecheck/BackSubst.lhs \
167 typecheck/Disambig.lhs \
168 typecheck/GenSpecEtc.lhs \
169 typecheck/Spec.lhs \
170 typecheck/Subst.lhs     \
171 typecheck/TcBinds.lhs \
172 typecheck/TcClassDcl.lhs \
173 typecheck/TcClassSig.lhs \
174 typecheck/TcConDecls.lhs \
175 typecheck/TcContext.lhs \
176 typecheck/TcDefaults.lhs \
177 typecheck/TcDeriv.lhs \
178 typecheck/TcExpr.lhs \
179 typecheck/TcGRHSs.lhs \
180 typecheck/TcGenDeriv.lhs \
181 typecheck/TcIfaceSig.lhs \
182 typecheck/TcInstDcls.lhs \
183 typecheck/TcMatches.lhs \
184 typecheck/TcModule.lhs \
185 typecheck/TcMonad.lhs \
186 typecheck/TcMonadFns.lhs \
187 typecheck/TcMonoBnds.lhs \
188 typecheck/TcMonoType.lhs \
189 typecheck/TcPat.lhs \
190 typecheck/TcPolyType.lhs \
191 typecheck/TcPragmas.lhs \
192 typecheck/TcQuals.lhs \
193 typecheck/TcSimplify.lhs \
194 typecheck/TcTyDecls.lhs \
195 typecheck/Typecheck.lhs \
196 typecheck/Unify.lhs
197
198 #define DSSRCS_LHS \
199 coreSyn/AnnCoreSyn.lhs \
200 coreSyn/CoreSyn.lhs \
201 coreSyn/PlainCore.lhs \
202 coreSyn/TaggedCore.lhs \
203 coreSyn/CoreFuns.lhs \
204 coreSyn/CoreUnfold.lhs \
205 coreSyn/FreeVars.lhs \
206 coreSyn/CoreLift.lhs \
207 coreSyn/CoreLint.lhs \
208 \
209 deSugar/Desugar.lhs \
210 deSugar/Match.lhs \
211 deSugar/MatchCon.lhs \
212 deSugar/MatchLit.lhs \
213 deSugar/DsBinds.lhs \
214 deSugar/DsCCall.lhs \
215 deSugar/DsExpr.lhs \
216 deSugar/DsGRHSs.lhs \
217 deSugar/DsListComp.lhs \
218 deSugar/DsMonad.lhs \
219 deSugar/DsUtils.lhs \
220 \
221 specialise/Specialise.lhs \
222 specialise/SpecTyFuns.lhs \
223 \
224 simplCore/SimplCase.lhs \
225 simplCore/SimplEnv.lhs \
226 simplCore/SimplMonad.lhs \
227 simplCore/SimplPgm.lhs \
228 simplCore/SimplUtils.lhs \
229 simplCore/SimplVar.lhs \
230 simplCore/Simplify.lhs \
231 \
232 simplCore/LiberateCase.lhs \
233 \
234 simplCore/BinderInfo.lhs \
235 simplCore/ConFold.lhs \
236 simplCore/FloatIn.lhs \
237 simplCore/FloatOut.lhs \
238 simplCore/MagicUFs.lhs \
239 simplCore/SAT.lhs \
240 simplCore/SATMonad.lhs \
241 simplCore/SetLevels.lhs \
242 simplCore/SimplCore.lhs \
243 simplCore/OccurAnal.lhs \
244 simplCore/NewOccurAnal.lhs \
245 simplCore/FoldrBuildWW.lhs \
246 simplCore/AnalFBWW.lhs \
247 \
248 stranal/StrictAnal.lhs \
249 stranal/SaLib.lhs \
250 stranal/SaAbsInt.lhs \
251 stranal/WwLib.lhs \
252 stranal/WorkWrap.lhs \
253 \
254 profiling/SCCauto.lhs \
255 profiling/SCCfinal.lhs \
256 profiling/CostCentre.lhs
257
258 #if UseSemantiqueStrictnessAnalyser != YES
259 #define SEM_STRANAL_SRCS_LHS /* omit */
260 #else
261 #define SEM_STRANAL_SRCS_LHS \
262 stranal-sem/AFE.lhs \
263 stranal-sem/AbsVal.lhs \
264 stranal-sem/AssocPair.lhs \
265 stranal-sem/BuildAFE.lhs \
266 stranal-sem/ConstrEnv.lhs \
267 stranal-sem/Cycles.lhs \
268 stranal-sem/FG.lhs \
269 stranal-sem/FourProj.lhs \
270 stranal-sem/OAL.lhs \
271 stranal-sem/OAT.lhs \
272 stranal-sem/OL.lhs \
273 stranal-sem/ProgEnv.lhs \
274 stranal-sem/ProjBasic.lhs \
275 stranal-sem/ProjFactor.lhs  \
276 stranal-sem/ProjFolds.lhs  \
277 stranal-sem/ProjGets.lhs  \
278 stranal-sem/ProjLubAnd.lhs \
279 stranal-sem/REL.lhs \
280 stranal-sem/StrAnal.lhs \
281 stranal-sem/StrAnn.lhs \
282 stranal-sem/StrAnnCore.lhs \
283 stranal-sem/StrAnnUtil.lhs \
284 stranal-sem/StrTypeEnv.lhs \
285 stranal-sem/Transformer.lhs \
286 stranal-sem/Tree.lhs
287 #endif /* UseSemantiqueStrictnessAnalyser */
288
289 #if GhcWithDeforester != YES
290 #define __omit_deforester_flag -DOMIT_DEFORESTER=1
291 #define DEFORESTER_SRCS_LHS /*none*/
292 #else
293 #define __omit_deforester_flag /*nope*/
294 #define DEFORESTER_SRCS_LHS \
295 deforest/DefSyn.lhs \
296 deforest/Core2Def.lhs \
297 deforest/Def2Core.lhs \
298 deforest/Deforest.lhs \
299 deforest/DefUtils.lhs \
300 deforest/DefExpr.lhs \
301 deforest/Cyclic.lhs \
302 deforest/TreelessForm.lhs
303 #endif /* GhcWithDeforester */
304
305 #if BuildGHCI != YES
306 #define __build_ghci_flag /*nope*/
307 #define NHCSRCS_LHS /* omit */
308 #define GHCISRCS_LHS /* omit */
309 #else
310 #define __build_ghci_flag -DBUILD_GHCI=1
311 #define NHCSRCS_LHS \
312 nhcParser/Parse.lhs      \
313 nhcParser/ParseCore.lhs  \
314 nhcParser/ParseLib.lhs   \
315 nhcParser/ParseLex.lhs   \
316 nhcParser/PPSyntax.lhs   \
317 nhcParser/PPLib.lhs      \
318 nhcParser/Lexical.lhs    \
319 nhcParser/Lex.lhs        \
320 nhcParser/LexPre.lhs     \
321 nhcParser/LexStr.lhs     \
322 nhcParser/HS.lhs         \
323 nhcParser/MkSyntax.lhs   \
324 nhcParser/SyntaxPos.lhs  \
325 nhcParser/Syntax.lhs     \
326 nhcParser/Extra.lhs      \
327 nhcParser/ScopeLib.lhs   \
328 nhcParser/Import.lhs     \
329 nhcParser/AttrLib.lhs    \
330 nhcParser/Attr.lhs       \
331 nhcParser/NHCName.lhs    \
332 nhcParser/NameLow.lhs    \
333 nhcParser/ParseI.lhs     \
334 nhcParser/Tree234.lhs    \
335 nhcParser/MergeSort.lhs  \
336 nhcParser/StrName.lhs    \
337 nhcParser/NameLib.lhs    \
338 nhcParser/OsOnly.lhs     \
339 nhcParser/Flags.lhs      \
340 nhcParser/Fixity.lhs     \
341 nhcParser/StrSyntax.lhs  \
342 nhcParser/Either.lhs     \
343 nhcParser/ListUtil.lhs   \
344 nhcParser/NHCPackedString.lhs \
345 nhcParser/HbcOnly.lhs    \
346 nhcParser/LexLow.lhs     
347
348 /* Bits we don't need after all.  ToDo: delete their source...
349 nhcParser/IName.lhs      \
350 nhcParser/IExtract.lhs   \
351 nhcParser/Error.lhs      \
352 nhcParser/BindLib.lhs    \
353 nhcParser/BindI.lhs      
354 */
355
356 #define GHCISRCS_LHS \
357 interpreter/ToPrefix.lhs   \
358 interpreter/UnsafeCoerce.lhs \
359 interpreter/Dynamic.lhs \
360 interpreter/Interpreter.lhs \
361 interpreter/MkInterface.lhs \
362 interpreter/GHCIMonad.lhs  \
363 interpreter/FullEnv.lhs  \
364 interpreter/Command.lhs    \
365 interpreter/GHCIFlags.lhs        \
366 interpreter/GHCInterface.lhs \
367 interpreter/GHCI.lhs \
368 interpreter/GHCICore.lhs \
369 interpreter/Dld.lhs
370
371 /* ToDo: mkworld-ify */
372 DLD_DIR         = ./dld
373 DLD_LIB         = $(DLD_DIR)/libdld.a
374 DLD_INCLUDE     = $(DLD_DIR)/dld.h
375
376 DLD_OBJS_O =                    \
377         dld/dld.o               \
378         dld/find_exec.o         \
379         dld/define.o            \
380         dld/get_func.o          \
381         dld/get_symbol.o        \
382         dld/list_undef.o        \
383         dld/mk_dummy.o          \
384         dld/ref.o               \
385         dld/ul_file.o           \
386         dld/ul_symbol.o         \
387         dld/remove.o            \
388         dld/error.o
389
390 #endif /* BuildGHCI */
391
392 #define BACKSRCS_LHS \
393 stgSyn/CoreToStg.lhs \
394 stgSyn/StgSyn.lhs \
395 stgSyn/StgFuns.lhs \
396 stgSyn/StgLint.lhs \
397 \
398 simplStg/SatStgRhs.lhs \
399 simplStg/LambdaLift.lhs \
400 simplStg/StgVarInfo.lhs \
401 simplStg/UpdAnal.lhs \
402 simplStg/StgStats.lhs \
403 simplStg/StgSATMonad.lhs \
404 simplStg/StgSAT.lhs \
405 simplStg/SimplStg.lhs \
406 \
407 absCSyn/AbsCSyn.lhs \
408 absCSyn/Costs.lhs \
409 absCSyn/HeapOffs.lhs \
410 absCSyn/AbsCFuns.lhs \
411 absCSyn/PprAbsC.lhs \
412 \
413 codeGen/CodeGen.lhs \
414 codeGen/ClosureInfo.lhs \
415 codeGen/SMRep.lhs \
416 codeGen/CgConTbls.lhs \
417 codeGen/CgCompInfo.lhs \
418 codeGen/CgMonad.lhs \
419 codeGen/CgUsages.lhs \
420 codeGen/CgHeapery.lhs \
421 codeGen/CgStackery.lhs \
422 codeGen/CgExpr.lhs \
423 codeGen/CgCase.lhs \
424 codeGen/CgLetNoEscape.lhs \
425 codeGen/CgTailCall.lhs \
426 codeGen/CgClosure.lhs \
427 codeGen/CgCon.lhs \
428 codeGen/CgRetConv.lhs \
429 codeGen/CgBindery.lhs \
430 codeGen/CgUpdate.lhs
431
432 #if GhcWithNativeCodeGen == NO || GhcWithHscBuiltViaC == YES
433     /* if building via C, we *assume* that it is the
434        distributed C files, which do not have a native-code
435        generator in them
436     */
437 #define __omit_ncg_maybe -DOMIT_NATIVE_CODEGEN=1
438 #define NATIVEGEN_SRCS_LHS /*none*/
439 #else
440 #define __omit_ncg_maybe /*none*/
441 #if sparc_TARGET_ARCH
442 #define __machdep_nativegen_lhs \
443 nativeGen/SparcDesc.lhs \
444 nativeGen/SparcCode.lhs \
445 nativeGen/SparcGen.lhs
446 #define __ghci_machdep_nativegen_lhs \
447 nativeGen/SparcCode.lhs
448 #else
449 #define __machdep_nativegen_lhs \
450 nativeGen/AlphaDesc.lhs \
451 nativeGen/AlphaCode.lhs \
452 nativeGen/AlphaGen.lhs
453 #define __ghci_machdep_nativegen_lhs \
454 nativeGen/AlphaCode.lhs
455 #endif
456
457 #define NATIVEGEN_SRCS_LHS \
458 nativeGen/AbsCStixGen.lhs \
459 nativeGen/AsmCodeGen.lhs \
460 nativeGen/AsmRegAlloc.lhs \
461 nativeGen/MachDesc.lhs \
462 nativeGen/Stix.lhs \
463 nativeGen/StixInfo.lhs \
464 nativeGen/StixInteger.lhs \
465 nativeGen/StixPrim.lhs \
466 nativeGen/StixMacro.lhs \
467 __machdep_nativegen_lhs /*arch-specific ones */
468 #endif
469
470 #define UTILSRCS_LHS \
471 utils/CharSeq.lhs \
472 utils/Bag.lhs \
473 utils/Pretty.lhs \
474 utils/Unpretty.lhs \
475 utils/Maybes.lhs \
476 utils/Digraph.lhs \
477 utils/BitSet.lhs \
478 utils/LiftMonad.lhs \
479 utils/ListSetOps.lhs \
480 utils/Outputable.lhs \
481 utils/FiniteMap.lhs \
482 utils/UniqFM.lhs \
483 utils/UniqSet.lhs \
484 utils/Util.lhs
485
486 #if BuildDataParallelHaskell != YES
487 #define DPH_SRCS_LHS /*none*/
488 #else
489 #define DPH_SRCS_LHS \
490 \
491 typecheck/TcParQuals.lhs \
492 deSugar/DsParZF.lhs \
493 deSugar/MatchProc.lhs \
494 prelude/ClsPid.lhs \
495 prelude/ClsProc.lhs \
496 prelude/TyPod.lhs \
497 prelude/TyProcs.lhs \
498 \
499 podizeCore/PodInfoTree.lhs \
500 podizeCore/PodInfoMonad.lhs \
501 podizeCore/PodInfo1.lhs \
502 podizeCore/PodInfo2.lhs \
503 podizeCore/PodizeMonad.lhs \
504 podizeCore/PodizePass0.lhs \
505 podizeCore/PodizePass1.lhs \
506 podizeCore/PodizePass2.lhs \
507 podizeCore/PodizeCore.lhs
508 #endif /* DPH */
509
510 #define MAIN_SRCS_LHS \
511 main/MkIface.lhs \
512 main/ErrUtils.lhs \
513 main/ErrsRn.lhs \
514 main/ErrsTc.lhs \
515 main/Errors.lhs \
516 main/MainMonad.lhs \
517 main/CmdLineOpts.lhs \
518 main/Main.lhs
519
520 ALLSRCS_HS = READERSRCS_HS
521 ALLSRCS_LHS = /* all pieces of the compiler */ \
522 READERSRCS_LHS \
523 FRONTSRCS_LHS \
524 TCSRCS_LHS \
525 DSSRCS_LHS \
526 BACKSRCS_LHS \
527 MAIN_SRCS_LHS \
528 UTILSRCS_LHS NATIVEGEN_SRCS_LHS DEFORESTER_SRCS_LHS SEM_STRANAL_SRCS_LHS DPH_SRCS_LHS NHCSRCS_LHS GHCISRCS_LHS
529 /* NB: all the ones that may be empty (e.g., DPH_SRCS_LHS)
530         need to be on the last line.
531 */
532
533 HSCSRCS_HS = READERSRCS_HS
534 HSCSRCS_LHS = /* all pieces of the compiler */ \
535 READERSRCS_LHS \
536 FRONTSRCS_LHS \
537 TCSRCS_LHS \
538 DSSRCS_LHS \
539 BACKSRCS_LHS \
540 MAIN_SRCS_LHS \
541 UTILSRCS_LHS NATIVEGEN_SRCS_LHS DEFORESTER_SRCS_LHS SEM_STRANAL_SRCS_LHS DPH_SRCS_LHS
542
543 /* 
544 As well as the obvious inclusions, there are a few non-obvious ones
545 obtained from the transitive closure:
546
547 * main/Errors.lhs andmain/CmdLineOpts.lhs are actually used.
548
549 * most of the rest trickles in through the prelude.
550
551 ToDo: hack around in the prelude to avoid all this...
552
553 */
554
555 GHCISRCS = /* all pieces of the interpreter */ \
556 FRONTSRCS_LHS \
557 TCSRCS_LHS \
558 DSSRCS_LHS \
559 main/Errors.lhs \
560 main/ErrUtils.lhs \
561 main/ErrsRn.lhs \
562 main/ErrsTc.lhs \
563 main/CmdLineOpts.lhs \
564 main/MainMonad.lhs \
565 absCSyn/HeapOffs.lhs \
566 codeGen/SMRep.lhs \
567 codeGen/CgCompInfo.lhs \
568 codeGen/ClosureInfo.lhs \
569 codeGen/CgRetConv.lhs \
570 absCSyn/AbsCSyn.lhs \
571 codeGen/CgMonad.lhs \
572 absCSyn/AbsCFuns.lhs \
573 codeGen/CgBindery.lhs \
574 codeGen/CgUsages.lhs \
575 absCSyn/Costs.lhs \
576 absCSyn/PprAbsC.lhs \
577 stgSyn/StgSyn.lhs \
578 nativeGen/AsmRegAlloc.lhs __ghci_machdep_nativegen_lhs \
579 UTILSRCS_LHS SEM_STRANAL_SRCS_LHS DEFORESTER_SRCS_LHS NHCSRCS_LHS GHCISRCS_LHS
580
581
582 /* should't use these fancy `make' things, really */
583 ALLOBJS=$(ALLSRCS_LHS:.lhs=.o)  $(ALLSRCS_HS:.hs=.o)
584 ALLINTS=$(ALLSRCS_LHS:.lhs=.hi) $(ALLSRCS_HS:.hs=.hi)
585
586 HSCOBJS=$(HSCSRCS_LHS:.lhs=.o)  $(HSCSRCS_HS:.hs=.o)
587 HSCINTS=$(HSCSRCS_LHS:.lhs=.hi) $(HSCSRCS_HS:.hs=.hi)
588
589 GHCIOBJS=$(GHCISRCS:.lhs=.o) interpreter/DldHacks.o interpreter/DldC.o interpreter/prelude.o interpreter/runtime.o
590 GHCIINTS=$(GHCISRCS:.lhs=.hi) interpreter/Dldhacks.hi
591
592 .PRECIOUS: $(ALLINTS)
593
594 #if GhcWithHscDebug == YES
595 # define use_DDEBUG -DDEBUG
596 #else
597 # define use_DDEBUG /*nothing*/
598 #endif
599
600 #if HaskellCompilerType == HC_CHALMERS_HBC
601
602 HC_OPTS = -D__HASKELL1__=2 -M -H12m -DCOMPILING_GHC use_DDEBUG -I. -i$(SUBDIR_LIST)
603
604 /* ToDo: else something for Niklas Rojemo's NHC (not yet) */
605
606 #else /* assume we either have GlasgowHaskell or are booting from .hc C files */
607
608 #if GhcWithHscOptimised == YES
609 #define __version_sensitive_flags -DUSE_ATTACK_PRAGMAS -fshow-pragma-name-errs -fomit-reexported-instances -fshow-import-specs
610 #else
611 #define __version_sensitive_flags -fomit-reexported-instances
612 #endif
613
614 #if GhcWithRegisterised == NO
615     /* doing a raw boot from .hc files, presumably */
616 #define __unreg_opts_maybe -O -unregisterised
617 #else
618 #define __unreg_opts_maybe /*none*/
619 #endif
620
621 /* avoid use of AllProjectsHcOpts; then put in HcMaxHeapFlag "by hand" */
622 #undef  AllProjectsHcOpts
623 #define AllProjectsHcOpts /**/
624
625 HC_OPTS = -cpp -H12m HcMaxHeapFlag -fglasgow-exts -DCOMPILING_GHC \
626         -fomit-derived-read \
627         -I. -i$(SUBDIR_LIST) \
628         use_DDEBUG __version_sensitive_flags __unreg_opts_maybe __omit_ncg_maybe __new_reader_flag __build_ghci_flag __omit_deforester_flag
629
630 #undef __version_sensitive_flags
631 #undef __unreg_opts_maybe
632 #undef __omit_ncg_maybe
633 #undef __new_reader_flag
634 #undef __build_ghci_flag
635 #undef __omit_deforester_flag
636
637 #if GhcWithHscBuiltViaC == YES /* not using a Haskell compiler */
638
639 HSCHCS=$(HSCSRCS_LHS:.lhs=.hc) $(HSCSRCS_HS:.hs=.hc)
640 hcs:: $(HSCHCS)
641
642 #if HaskellCompilerType == HC_USE_HC_FILES
643 HC = $(GHC) /* uses the driver herein */
644 #endif
645
646 #endif /* using .hc files */
647 #endif /* not using HBC */
648
649 /*
650     -DCOMPILING_GHC
651         we're compiling the compiler with itself; clear enough?
652         Only used at present to ask for SPECIALIZEd functions
653         in modules that are allegedly "generic" (e.g., FiniteMap).
654
655     -DUSE_SEMANTIQUE_STRANAL
656         to include the Semantique strictness analyser into the compiler
657         [probably quite moth-eaten by now 94/05 (WDP)]
658
659     -DDPH       compiling Jon Hill's "data parallel Haskell"
660
661     (there are more, as yet unlisted WDP 94/12)
662 */
663 #if UseSemantiqueStrictnessAnalyser == YES
664 STRANAL_SEM_P = -DUSE_SEMANTIQUE_STRANAL
665 #endif
666
667 #if BuildDataParallelHaskell == YES
668 DPH_P = -DDPH
669 #endif
670
671 #if GhcUseSplittableUniqueSupply == YES
672 /* ToDo: delete? */
673 SPLIT_P = -DUSE_SPLITTABLE_UNIQUESUPPLY
674 #endif
675
676 GHC_EXTRA_DEFINES = $(STRANAL_SEM_P) $(DPH_P) $(SPLIT_P)
677
678 #if USE_NEW_READER == YES
679 BuildPgmFromHaskellModules(hsc,$(HSCOBJS) yaccParser/hsclink.o yaccParser/hschooks.o,,libhsp.a)
680 #else
681 BuildPgmFromHaskellModules(hsc,$(HSCOBJS),,)
682 #endif
683
684 /* ghci::       hsc */
685 /* Hack to let me bootstrap (needed for error handlers) */
686 /* Comment out if building boot copy of hsc */
687 /*HC = ../driver/ghc*/
688 #if BuildGHCI == YES
689 BuildPgmFromHaskellModules(ghci,$(GHCIOBJS),,$(DLD_LIB))
690 #endif
691
692 #if DoInstallGHCSystem == YES
693 MakeDirectories(install, $(INSTLIBDIR_GHC))
694 InstallBinaryTarget(hsc,$(INSTLIBDIR_GHC))
695 #endif
696
697 /* set up for going either to .hc or to .o files */
698 #if GhcWithHscBuiltViaC == YES
699
700 /*OLD:SuffixRule_hc_o() */
701
702 # if HaskellCompilerType == HC_USE_HC_FILES
703     /* if we do not, we never try to compile .lhs files;
704         we *blast* the macro we would normally use (HACK) (WDP 94/12)
705      */
706
707 #  undef HaskellCompileWithSpecifiedFlags
708 #  define HaskellCompileWithSpecifiedFlags(module,isuf,osuf,flags)      @@\
709 module.osuf : module.isuf                                               \
710 _body_HaskellCompileWithSpecifiedFlags(module.isuf,module.osuf,module,isuf,flags)
711
712 #  define compile(module,isuf,extra_flags) \
713 HaskellCompileWithExtraFlags(module,hc,o,-c,extra_flags)
714
715 #  define compile_rec(module,isuf,extra_flags) \
716 HaskellCompileWithExtraFlags_Recursive(module,hc,o,-c,extra_flags)
717
718 # else /* we do! */
719
720 #  define compile(module,isuf,extra_flags) \
721 HaskellCompileWithExtraFlags(module,isuf,hc,-C,extra_flags)
722
723 #  define compile_rec(module,isuf,extra_flags) \
724 HaskellCompileWithExtraFlags_Recursive(module,isuf,hc,-C,extra_flags)
725
726 # endif /* ... == HC_USE_HC_FILES */
727
728 #else /* ! booting from C */
729
730 # define compile(module,isuf,extra_flags) \
731 HaskellCompileWithExtraFlags(module,isuf,o,-c,extra_flags)
732
733 # define compile_rec(module,isuf,extra_flags) \
734 HaskellCompileWithExtraFlags_Recursive(module,isuf,o,-c,extra_flags)
735
736 #endif /* ! booting from C */
737
738 #if HaskellCompilerType == HC_CHALMERS_HBC
739 # define if_ghc(x)   /*nothing*/
740 # define if_ghc26(x) /*nothing*/
741 #else /* hope for GHC-ish */
742 # define if_ghc(x) x
743 # if GhcBuilderVersion >= 26
744 #  define if_ghc26(x) x
745 # else
746 #  define if_ghc26(x) /*nothing*/
747 # endif
748 #endif
749
750 /* OK, here we go: */
751
752 compile(absCSyn/AbsCFuns,lhs,)
753 compile_rec(absCSyn/AbsCSyn,lhs,if_ghc(-fno-omit-reexported-instances))
754 compile(absCSyn/Costs,lhs,)              /* HWL */
755 compile_rec(absCSyn/HeapOffs,lhs,)
756 compile(absCSyn/PprAbsC,lhs,-H20m)
757
758 compile_rec(abstractSyn/AbsSyn,lhs,if_ghc(-fno-omit-reexported-instances))
759 compile_rec(abstractSyn/AbsSynFuns,lhs,)
760 compile_rec(abstractSyn/HsBinds,lhs,)
761 compile_rec(abstractSyn/HsCore,lhs,)
762 compile(abstractSyn/HsDecls,lhs,)
763 compile_rec(abstractSyn/HsExpr,lhs,-H14m)
764 compile(abstractSyn/HsImpExp,lhs,)
765 compile(abstractSyn/HsLit,lhs,)
766 compile(abstractSyn/HsMatches,lhs,)
767 compile(abstractSyn/HsPat,lhs,)
768 compile_rec(abstractSyn/HsPragmas,lhs,)
769 compile(abstractSyn/HsTypes,lhs,)
770 compile_rec(abstractSyn/Name,lhs,)
771
772 compile(basicTypes/BasicLit,lhs,)
773 compile(basicTypes/OrdList,lhs,)
774 compile_rec(basicTypes/CLabelInfo,lhs,)
775 compile_rec(basicTypes/Id,lhs,-H20m)
776 compile_rec(basicTypes/IdInfo,lhs,-H20m -K2m)
777 compile(basicTypes/Inst,lhs,)
778 compile(basicTypes/NameTypes,lhs,)
779 compile(basicTypes/ProtoName,lhs,)
780 compile(basicTypes/SrcLoc,lhs,)
781 compile(basicTypes/Unique,lhs,)
782 compile_rec(basicTypes/SplitUniq,lhs,)
783
784 compile(codeGen/CgBindery,lhs,)
785 compile(codeGen/CgCase,lhs,-H16m)
786 compile(codeGen/CgClosure,lhs,-H16m)
787 compile_rec(codeGen/CgCompInfo,lhs,-I$(COMPINFO_DIR))
788 compile(codeGen/CgCon,lhs,)
789 compile(codeGen/CgConTbls,lhs,)
790 compile_rec(codeGen/CgExpr,lhs,)
791 compile(codeGen/CgHeapery,lhs,)
792 compile(codeGen/CgLetNoEscape,lhs,)
793 compile_rec(codeGen/CgMonad,lhs,if_ghc(-fno-omit-reexported-instances))
794 compile_rec(codeGen/CgRetConv,lhs,)
795 compile(codeGen/CgStackery,lhs,)
796 compile(codeGen/CgTailCall,lhs,)
797 compile(codeGen/CgUpdate,lhs,)
798 compile(codeGen/CgUsages,lhs,)
799 compile_rec(codeGen/ClosureInfo,lhs,)
800 compile(codeGen/CodeGen,lhs,)
801 compile(codeGen/SMRep,lhs,)
802
803 compile(coreSyn/AnnCoreSyn,lhs,if_ghc(-fno-omit-reexported-instances))
804 compile(coreSyn/CoreFuns,lhs,-H16m)
805 compile(coreSyn/CoreLift,lhs,)
806 compile(coreSyn/CoreLint,lhs,)
807 compile(coreSyn/CoreSyn,lhs,)
808 compile(coreSyn/CoreUnfold,lhs,)
809 compile(coreSyn/FreeVars,lhs,)
810 compile_rec(coreSyn/PlainCore,lhs,if_ghc(-fno-omit-reexported-instances))
811 compile(coreSyn/TaggedCore,lhs,if_ghc(-fno-omit-reexported-instances))
812
813 compile(deSugar/Desugar,lhs,)
814 compile_rec(deSugar/DsBinds,lhs,-H16m)
815 compile(deSugar/DsCCall,lhs,)
816 compile_rec(deSugar/DsExpr,lhs,-H16m)
817 compile(deSugar/DsGRHSs,lhs,)
818 compile(deSugar/DsListComp,lhs,)
819 compile(deSugar/DsMonad,lhs,)
820 compile_rec(deSugar/DsUtils,lhs,)
821 compile_rec(deSugar/Match,lhs,)
822 compile(deSugar/MatchCon,lhs,)
823 compile(deSugar/MatchLit,lhs,)
824
825 compile(envs/CE,lhs,)
826 compile(envs/E,lhs,)
827 compile(envs/IdEnv,lhs,)
828 compile_rec(envs/InstEnv,lhs,)
829 compile(envs/LIE,lhs,)
830 compile(envs/TCE,lhs,)
831 compile(envs/TVE,lhs,)
832 compile_rec(envs/TyVarEnv,lhs,)
833
834 compile(main/CmdLineOpts,lhs,-K2m)
835 compile_rec(main/Errors,lhs,)
836 compile_rec(main/ErrsTc,lhs,-H20m)
837 compile_rec(main/ErrsRn,lhs,)
838 compile_rec(main/ErrUtils,lhs,)
839 compile(main/Main,lhs,-H16m if_ghc(-fvia-C -fno-update-analysis)) /* ToDo: update */
840 compile(main/MainMonad,lhs,if_ghc(-fno-omit-reexported-instances))
841 compile(main/MkIface,lhs,)
842
843 #if GhcWithNativeCodeGen == YES
844 compile(nativeGen/AbsCStixGen,lhs,)
845 compile(nativeGen/AsmCodeGen,lhs,-I$(COMPINFO_DIR))
846 compile_rec(nativeGen/AsmRegAlloc,lhs,-I$(COMPINFO_DIR) -H20m)
847 compile(nativeGen/MachDesc,lhs,)
848 compile(nativeGen/Stix,lhs,)
849 compile(nativeGen/StixInfo,lhs,-I$(NATIVEGEN_DIR))
850 compile(nativeGen/StixInteger,lhs,-H20m)
851 compile(nativeGen/StixMacro,lhs,-I$(NATIVEGEN_DIR))
852 compile(nativeGen/StixPrim,lhs,-H16m)
853 #if sparc_TARGET_ARCH
854 compile_rec(nativeGen/SparcDesc,lhs,)
855 compile(nativeGen/SparcCode,lhs,-H20m -I$(NATIVEGEN_DIR))
856 compile(nativeGen/SparcGen,lhs,-H20m)
857 #else
858 compile_rec(nativeGen/AlphaDesc,lhs,)
859 compile(nativeGen/AlphaCode,lhs,-H24m -K2m -I$(NATIVEGEN_DIR))
860 compile(nativeGen/AlphaGen,lhs,-H24m)
861 #endif
862 #endif
863
864 compile_rec(prelude/AbsPrel,lhs,-H16m -K2m if_ghc(-fno-omit-reexported-instances -fno-update-analysis))
865 compile_rec(prelude/PrelFuns,lhs,)
866 compile(prelude/PrelVals,lhs,)
867 compile_rec(prelude/PrimKind,lhs,-I$(COMPINFO_DIR))
868 compile_rec(prelude/PrimOps,lhs,-H16m -K2m)
869 compile(prelude/TysPrim,lhs,)
870 compile(prelude/TysWiredIn,lhs,)
871
872 compile(profiling/SCCauto,lhs,)
873 compile(profiling/SCCfinal,lhs,)
874 compile(profiling/CostCentre,lhs,)
875
876 compile(reader/PrefixSyn,lhs,)
877 compile(reader/PrefixToHs,lhs,-H16m)
878 compile(reader/ReadPragmas,lhs,)
879 compile_rec(reader/ReadPrefix,lhs,)
880 compile_rec(reader/ReadPrefix2,lhs,-H20m if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
881 compile(reader/ReadPragmas2,lhs,-H20m)
882
883 compile(rename/Rename,lhs,)
884 compile(rename/Rename1,lhs,)
885 compile(rename/Rename2,lhs,)
886 compile(rename/Rename3,lhs,)
887 compile(rename/Rename4,lhs,-H20m)
888 compile(rename/RenameAuxFuns,lhs,)
889 compile_rec(rename/RenameBinds4,lhs,)
890 compile_rec(rename/RenameExpr4,lhs,)
891 compile(rename/RenameMonad12,lhs,)
892 compile(rename/RenameMonad3,lhs,)
893 compile(rename/RenameMonad4,lhs,)
894
895 compile(simplCore/BinderInfo,lhs,)
896 compile(simplCore/ConFold,lhs,)
897 compile(simplCore/FloatIn,lhs,)
898 compile(simplCore/FloatOut,lhs,)
899 compile(simplCore/LiberateCase,lhs,)
900 compile(simplCore/MagicUFs,lhs,)
901 compile(simplCore/OccurAnal,lhs,)
902
903 compile(simplCore/NewOccurAnal,lhs,)
904 compile(simplCore/AnalFBWW,lhs,)
905 compile(simplCore/FoldrBuildWW,lhs,)
906 /* ANDY: compile(simplCore/SimplHaskell,lhs,) */
907
908 compile(simplCore/SAT,lhs,)
909 compile(simplCore/SATMonad,lhs,)
910 compile(simplCore/SetLevels,lhs,)
911 compile_rec(simplCore/SimplCase,lhs,-H20m)
912 compile(simplCore/SimplCore,lhs,)
913 compile_rec(simplCore/SimplEnv,lhs,)
914 compile(simplCore/SimplMonad,lhs,)
915 compile(simplCore/SimplPgm,lhs,)
916 compile(simplCore/SimplUtils,lhs,)
917 compile_rec(simplCore/SimplVar,lhs,)
918 compile(simplCore/Simplify,lhs,)
919
920 compile(simplStg/SatStgRhs,lhs,)
921 compile(simplStg/LambdaLift,lhs,)
922 compile(simplStg/StgVarInfo,lhs,)
923 compile(simplStg/UpdAnal,lhs,)
924 compile(simplStg/StgStats,lhs,)
925 compile(simplStg/StgSATMonad,lhs,)
926 compile(simplStg/StgSAT,lhs,)
927 compile(simplStg/SimplStg,lhs,)
928
929 #if GhcWithDeforester == YES
930 compile(deforest/Core2Def,lhs,)
931 compile(deforest/Cyclic,lhs,)
932 compile_rec(deforest/Def2Core,lhs,)
933 compile(deforest/DefExpr,lhs,-H20m)
934 compile(deforest/DefSyn,lhs,)
935 compile(deforest/DefUtils,lhs,-H16m)
936 compile(deforest/Deforest,lhs,)
937 compile(deforest/TreelessForm,lhs,)
938 #endif
939
940 compile(specialise/Specialise,lhs,-H32m) /* sigh */
941 compile(specialise/SpecTyFuns,lhs,)
942
943 compile(stgSyn/CoreToStg,lhs,)
944 compile(stgSyn/StgFuns,lhs,)
945 compile(stgSyn/StgLint,lhs,)
946 compile(stgSyn/StgSyn,lhs,if_ghc(-fno-omit-reexported-instances) -H16m)
947
948 compile(stranal/SaAbsInt,lhs,)
949 compile(stranal/SaLib,lhs,)
950 compile(stranal/StrictAnal,lhs,)
951 compile(stranal/WorkWrap,lhs,)
952 compile(stranal/WwLib,lhs,)
953
954 compile(typecheck/BackSubst,lhs,)
955 compile_rec(typecheck/Disambig,lhs,)
956 compile(typecheck/GenSpecEtc,lhs,)
957 compile(typecheck/Spec,lhs,)
958 compile(typecheck/Subst,lhs,if_ghc(-fvia-C) if_ghc26(-monly-4-regs))
959 compile(typecheck/TcBinds,lhs,)
960 compile(typecheck/TcClassDcl,lhs,-H14m)
961 compile(typecheck/TcClassSig,lhs,)
962 compile(typecheck/TcConDecls,lhs,)
963 compile(typecheck/TcContext,lhs,)
964 compile(typecheck/TcDefaults,lhs,)
965 compile_rec(typecheck/TcDeriv,lhs,-H20m)
966 compile_rec(typecheck/TcExpr,lhs,-H20m)
967 compile_rec(typecheck/TcGRHSs,lhs,)
968 compile(typecheck/TcGenDeriv,lhs,-H20m)
969 compile(typecheck/TcIfaceSig,lhs,)
970 compile(typecheck/TcInstDcls,lhs,-H20m)
971 compile(typecheck/TcMatches,lhs,)
972 compile(typecheck/TcModule,lhs,)
973 compile_rec(typecheck/TcMonad,lhs,)
974 compile(typecheck/TcMonadFns,lhs,)
975 compile(typecheck/TcMonoBnds,lhs,)
976 compile(typecheck/TcMonoType,lhs,)
977 compile(typecheck/TcPat,lhs,-H14m)
978 compile_rec(typecheck/TcPolyType,lhs,)
979 compile(typecheck/TcPragmas,lhs,-H20m)
980 compile(typecheck/TcQuals,lhs,)
981 compile(typecheck/TcSimplify,lhs,)
982 compile(typecheck/TcTyDecls,lhs,)
983 compile(typecheck/Typecheck,lhs,)
984 compile(typecheck/Unify,lhs,)
985
986 compile_rec(uniType/AbsUniType,lhs,if_ghc(-fno-omit-reexported-instances))
987 compile_rec(uniType/Class,lhs,)
988 compile_rec(uniType/TyCon,lhs,)
989 compile_rec(uniType/TyVar,lhs,)
990 compile(uniType/UniTyFuns,lhs,-H20m)
991 compile_rec(uniType/UniType,lhs,)
992
993 compile(utils/Bag,lhs,)
994 compile(utils/CharSeq,lhs,if_ghc(-fvia-C)) /* uses stg_putc */
995 compile(utils/Digraph,lhs,)
996 compile(utils/FiniteMap,lhs,-H20m)
997 compile(utils/LiftMonad,lhs,)
998 compile(utils/ListSetOps,lhs,)
999 compile(utils/Maybes,lhs,)
1000 compile_rec(utils/Outputable,lhs,)
1001 compile_rec(utils/Pretty,lhs,)
1002 compile(utils/BitSet,lhs,if_ghc26(-monly-4-regs))
1003 compile_rec(utils/UniqFM,lhs,)
1004 compile(utils/UniqSet,lhs,)
1005 compile(utils/Unpretty,lhs,)
1006 compile_rec(utils/Util,lhs,)
1007
1008 /* Some of these sizes have been boosted a little to fit the alpha */
1009 #if BuildGHCI == YES
1010 compile(nhcParser/Attr,lhs,)
1011 compile(nhcParser/AttrLib,lhs,if_ghc(-fhaskell-1.3))
1012 compile(nhcParser/Either,lhs,if_ghc(-fhaskell-1.3))
1013 compile(nhcParser/Extra,lhs,if_ghc(-fhaskell-1.3))
1014 compile(nhcParser/Fixity,lhs,if_ghc(-fhaskell-1.3))
1015 compile(nhcParser/Flags,lhs,if_ghc(-fhaskell-1.3))
1016 compile(nhcParser/HS,lhs,if_ghc(-fhaskell-1.3))
1017 compile(nhcParser/HbcOnly,lhs,if_ghc(-fhaskell-1.3))
1018 compile(nhcParser/Import,lhs,)
1019 compile(nhcParser/Lex,lhs,)
1020 compile(nhcParser/LexLow,lhs,)
1021 compile(nhcParser/LexPre,lhs,)
1022 compile(nhcParser/LexStr,lhs,)
1023 compile(nhcParser/Lexical,lhs,if_ghc(-fhaskell-1.3))
1024 compile(nhcParser/ListUtil,lhs,)
1025 compile(nhcParser/MergeSort,lhs,)
1026 compile(nhcParser/MkSyntax,lhs,if_ghc(-fhaskell-1.3))
1027 compile(nhcParser/NHCName,lhs,)
1028 compile(nhcParser/NHCPackedString,lhs,)
1029 compile(nhcParser/NameLib,lhs,if_ghc(-fhaskell-1.3))
1030 compile(nhcParser/NameLow,lhs,if_ghc(-fhaskell-1.3))
1031 compile(nhcParser/OsOnly,lhs,)
1032 compile(nhcParser/PPLib,lhs,)
1033 compile(nhcParser/PPSyntax,lhs,)
1034 compile(nhcParser/Parse,lhs,-H30m if_ghc(-fhaskell-1.3))
1035 compile(nhcParser/ParseCore,lhs,if_ghc(-fhaskell-1.3))
1036 compile(nhcParser/ParseI,lhs,if_ghc(-fhaskell-1.3))
1037 compile(nhcParser/ParseLex,lhs,if_ghc(-fhaskell-1.3))
1038 compile(nhcParser/ParseLib,lhs,if_ghc(-fhaskell-1.3))
1039 compile(nhcParser/ScopeLib,lhs,)
1040 compile(nhcParser/StrName,lhs,)
1041 compile(nhcParser/StrSyntax,lhs,)
1042 compile(nhcParser/Syntax,lhs,)
1043 compile(nhcParser/SyntaxPos,lhs,)
1044 compile(nhcParser/Tree234,lhs,)
1045
1046 compile(interpreter/ToPrefix,lhs,if_ghc(-fhaskell-1.3))
1047 compile(interpreter/UnsafeCoerce,lhs,if_ghc(-nohi)) /* NB: no interface file, please! */
1048 compile(interpreter/Dynamic,lhs,)
1049 compile(interpreter/Interpreter,lhs,if_ghc(-fvia-C -fhaskell-1.3))
1050 compile(interpreter/MkInterface,lhs,)
1051 compile(interpreter/GHCIMonad,lhs,if_ghc(-fvia-C -fhaskell-1.3))
1052 compile(interpreter/FullEnv,lhs,if_ghc(-fhaskell-1.3))
1053 compile(interpreter/Command,lhs,)
1054 compile(interpreter/GHCIFlags,lhs,)
1055 compile(interpreter/GHCInterface,lhs,-H40m if_ghc(-fhaskell-1.3))
1056 compile(interpreter/GHCI,lhs,if_ghc(-fhaskell-1.3))
1057 compile(interpreter/GHCICore,lhs,if_ghc(-fhaskell-1.3))
1058
1059 # Just using standard macro doesn't use the #include then compiling the
1060 # .hc file.
1061
1062 HaskellCompileWithExtraFlags(interpreter/Dld,lhs,hc,-fvia-C -C -fhaskell-1.3,)
1063 HaskellCompileWithExtraFlags_Recursive(interpreter/Dld,hc,o,-c,'-#include"$(DLD_INCLUDE)"')
1064
1065 # (There's gotta be a cleaner way of doing this but only one person in
1066 #  the entire world understands Jmakefiles well enough to use them
1067 #  effectively.)
1068
1069 # some c-as-asm level hacks
1070 # also needs a hand-hacked interface file
1071 interpreter/DldHacks.o: interpreter/DldHacks.lhc
1072         $(RM) interpreter/DldHacks.hc interpreter/DldHacks.o
1073         lit2pgm interpreter/DldHacks.lhc
1074         $(GHC) -c $(GHC_FLAGS) interpreter/DldHacks.hc
1075
1076 interpreter/DldC.o:     interpreter/DldC.lc
1077         $(RM) interpreter/DldC.c interpreter/DldC.o
1078         lit2pgm interpreter/DldC.lc
1079         $(GHC) -c $(GHC_FLAGS) interpreter/DldC.c -I$(DLD_DIR) -optcO-DNON_POSIX_SOURCE
1080
1081 /* Does not work for a subdir ... (Sigh) 
1082 NormalLibraryTarget($(DLD_DIR)/libdld,$(DLD_OBJS_O))
1083 */
1084 all :: dld/libdld.a
1085 clean ::
1086         $(RM) dld/libdld.a
1087 dld/libdld.a :: $(DLD_OBJS_O)
1088         $(RM) $@
1089         $(AR) $@ $(DLD_OBJS_O)
1090         $(RANLIB) $@
1091
1092 # To improve loading speed, we generate some C programs which contain
1093 # references to all symbols in the libraries we link with.
1094
1095 # ToDo: remove the appel dependency.
1096
1097 MY_TOP = ..
1098 MY_LIB = $(MY_TOP)/lib
1099 MY_RTS = $(MY_TOP)/runtime
1100
1101 interpreter/prelude.o: $(MY_LIB)/libHS.a makeSymbolList.prl
1102         $(RM) interpreter/prelude.c interpreter/prelude.o
1103         nm -p $(MY_LIB)/libHS.a | perl makeSymbolList.prl > interpreter/prelude.c
1104         $(GHC) -c $(GHC_FLAGS) interpreter/prelude.c
1105
1106 interpreter/runtime.o: $(MY_RTS)/libHSrts.a $(MY_RTS)/libHSclib.a makeSymbolList.prl
1107         $(RM) interpreter/runtime.c interpreter/runtime.o
1108         nm -p $(MY_RTS)/libHSrts.a $(MY_RTS)/libHSclib.a | perl makeSymbolList.prl > interpreter/runtime.c
1109         $(GHC) -c $(GHC_FLAGS) interpreter/runtime.c
1110
1111 #endif /* GHCI */
1112
1113 /* for convenience in cross-compiling */
1114 objs:: $(ALLOBJS)
1115
1116 /* *** parser ************************************************* */
1117
1118 YACC_OPTS = -d
1119 CC_OPTS = -IyaccParser -I. -I$(COMPINFO_DIR)
1120
1121 /* add to these on the command line with, e.g., EXTRA_YACC_OPTS=-v */
1122
1123 #if BuildDataParallelHaskell == YES
1124 D_DPH = -DDPH
1125 #endif
1126
1127 XCOMM D_DEBUG = -DDEBUG
1128
1129 CPP_DEFINES = $(D_DEBUG) $(D_DPH)
1130
1131 HSP_SRCS_C = /* yaccParser/main.c */            \
1132                 yaccParser/atype.c              \
1133                 yaccParser/binding.c            \
1134                 yaccParser/coresyn.c            \
1135                 yaccParser/entidt.c             \
1136                 yaccParser/finfot.c             \
1137                 yaccParser/hpragma.c            \
1138                 yaccParser/hslexer.c            \
1139                 yaccParser/hsparser.tab.c       \
1140                 yaccParser/id.c                 \
1141                 yaccParser/import_dirlist.c     \
1142                 yaccParser/infix.c              \
1143                 yaccParser/list.c               \
1144                 yaccParser/literal.c            \
1145                 yaccParser/pbinding.c           \
1146                 /* yaccParser/printtree.c */    \
1147                 yaccParser/syntax.c             \
1148                 yaccParser/tree.c               \
1149                 yaccParser/ttype.c              \
1150                 yaccParser/type2context.c       \
1151                 yaccParser/util.c
1152
1153 HSP_OBJS_O = /* yaccParser/main.o */            \
1154                 yaccParser/atype.o              \
1155                 yaccParser/binding.o            \
1156                 yaccParser/coresyn.o            \
1157                 yaccParser/entidt.o             \
1158                 yaccParser/finfot.o             \
1159                 yaccParser/hpragma.o            \
1160                 yaccParser/hslexer.o            \
1161                 yaccParser/hsparser.tab.o       \
1162                 yaccParser/id.o                 \
1163                 yaccParser/import_dirlist.o     \
1164                 yaccParser/infix.o              \
1165                 yaccParser/list.o               \
1166                 yaccParser/literal.o            \
1167                 yaccParser/pbinding.o           \
1168                 /* yaccParser/printtree.o */    \
1169                 yaccParser/syntax.o             \
1170                 yaccParser/tree.o               \
1171                 yaccParser/ttype.o              \
1172                 yaccParser/type2context.o       \
1173                 yaccParser/util.o
1174
1175 /* DPH uses some tweaked files; here are the lists again... */
1176
1177 #if BuildDataParallelHaskell == YES
1178 DPH_HSP_SRCS_C = yaccParser/atype.c             \
1179                 yaccParser/binding.c            \
1180                 yaccParser/coresyn.c            \
1181                 yaccParser/entidt.c             \
1182                 yaccParser/finfot.c             \
1183                 yaccParser/hpragma.c            \
1184                 yaccParser/hslexer-DPH.c        \
1185                 yaccParser/hsparser-DPH.tab.c   \
1186                 yaccParser/id.c                 \
1187                 yaccParser/import_dirlist.c     \
1188                 yaccParser/infix.c              \
1189                 yaccParser/list.c               \
1190                 yaccParser/literal.c            \
1191                 yaccParser/main.c               \
1192                 yaccParser/pbinding.c           \
1193                 yaccParser/printtree.c          \
1194                 yaccParser/syntax.c             \
1195                 yaccParser/tree-DPH.c           \
1196                 yaccParser/ttype-DPH.c          \
1197                 yaccParser/type2context.c       \
1198                 yaccParser/util.c
1199
1200 DPH_HSP_OBJS_O = yaccParser/atype.o             \
1201                 yaccParser/binding.o            \
1202                 yaccParser/coresyn.o            \
1203                 yaccParser/entidt.o             \
1204                 yaccParser/finfot.o             \
1205                 yaccParser/hpragma.o            \
1206                 yaccParser/hslexer-DPH.o        \
1207                 yaccParser/hsparser-DPH.tab.o   \
1208                 yaccParser/id.o                 \
1209                 yaccParser/import_dirlist.o     \
1210                 yaccParser/infix.o              \
1211                 yaccParser/list.o               \
1212                 yaccParser/literal.o            \
1213                 yaccParser/main.o               \
1214                 yaccParser/pbinding.o           \
1215                 yaccParser/printtree.o          \
1216                 yaccParser/syntax.o             \
1217                 yaccParser/tree-DPH.o           \
1218                 yaccParser/ttype-DPH.o          \
1219                 yaccParser/type2context.o       \
1220                 yaccParser/util.o
1221 #endif
1222
1223 /* this is for etags */
1224 REAL_HSP_SRCS_C = yaccParser/main.c             \
1225                 yaccParser/hschooks.c           \
1226                 yaccParser/hsclink.c            \
1227                 yaccParser/id.c                 \
1228                 yaccParser/util.c               \
1229                 yaccParser/syntax.c             \
1230                 yaccParser/type2context.c       \
1231                 yaccParser/import_dirlist.c     \
1232                 yaccParser/infix.c              \
1233                 yaccParser/printtree.c 
1234
1235 UgenNeededHere(all depend)
1236
1237 /* Most hsp files are in libhsp.a, so we can either make
1238    a standalone parser, or incorporate the files into
1239    the hsc compiler directly (WDP 94/10)
1240 */
1241 NormalLibraryTarget(hsp,$(HSP_OBJS_O))
1242
1243 /* We need the hsp program for hstags to work! */
1244 BuildPgmFromCFiles(hsp,yaccParser/printtree.o yaccParser/main.o,,libhsp.a)
1245 #if BuildDataParallelHaskell == YES
1246 BuildPgmFromCFiles(dphsp,$(DPH_HSP_OBJS_O),,)
1247 #endif
1248
1249 #if DoInstallGHCSystem == YES
1250 MakeDirectories(install, $(INSTLIBDIR_GHC))
1251 InstallBinaryTarget(hsp,$(INSTLIBDIR_GHC))
1252 # if BuildDataParallelHaskell == YES
1253 InstallBinaryTarget(dphsp,$(INSTLIBDIR_GHC))
1254 # endif
1255 #endif /* DoInstall... */
1256
1257 YaccRunWithExpectMsg(yaccParser/hsparser,12,2)
1258
1259 UgenTarget(yaccParser/atype)
1260 UgenTarget(yaccParser/binding)
1261 UgenTarget(yaccParser/coresyn)
1262 UgenTarget(yaccParser/entidt)
1263 UgenTarget(yaccParser/finfot)
1264 UgenTarget(yaccParser/literal)
1265 UgenTarget(yaccParser/list)
1266 UgenTarget(yaccParser/pbinding)
1267 UgenTarget(yaccParser/hpragma)
1268 UgenTarget(yaccParser/tree)
1269 UgenTarget(yaccParser/ttype)
1270
1271 #if BuildDataParallelHaskell == YES
1272 YaccRunWithExpectMsg(yaccParser/hsparser-DPH,12,4)
1273 UgenTarget(yaccParser/tree-DPH)
1274 UgenTarget(yaccParser/ttype-DPH)
1275 #endif
1276
1277 UGENS_C = yaccParser/atype.c    \
1278         yaccParser/binding.c    \
1279         yaccParser/coresyn.c    \
1280         yaccParser/entidt.c     \
1281         yaccParser/finfot.c     \
1282         yaccParser/literal.c    \
1283         yaccParser/list.c       \
1284         yaccParser/pbinding.c   \
1285         yaccParser/hpragma.c    \
1286         yaccParser/tree.c       \
1287         yaccParser/ttype.c
1288
1289 compile(yaccParser/UgenAll,lhs,if_ghc(-fvia-C))
1290 compile(yaccParser/UgenUtil,lhs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1291 compile(yaccParser/U_atype,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1292 compile(yaccParser/U_binding,hs,-H20m if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1293 compile(yaccParser/U_coresyn,hs,-H20m if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1294 compile(yaccParser/U_entidt,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1295 compile(yaccParser/U_finfot,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1296 compile(yaccParser/U_hpragma,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1297 compile(yaccParser/U_list,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1298 compile(yaccParser/U_literal,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1299 compile(yaccParser/U_pbinding,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1300 compile(yaccParser/U_tree,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1301 compile(yaccParser/U_treeHACK,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1302 compile(yaccParser/U_ttype,hs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -IyaccParser '-#include"hspincl.h"'))
1303
1304 /* finished with local macros */
1305 #undef compile
1306 #undef compile_rec
1307 #undef if_ghc
1308
1309 /* *** misc *************************************************** */
1310
1311 /* ?????????? ToDo: need parser depend/clean/etc in here ????? */
1312
1313 /* omit for now:
1314 LitDocRootTargetWithNamedOutput(root,lit,root-standalone)
1315 */
1316 /* LitDependTarget(root,lit): built-in to the above */
1317
1318 /* mkdependHS has to have the -i.../-I... subdirectory lists even if "ghc" does not
1319 */
1320 #if GhcWithHscBuiltViaC == NO
1321 DEPSRCS        = $(ALLSRCS_LHS) $(ALLSRCS_HS)
1322 MKDEPENDHS_OPTS= $(DASH_I_SUBDIR_LIST) -i$(SUBDIR_LIST) -I$(MAIN_INCLUDE_DIR) 
1323
1324 #else /* booting from .hc (no ghci) */
1325 DEPSRCS        = $(HSCSRCS_LHS) $(HSCSRCS_HS)
1326 MKDEPENDHS_OPTS= -o .hc $(DASH_I_SUBDIR_LIST) -i$(SUBDIR_LIST) -I$(MAIN_INCLUDE_DIR) 
1327 #endif /* booting from .hc files */
1328
1329 #if HaskellCompilerType != HC_USE_HC_FILES
1330     /* otherwise, the dependencies jeopardize our .hc files --
1331         which are all we have! */
1332 HaskellDependTarget( $(DEPSRCS) )
1333 #endif
1334
1335 ExtraStuffToClean( $(ALLOBJS) $(HSP_OBJS_O) )
1336 #if GhcWithHscBuiltViaC == YES
1337 ExtraStuffToClean( $(ALLHCS) )
1338 #endif
1339 ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )
1340
1341 ClearTagsFile()
1342 HsTagsTarget( $(ALLSRCS_LHS) )
1343 HSTAGS_OPTS = $(HC_OPTS) -I$(MAIN_INCLUDE_DIR)
1344
1345 /* count the number of lines in the source files */
1346 count_lines ::
1347         ./count_lines $(ALLSRCS_LHS) $(ALLSRCS_HS)
1348
1349 /* accumulate similar info about the sizes of object files */
1350 count_bytes ::
1351         ./count_bytes $(ALLSRCS_LHS) $(ALLSRCS_HS)
1352
1353 /* run the "resolve_ifaces" script (assuming you know what you are doing) */
1354 resolve_ifaces ::
1355         ./resolve_ifaces $(ALLINTS)