[project @ 1996-04-05 08:26:04 by partain]
[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
15 #define NoAllTargetForSubdirs
16 #define NoDocsTargetForSubdirs
17 #define NoInstallDocsTargetForSubdirs
18 #define NoDependTargetForSubdirs
19 #define NoInstallTargetForSubdirs
20 #define NoTagTargetForSubdirs
21
22 /* Suffix rules: we do not use them much at all in GHC.
23    We need some magic stuff (from suffixes-GEN.ljm) for
24    the parser files.
25 */
26 SuffixRules_flexish()
27 SuffixRule_c_o()
28 LitSuffixRule(.lprl,.prl) /* for makeSymbolList.prl */
29
30 /* assume ALL source is in subdirectories one level below
31    they don't have Jmakefiles; this Jmakefile controls everything
32 */
33
34 SUBDIR_LIST = \ /* here they are, colon separated (for mkdependHS) */
35 utils:basicTypes:types:hsSyn:prelude:envs:rename:typecheck:deSugar:coreSyn:specialise:simplCore:stranal:stgSyn:simplStg:codeGen:nativeGen:absCSyn:main:reader:profiling:deforest:parser
36
37 #ifdef MainIncludeDir
38 MAIN_INCLUDE_DIR=MainIncludeDir
39 #else
40 MAIN_INCLUDE_DIR=$(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES)
41 #endif
42
43 /* helps to find GhcConstants.h in codeGen/CgCompInfo.lhs */
44 #ifdef CompInfoDir
45 COMPINFO_DIR=CompInfoDir
46 #else
47 COMPINFO_DIR=$(TOP_PWD)/$(CURRENT_DIR)/codeGen
48 #endif
49 /* nativeGen, elsewhere */
50 #ifdef NativeGenDir
51 NATIVEGEN_DIR=NativeGenDir
52 #else
53 NATIVEGEN_DIR=$(TOP_PWD)/$(CURRENT_DIR)/nativeGen
54 #endif
55
56 /* in order-of-passes order, utility modules at the end */
57
58 #define READERSRCS_HS   \
59 parser/U_constr.hs      \
60 parser/U_binding.hs     \
61 parser/U_pbinding.hs    \
62 parser/U_coresyn.hs     \
63 parser/U_entidt.hs      \
64 parser/U_hpragma.hs     \
65 parser/U_list.hs        \
66 parser/U_literal.hs     \
67 parser/U_maybe.hs       \
68 parser/U_either.hs      \
69 parser/U_qid.hs         \
70 parser/U_tree.hs        \
71 parser/U_ttype.hs
72
73 #define hsp_library libhsp.a
74
75 #define READERSRCS_LHS  \
76 parser/UgenUtil.lhs     \
77 parser/UgenAll.lhs      \
78 reader/ReadPrefix.lhs   \
79 reader/ReadPragmas.lhs  \
80 \
81 reader/PrefixSyn.lhs    \
82 reader/PrefixToHs.lhs   \
83 reader/RdrHsSyn.lhs     \
84 \
85 hsSyn/HsBinds.lhs  /* abstract Haskell syntax */ \
86 hsSyn/HsCore.lhs \
87 hsSyn/HsDecls.lhs \
88 hsSyn/HsExpr.lhs \
89 hsSyn/HsImpExp.lhs \
90 hsSyn/HsLit.lhs \
91 hsSyn/HsMatches.lhs \
92 hsSyn/HsPat.lhs \
93 hsSyn/HsPragmas.lhs \
94 hsSyn/HsTypes.lhs \
95 hsSyn/HsSyn.lhs
96
97 #define NOT_SO_BASICSRCS_LHS    \
98 basicTypes/FieldLabel.lhs       \
99 basicTypes/Id.lhs               \
100 basicTypes/IdInfo.lhs           \
101 basicTypes/IdUtils.lhs          \
102 basicTypes/Literal.lhs          \
103 basicTypes/Name.lhs             \
104 basicTypes/NameTypes.lhs        \
105 basicTypes/PprEnv.lhs           \
106 basicTypes/PragmaInfo.lhs       \
107 basicTypes/ProtoName.lhs        \
108 basicTypes/SrcLoc.lhs           \
109 basicTypes/UniqSupply.lhs       \
110 basicTypes/Unique.lhs           \
111 \
112 types/Class.lhs                 \
113 types/Kind.lhs                  \
114 types/PprType.lhs               \
115 types/TyCon.lhs                 \
116 types/TyVar.lhs                 \
117 types/Usage.lhs                 \
118 types/Type.lhs                  \
119 \
120 specialise/SpecEnv.lhs
121
122
123 #define RENAMERSRCS_LHS \
124 rename/RnPass1.lhs \
125 rename/RnPass2.lhs \
126 rename/RnPass3.lhs \
127 rename/RnPass4.lhs \
128 rename/RnHsSyn.lhs \
129 rename/RnUtils.lhs \
130 rename/RnMonad12.lhs \
131 rename/RnMonad3.lhs \
132 rename/RnMonad4.lhs \
133 rename/RnBinds4.lhs \
134 rename/RnExpr4.lhs \
135 rename/Rename.lhs
136
137 #define TCSRCS_LHS \
138 typecheck/TcHsSyn.lhs \
139 typecheck/GenSpecEtc.lhs \
140 typecheck/Inst.lhs      \
141 typecheck/TcBinds.lhs \
142 typecheck/TcClassDcl.lhs \
143 typecheck/TcDefaults.lhs \
144 typecheck/TcDeriv.lhs \
145 typecheck/TcExpr.lhs \
146 typecheck/TcGenDeriv.lhs \
147 typecheck/TcGRHSs.lhs \
148 typecheck/TcIfaceSig.lhs \
149 typecheck/TcInstDcls.lhs \
150 typecheck/TcInstUtil.lhs \
151 typecheck/TcMatches.lhs \
152 typecheck/TcModule.lhs \
153 typecheck/TcMonad.lhs \
154 typecheck/TcEnv.lhs \
155 typecheck/TcKind.lhs \
156 typecheck/TcType.lhs \
157 typecheck/TcMonoType.lhs \
158 typecheck/TcPat.lhs \
159 typecheck/TcSimplify.lhs \
160 typecheck/TcTyClsDecls.lhs \
161 typecheck/TcTyDecls.lhs \
162 typecheck/Typecheck.lhs \
163 typecheck/Unify.lhs
164
165 /*
166 typecheck/TcPragmas.lhs \
167 */
168
169 #define DSSRCS_LHS \
170 deSugar/Desugar.lhs \
171 deSugar/Match.lhs \
172 deSugar/MatchCon.lhs \
173 deSugar/MatchLit.lhs \
174 deSugar/DsBinds.lhs \
175 deSugar/DsCCall.lhs \
176 deSugar/DsExpr.lhs \
177 deSugar/DsGRHSs.lhs \
178 deSugar/DsHsSyn.lhs \
179 deSugar/DsListComp.lhs \
180 deSugar/DsMonad.lhs \
181 deSugar/DsUtils.lhs \
182 \
183 coreSyn/CoreLift.lhs \
184 coreSyn/CoreLint.lhs
185
186 #if GhcWithDeforester != YES
187 #define __omit_deforester_flag -DOMIT_DEFORESTER=1
188 #define DEFORESTER_SRCS_LHS /*none*/
189 #else
190 #define __omit_deforester_flag /*nope*/
191 #define DEFORESTER_SRCS_LHS \
192 deforest/DefSyn.lhs \
193 deforest/Core2Def.lhs \
194 deforest/Def2Core.lhs \
195 deforest/Deforest.lhs \
196 deforest/DefUtils.lhs \
197 deforest/DefExpr.lhs \
198 deforest/Cyclic.lhs \
199 deforest/TreelessForm.lhs
200 #endif /* GhcWithDeforester */
201
202 #define SIMPL_SRCS_LHS \
203 coreSyn/AnnCoreSyn.lhs \
204 coreSyn/FreeVars.lhs \
205 \
206 specialise/Specialise.lhs \
207 specialise/SpecUtils.lhs \
208 \
209 simplCore/SimplCase.lhs \
210 simplCore/SimplEnv.lhs \
211 simplCore/SimplMonad.lhs \
212 simplCore/SimplPgm.lhs \
213 simplCore/SimplUtils.lhs \
214 simplCore/SimplVar.lhs \
215 simplCore/Simplify.lhs \
216 \
217 simplCore/LiberateCase.lhs \
218 \
219 simplCore/ConFold.lhs \
220 simplCore/FloatIn.lhs \
221 simplCore/FloatOut.lhs \
222 simplCore/SAT.lhs \
223 simplCore/SATMonad.lhs \
224 simplCore/SetLevels.lhs \
225 simplCore/SimplCore.lhs \
226 simplCore/OccurAnal.lhs \
227 simplCore/FoldrBuildWW.lhs \
228 simplCore/AnalFBWW.lhs \
229 \
230 stranal/StrictAnal.lhs \
231 stranal/SaLib.lhs \
232 stranal/SaAbsInt.lhs \
233 stranal/WwLib.lhs \
234 stranal/WorkWrap.lhs \
235 \
236 profiling/SCCauto.lhs DEFORESTER_SRCS_LHS
237
238 #define STG_SRCS_LHS \
239 stgSyn/CoreToStg.lhs \
240 stgSyn/StgSyn.lhs \
241 stgSyn/StgUtils.lhs \
242 stgSyn/StgLint.lhs \
243 profiling/SCCfinal.lhs \
244 \
245 simplStg/SatStgRhs.lhs \
246 simplStg/LambdaLift.lhs \
247 simplStg/StgVarInfo.lhs \
248 simplStg/UpdAnal.lhs \
249 simplStg/StgStats.lhs \
250 simplStg/StgSATMonad.lhs \
251 simplStg/StgSAT.lhs \
252 simplStg/SimplStg.lhs
253
254 #define BACKSRCS_LHS \
255 absCSyn/AbsCUtils.lhs \
256 absCSyn/AbsCSyn.lhs \
257 absCSyn/CLabel.lhs \
258 absCSyn/Costs.lhs \
259 absCSyn/HeapOffs.lhs \
260 absCSyn/PprAbsC.lhs \
261 \
262 codeGen/CodeGen.lhs \
263 codeGen/ClosureInfo.lhs \
264 codeGen/SMRep.lhs \
265 codeGen/CgConTbls.lhs \
266 codeGen/CgMonad.lhs \
267 codeGen/CgUsages.lhs \
268 codeGen/CgHeapery.lhs \
269 codeGen/CgStackery.lhs \
270 codeGen/CgExpr.lhs \
271 codeGen/CgCase.lhs \
272 codeGen/CgLetNoEscape.lhs \
273 codeGen/CgTailCall.lhs \
274 codeGen/CgClosure.lhs \
275 codeGen/CgCon.lhs \
276 codeGen/CgRetConv.lhs \
277 codeGen/CgBindery.lhs \
278 codeGen/CgUpdate.lhs
279
280 #if GhcWithNativeCodeGen == NO || GhcWithHscBuiltViaC == YES
281     /* if building via C, we *assume* that it is the
282        distributed C files, which do not have a native-code
283        generator in them
284     */
285 # define __omit_ncg_maybe -DOMIT_NATIVE_CODEGEN=1
286 # define NATIVEGEN_SRCS_LHS /*none*/
287 #else
288 # define __omit_ncg_maybe /*none*/
289
290 # define NATIVEGEN_SRCS_LHS \
291 nativeGen/AbsCStixGen.lhs \
292 nativeGen/AsmCodeGen.lhs \
293 nativeGen/AsmRegAlloc.lhs \
294 nativeGen/MachCode.lhs \
295 nativeGen/MachMisc.lhs \
296 nativeGen/MachRegs.lhs \
297 nativeGen/PprMach.lhs \
298 nativeGen/RegAllocInfo.lhs \
299 nativeGen/Stix.lhs \
300 nativeGen/StixInfo.lhs \
301 nativeGen/StixInteger.lhs \
302 nativeGen/StixPrim.lhs \
303 nativeGen/StixMacro.lhs
304 #endif
305
306 #define UTILSRCS_LHS \
307 utils/Argv.lhs \
308 utils/Bag.lhs \
309 utils/BitSet.lhs \
310 utils/CharSeq.lhs \
311 utils/Digraph.lhs \
312 utils/FiniteMap.lhs \
313 utils/ListSetOps.lhs \
314 utils/MatchEnv.lhs \
315 utils/Maybes.lhs \
316 utils/OrdList.lhs \
317 utils/Outputable.lhs \
318 utils/PprStyle.lhs \
319 utils/Pretty.lhs \
320 utils/SST.lhs \
321 utils/UniqFM.lhs \
322 utils/UniqSet.lhs \
323 utils/Unpretty.lhs \
324 utils/Util.lhs
325
326 #define MAIN_SRCS_LHS \
327 main/MainMonad.lhs \
328 main/CmdLineOpts.lhs \
329 main/ErrUtils.lhs \
330 main/Main.lhs
331
332 /* 
333 main/MkIface.lhs \
334 */
335
336 #define VBASICSRCS_LHS \
337 prelude/PrelMods.lhs \
338 prelude/PrimRep.lhs \
339 prelude/PrimOp.lhs \
340 prelude/TysPrim.lhs \
341 prelude/TysWiredIn.lhs \
342 prelude/PrelVals.lhs \
343 prelude/PrelInfo.lhs \
344 \
345 absCSyn/CStrings.lhs \
346 codeGen/CgCompInfo.lhs \
347 coreSyn/CoreSyn.lhs \
348 coreSyn/CoreUnfold.lhs \
349 coreSyn/CoreUtils.lhs \
350 coreSyn/PprCore.lhs \
351 profiling/CostCentre.lhs \
352 simplCore/BinderInfo.lhs \
353 simplCore/MagicUFs.lhs
354
355 ALLSRCS_HS = READERSRCS_HS
356 ALLSRCS_LHS = /* all pieces of the compiler */ \
357 VBASICSRCS_LHS          \
358 NOT_SO_BASICSRCS_LHS    \
359 UTILSRCS_LHS            \
360 MAIN_SRCS_LHS           \
361 READERSRCS_LHS          \
362 RENAMERSRCS_LHS         \
363 TCSRCS_LHS              \
364 DSSRCS_LHS              \
365 SIMPL_SRCS_LHS          \
366 STG_SRCS_LHS            \
367 BACKSRCS_LHS NATIVEGEN_SRCS_LHS
368
369 /*
370 */
371 /* NB: all the ones that may be empty (e.g., NATIVEGEN_SRCS_LHS)
372         need to be on the last line.
373 */
374
375 /* should't use these fancy `make' things, really */
376 ALLHCS =$(ALLSRCS_LHS:.lhs=.hc) $(ALLSRCS_HS:.hs=.hc)
377 ALLOBJS=$(ALLSRCS_LHS:.lhs=.o)  $(ALLSRCS_HS:.hs=.o)
378 ALLINTS=$(ALLSRCS_LHS:.lhs=.hi) $(ALLSRCS_HS:.hs=.hi)
379
380 .PRECIOUS: $(ALLINTS)
381
382 #if GhcWithHscDebug == YES
383 # define use_DDEBUG -DDEBUG
384 #else
385 # define use_DDEBUG /*nothing*/
386 #endif
387
388 #if GhcWithHscOptimised == YES
389 #define __version_sensitive_flags -DUSE_ATTACK_PRAGMAS -fshow-pragma-name-errs -fomit-reexported-instances -fshow-import-specs
390 #else
391 #define __version_sensitive_flags -fomit-reexported-instances
392 #endif
393
394 /* avoid use of AllProjectsHcOpts; then put in HcMaxHeapFlag "by hand" */
395 #undef  AllProjectsHcOpts
396 #define AllProjectsHcOpts /**/
397
398 HC_OPTS = -cpp HcMaxHeapFlag -fhaskell-1.3 -fglasgow-exts -DCOMPILING_GHC \
399         -fomit-derived-read \
400         -I. -i$(SUBDIR_LIST) \
401         use_DDEBUG __version_sensitive_flags __omit_ncg_maybe __omit_deforester_flag
402
403 #undef __version_sensitive_flags
404 #undef __omit_ncg_maybe
405 #undef __omit_deforester_flag
406
407 #if GhcWithHscBuiltViaC == YES /* not using a Haskell compiler */
408
409 hcs:: $(ALLHCS)
410
411 # if HaskellCompilerType == HC_USE_HC_FILES
412 HC = $(GHC) /* uses the driver herein */
413 # endif
414
415 #endif /* using .hc files */
416
417 /*
418     -DCOMPILING_GHC
419         Used when compiling GHC.  Some GHC utility modules are
420         *also* part of the GHC library.  There are a few bits
421         of those modules that only apply to GHC itself and
422         should not be in the library stuff.  We use this
423         CPP thing to isolate those bits.
424 */
425
426 BuildPgmFromHaskellModules(hsc,$(ALLOBJS) parser/hsclink.o parser/hschooks.o,,libhsp.a)
427
428 #if DoInstallGHCSystem == YES
429 MakeDirectories(install, $(INSTLIBDIR_GHC))
430 InstallBinaryTarget(hsc,$(INSTLIBDIR_GHC))
431 #endif
432
433 /* set up for going either to .hc or to .o files */
434 #if GhcWithHscBuiltViaC == YES
435
436 /*OLD:SuffixRule_hc_o() */
437
438 # if HaskellCompilerType == HC_USE_HC_FILES
439     /* if we do not, we never try to compile .lhs files;
440         we *blast* the macro we would normally use (HACK) (WDP 94/12)
441      */
442
443 #  undef HaskellCompileWithSpecifiedFlags
444 #  define HaskellCompileWithSpecifiedFlags(module,isuf,osuf,flags)      @@\
445 module.osuf : module.isuf                                               \
446 _body_HaskellCompileWithSpecifiedFlags(module.isuf,module.osuf,module,isuf,flags)
447
448 #  define compile(module,isuf,extra_flags) \
449 HaskellCompileWithExtraFlags(module,hc,o,-c,extra_flags)
450
451 #  define compile_rec(module,isuf,extra_flags) \
452 HaskellCompileWithExtraFlags_Recursive(module,hc,o,-c,extra_flags)
453
454 # else /* we do! */
455
456 #  define compile(module,isuf,extra_flags) \
457 HaskellCompileWithExtraFlags(module,isuf,hc,-C,extra_flags)
458
459 #  define compile_rec(module,isuf,extra_flags) \
460 HaskellCompileWithExtraFlags_Recursive(module,isuf,hc,-C,extra_flags)
461
462 # endif /* ... == HC_USE_HC_FILES */
463
464 #else /* ! booting from C */
465
466 # define compile(module,isuf,extra_flags) \
467 HaskellCompileWithExtraFlags(module,isuf,o,-c,extra_flags)
468
469 # define compile_rec(module,isuf,extra_flags) \
470 HaskellCompileWithExtraFlags_Recursive(module,isuf,o,-c,extra_flags)
471
472 #endif /* ! booting from C */
473
474 #define if_ghc(x) x
475 #if GhcBuilderVersion >= 26
476 #  define if_ghc26(x) x
477 #else
478 #  define if_ghc26(x) /*nothing*/
479 #endif
480
481 /* OK, here we go: */
482
483 utils/Ubiq.hi : utils/Ubiq.lhi
484         $(GHC_UNLIT) utils/Ubiq.lhi utils/Ubiq.hi
485
486 absCSyn/AbsCLoop.hi : absCSyn/AbsCLoop.lhi
487         $(GHC_UNLIT) absCSyn/AbsCLoop.lhi absCSyn/AbsCLoop.hi
488 basicTypes/IdLoop.hi : basicTypes/IdLoop.lhi
489         $(GHC_UNLIT) basicTypes/IdLoop.lhi basicTypes/IdLoop.hi
490 basicTypes/NameLoop.hi : basicTypes/NameLoop.lhi
491         $(GHC_UNLIT) basicTypes/NameLoop.lhi basicTypes/NameLoop.hi
492 codeGen/CgLoop1.hi : codeGen/CgLoop1.lhi
493         $(GHC_UNLIT) codeGen/CgLoop1.lhi codeGen/CgLoop1.hi
494 codeGen/CgLoop2.hi : codeGen/CgLoop2.lhi
495         $(GHC_UNLIT) codeGen/CgLoop2.lhi codeGen/CgLoop2.hi
496 deSugar/DsLoop.hi : deSugar/DsLoop.lhi
497         $(GHC_UNLIT) deSugar/DsLoop.lhi deSugar/DsLoop.hi
498 hsSyn/HsLoop.hi : hsSyn/HsLoop.lhi
499         $(GHC_UNLIT) hsSyn/HsLoop.lhi hsSyn/HsLoop.hi
500 nativeGen/NcgLoop.hi : nativeGen/NcgLoop.lhi
501         $(GHC_UNLIT) nativeGen/NcgLoop.lhi nativeGen/NcgLoop.hi
502 prelude/PrelLoop.hi : prelude/PrelLoop.lhi
503         $(GHC_UNLIT) prelude/PrelLoop.lhi prelude/PrelLoop.hi
504 reader/RdrLoop.hi : reader/RdrLoop.lhi
505         $(GHC_UNLIT) reader/RdrLoop.lhi reader/RdrLoop.hi
506 rename/RnLoop.hi : rename/RnLoop.lhi
507         $(GHC_UNLIT) rename/RnLoop.lhi rename/RnLoop.hi
508 simplCore/SmplLoop.hi : simplCore/SmplLoop.lhi
509         $(GHC_UNLIT) simplCore/SmplLoop.lhi simplCore/SmplLoop.hi
510 typecheck/TcMLoop.hi : typecheck/TcMLoop.lhi
511         $(GHC_UNLIT) typecheck/TcMLoop.lhi typecheck/TcMLoop.hi
512 typecheck/TcLoop.hi : typecheck/TcLoop.lhi
513         $(GHC_UNLIT) typecheck/TcLoop.lhi typecheck/TcLoop.hi
514 types/TyLoop.hi : types/TyLoop.lhi
515         $(GHC_UNLIT) types/TyLoop.lhi types/TyLoop.hi
516
517 compile(absCSyn/AbsCUtils,lhs,)
518 compile(absCSyn/CStrings,lhs,)
519 compile(absCSyn/CLabel,lhs,)
520 compile(absCSyn/Costs,lhs,)
521 compile(absCSyn/HeapOffs,lhs,)
522 compile(absCSyn/PprAbsC,lhs,)
523 compile(absCSyn/AbsCSyn,lhs,if_ghc(-fno-omit-reexported-instances))
524
525 compile(hsSyn/HsBinds,lhs,)
526 compile(hsSyn/HsCore,lhs,)
527 compile(hsSyn/HsDecls,lhs,)
528 compile(hsSyn/HsExpr,lhs,)
529 compile(hsSyn/HsImpExp,lhs,)
530 compile(hsSyn/HsLit,lhs,)
531 compile(hsSyn/HsMatches,lhs,)
532 compile(hsSyn/HsPat,lhs,)
533 compile(hsSyn/HsPragmas,lhs,)
534 compile(hsSyn/HsTypes,lhs,)
535 compile(hsSyn/HsSyn,lhs,if_ghc(-fno-omit-reexported-instances))
536
537 compile(basicTypes/FieldLabel,lhs,)
538 compile(basicTypes/Id,lhs,)
539 compile(basicTypes/IdInfo,lhs,-K2m)
540 compile(basicTypes/IdUtils,lhs,)
541 compile(basicTypes/Literal,lhs,)
542 compile(basicTypes/Name,lhs,)
543 compile(basicTypes/NameTypes,lhs,)
544 compile(basicTypes/PprEnv,lhs,)
545 compile(basicTypes/PragmaInfo,lhs,)
546 compile(basicTypes/ProtoName,lhs,)
547 compile(basicTypes/SrcLoc,lhs,)
548 compile(basicTypes/UniqSupply,lhs,)
549 compile(basicTypes/Unique,lhs,)
550
551 compile(codeGen/CgBindery,lhs,)
552 compile(codeGen/CgCase,lhs,)
553 compile(codeGen/CgClosure,lhs,)
554 compile(codeGen/CgCompInfo,lhs,-I$(COMPINFO_DIR))
555 compile(codeGen/CgCon,lhs,)
556 compile(codeGen/CgConTbls,lhs,)
557 compile(codeGen/CgExpr,lhs,)
558 compile(codeGen/CgHeapery,lhs,)
559 compile(codeGen/CgLetNoEscape,lhs,)
560 compile(codeGen/CgMonad,lhs,)
561 compile(codeGen/CgRetConv,lhs,)
562 compile(codeGen/CgStackery,lhs,)
563 compile(codeGen/CgTailCall,lhs,)
564 compile(codeGen/CgUpdate,lhs,)
565 compile(codeGen/CgUsages,lhs,)
566 compile(codeGen/ClosureInfo,lhs,)
567 compile(codeGen/CodeGen,lhs,)
568 compile(codeGen/SMRep,lhs,)
569
570 compile(coreSyn/AnnCoreSyn,lhs,if_ghc(-fno-omit-reexported-instances))
571 compile(coreSyn/CoreUtils,lhs,)
572 compile(coreSyn/CoreLift,lhs,)
573 compile(coreSyn/CoreLint,lhs,)
574 compile(coreSyn/CoreSyn,lhs,)
575 compile(coreSyn/PprCore,lhs,)
576 compile(coreSyn/CoreUnfold,lhs,)
577 compile(coreSyn/FreeVars,lhs,)
578
579 compile(deSugar/Desugar,lhs,)
580 compile(deSugar/DsBinds,lhs,)
581 compile(deSugar/DsCCall,lhs,)
582 compile(deSugar/DsExpr,lhs,)
583 compile(deSugar/DsGRHSs,lhs,)
584 compile(deSugar/DsHsSyn,lhs,)
585 compile(deSugar/DsListComp,lhs,)
586 compile(deSugar/DsMonad,lhs,)
587 compile(deSugar/DsUtils,lhs,)
588 compile(deSugar/Match,lhs,)
589 compile(deSugar/MatchCon,lhs,)
590 compile(deSugar/MatchLit,lhs,)
591
592 compile(main/CmdLineOpts,lhs,if_ghc(-fvia-C))
593 compile(main/ErrUtils,lhs,)
594 compile(main/Main,lhs,if_ghc(-fvia-C))
595 compile(main/MainMonad,lhs,)
596 compile(main/MkIface,lhs,)
597
598 #if GhcWithNativeCodeGen == YES
599 compile(nativeGen/AbsCStixGen,lhs,)
600 compile(nativeGen/AsmCodeGen,lhs,-I$(COMPINFO_DIR))
601 compile(nativeGen/AsmRegAlloc,lhs,-I$(COMPINFO_DIR))
602 compile(nativeGen/MachCode,lhs,)
603 compile(nativeGen/MachMisc,lhs,)
604 compile(nativeGen/MachRegs,lhs,)
605 compile(nativeGen/PprMach,lhs,)
606 compile(nativeGen/RegAllocInfo,lhs,)
607 compile(nativeGen/Stix,lhs,)
608 compile(nativeGen/StixInfo,lhs,-I$(NATIVEGEN_DIR))
609 compile(nativeGen/StixInteger,lhs,)
610 compile(nativeGen/StixMacro,lhs,-I$(NATIVEGEN_DIR))
611 compile(nativeGen/StixPrim,lhs,)
612 #endif
613
614 compile(prelude/PrelInfo,lhs,)
615 compile(prelude/PrelMods,lhs,)
616 compile(prelude/PrelVals,lhs,)
617 compile(prelude/PrimRep,lhs,-I$(COMPINFO_DIR))
618 compile(prelude/PrimOp,lhs,-K3m -H10m)
619 compile(prelude/TysPrim,lhs,)
620 compile(prelude/TysWiredIn,lhs,)
621
622 compile(profiling/SCCauto,lhs,)
623 compile(profiling/SCCfinal,lhs,)
624 compile(profiling/CostCentre,lhs,)
625
626 compile(reader/PrefixSyn,lhs,)
627 compile(reader/PrefixToHs,lhs,)
628 compile(reader/ReadPrefix,lhs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -Iparser '-#include"hspincl.h"'))
629 compile(reader/ReadPragmas,lhs,)
630 compile(reader/RdrHsSyn,lhs,)
631
632 compile(rename/Rename,lhs,)
633 compile(rename/RnPass1,lhs,)
634 compile(rename/RnPass2,lhs,)
635 compile(rename/RnPass3,lhs,)
636 compile(rename/RnPass4,lhs,)
637 compile(rename/RnUtils,lhs,)
638 compile(rename/RnHsSyn,lhs,)
639 compile(rename/RnBinds4,lhs,)
640 compile(rename/RnExpr4,lhs,)
641 compile(rename/RnMonad12,lhs,)
642 compile(rename/RnMonad3,lhs,)
643 compile(rename/RnMonad4,lhs,)
644
645 compile(simplCore/BinderInfo,lhs,)
646 compile(simplCore/ConFold,lhs,)
647 compile(simplCore/FloatIn,lhs,)
648 compile(simplCore/FloatOut,lhs,)
649 compile(simplCore/LiberateCase,lhs,)
650 compile(simplCore/MagicUFs,lhs,)
651 compile(simplCore/OccurAnal,lhs,)
652
653 compile(simplCore/AnalFBWW,lhs,)
654 compile(simplCore/FoldrBuildWW,lhs,)
655
656 compile(simplCore/SAT,lhs,)
657 compile(simplCore/SATMonad,lhs,)
658 compile(simplCore/SetLevels,lhs,)
659 compile(simplCore/SimplCase,lhs,)
660 compile(simplCore/SimplCore,lhs,)
661 compile(simplCore/SimplEnv,lhs,)
662 compile(simplCore/SimplMonad,lhs,)
663 compile(simplCore/SimplPgm,lhs,)
664 compile(simplCore/SimplUtils,lhs,)
665 compile(simplCore/SimplVar,lhs,)
666 compile(simplCore/Simplify,lhs,)
667
668 compile(simplStg/SatStgRhs,lhs,)
669 compile(simplStg/LambdaLift,lhs,)
670 compile(simplStg/StgVarInfo,lhs,)
671 compile(simplStg/UpdAnal,lhs,)
672 compile(simplStg/StgStats,lhs,)
673 compile(simplStg/StgSATMonad,lhs,)
674 compile(simplStg/StgSAT,lhs,)
675 compile(simplStg/SimplStg,lhs,)
676
677 #if GhcWithDeforester == YES
678 compile(deforest/Core2Def,lhs,)
679 compile(deforest/Cyclic,lhs,)
680 compile(deforest/Def2Core,lhs,)
681 compile(deforest/DefExpr,lhs,)
682 compile(deforest/DefSyn,lhs,)
683 compile(deforest/DefUtils,lhs,)
684 compile(deforest/Deforest,lhs,)
685 compile(deforest/TreelessForm,lhs,)
686 #endif
687
688 compile(specialise/Specialise,lhs,)
689 compile(specialise/SpecEnv,lhs,)
690 compile(specialise/SpecUtils,lhs,)
691
692 compile(stgSyn/CoreToStg,lhs,)
693 compile(stgSyn/StgUtils,lhs,)
694 compile(stgSyn/StgLint,lhs,)
695 compile(stgSyn/StgSyn,lhs,if_ghc(-fno-omit-reexported-instances))
696
697 compile(stranal/SaAbsInt,lhs,)
698 compile(stranal/SaLib,lhs,)
699 compile(stranal/StrictAnal,lhs,)
700 compile(stranal/WorkWrap,lhs,)
701 compile(stranal/WwLib,lhs,)
702
703 compile(typecheck/GenSpecEtc,lhs,)
704 compile(typecheck/Inst,lhs,)
705 compile(typecheck/TcHsSyn,lhs,)
706 compile(typecheck/TcBinds,lhs,)
707 compile(typecheck/TcClassDcl,lhs,)
708 compile(typecheck/TcDefaults,lhs,)
709 compile(typecheck/TcDeriv,lhs,)
710 compile(typecheck/TcExpr,lhs,)
711 compile(typecheck/TcGRHSs,lhs,)
712 compile(typecheck/TcGenDeriv,lhs,)
713 compile(typecheck/TcIfaceSig,lhs,)
714 compile(typecheck/TcInstDcls,lhs,)
715 compile(typecheck/TcInstUtil,lhs,)
716 compile(typecheck/TcMatches,lhs,)
717 compile(typecheck/TcModule,lhs,)
718 compile(typecheck/TcMonad,lhs,)
719 compile(typecheck/TcKind,lhs,)
720 compile(typecheck/TcType,lhs,)
721 compile(typecheck/TcEnv,lhs,)
722 compile(typecheck/TcMonoType,lhs,)
723 compile(typecheck/TcPat,lhs,)
724 compile(typecheck/TcPragmas,lhs,)
725 compile(typecheck/TcSimplify,lhs,)
726 compile(typecheck/TcTyClsDecls,lhs,)
727 compile(typecheck/TcTyDecls,lhs,)
728 compile(typecheck/Typecheck,lhs,)
729 compile(typecheck/Unify,lhs,)
730
731 compile(types/Class,lhs,)
732 compile(types/Kind,lhs,)
733 compile(types/PprType,lhs,)
734 compile(types/TyCon,lhs,)
735 compile(types/TyVar,lhs,)
736 compile(types/Usage,lhs,)
737 compile(types/Type,lhs,)
738
739 compile(utils/Argv,lhs,if_ghc(-fvia-C))
740 compile(utils/Bag,lhs,)
741 compile(utils/BitSet,lhs,if_ghc26(-monly-4-regs))
742 compile(utils/CharSeq,lhs,if_ghc(-fvia-C)) /* uses stg_putc */
743 compile(utils/Digraph,lhs,)
744 compile(utils/FiniteMap,lhs,)
745 compile(utils/ListSetOps,lhs,)
746 compile(utils/Maybes,lhs,)
747 compile(utils/OrdList,lhs,)
748 compile(utils/Outputable,lhs,)
749 compile(utils/PprStyle,lhs,)
750 compile(utils/Pretty,lhs,)
751 compile(utils/SST,lhs,if_ghc(-fvia-C))
752 compile(utils/UniqFM,lhs,)
753 compile(utils/UniqSet,lhs,)
754 compile(utils/Unpretty,lhs,)
755 compile(utils/MatchEnv,lhs,)
756 compile(utils/Util,lhs,)
757
758 /* for convenience in cross-compiling */
759 objs:: $(ALLOBJS)
760
761 /* *** parser ************************************************* */
762
763 YACC_OPTS = -d
764 CC_OPTS = -Iparser -I. -I$(COMPINFO_DIR) -DUGEN_DEBUG=1 /*-DHSP_DEBUG=1*/ -g
765
766 /* add to these on the command line with, e.g., EXTRA_YACC_OPTS=-v */
767
768 XCOMM D_DEBUG = -DDEBUG
769
770 CPP_DEFINES = $(D_DEBUG)
771
772 HSP_SRCS_C =    parser/constr.c         \
773                 parser/binding.c        \
774                 parser/pbinding.c       \
775                 parser/coresyn.c        \
776                 parser/entidt.c         \
777                 parser/hpragma.c        \
778                 parser/hslexer.c        \
779                 parser/hsparser.tab.c   \
780                 parser/id.c             \
781                 parser/import_dirlist.c \
782                 parser/infix.c          \
783                 parser/list.c           \
784                 parser/literal.c        \
785                 parser/maybe.c          \
786                 parser/either.c         \
787                 parser/qid.c            \
788                 parser/syntax.c         \
789                 parser/tree.c           \
790                 parser/ttype.c          \
791                 parser/type2context.c   \
792                 parser/util.c
793
794 HSP_OBJS_O =    parser/constr.o         \
795                 parser/binding.o        \
796                 parser/pbinding.o       \
797                 parser/coresyn.o        \
798                 parser/entidt.o         \
799                 parser/hpragma.o        \
800                 parser/hslexer.o        \
801                 parser/hsparser.tab.o   \
802                 parser/id.o             \
803                 parser/import_dirlist.o \
804                 parser/infix.o          \
805                 parser/list.o           \
806                 parser/literal.o        \
807                 parser/maybe.o          \
808                 parser/either.o         \
809                 parser/qid.o            \
810                 parser/syntax.o         \
811                 parser/tree.o           \
812                 parser/ttype.o          \
813                 parser/type2context.o   \
814                 parser/util.o
815
816 /* this is for etags */
817 REAL_HSP_SRCS_C = parser/main.c         \
818                 parser/hschooks.c       \
819                 parser/hsclink.c        \
820                 parser/id.c             \
821                 parser/util.c           \
822                 parser/syntax.c         \
823                 parser/type2context.c   \
824                 parser/import_dirlist.c \
825                 parser/infix.c          \
826                 parser/printtree.c
827
828 UgenNeededHere(all depend)
829
830 /* Most hsp files are in libhsp.a, so we can either make
831    a standalone parser, or incorporate the files into
832    the hsc compiler directly (WDP 94/10)
833 */
834 NormalLibraryTarget(hsp,$(HSP_OBJS_O))
835
836 /* We need the hsp program for hstags to work! */
837 BuildPgmFromCFiles(hsp,parser/printtree.o parser/main.o,,libhsp.a)
838
839 #if DoInstallGHCSystem == YES
840 MakeDirectories(install, $(INSTLIBDIR_GHC))
841 InstallBinaryTarget(hsp,$(INSTLIBDIR_GHC))
842 #endif /* DoInstall... */
843
844 YaccRunWithExpectMsg(parser/hsparser,16,0)
845
846 UgenTarget(parser/constr)
847 UgenTarget(parser/binding)
848 UgenTarget(parser/pbinding)
849 UgenTarget(parser/coresyn)
850 UgenTarget(parser/entidt)
851 UgenTarget(parser/hpragma)
852 UgenTarget(parser/list)
853 UgenTarget(parser/literal)
854 UgenTarget(parser/maybe)
855 UgenTarget(parser/either)
856 UgenTarget(parser/qid)
857 UgenTarget(parser/tree)
858 UgenTarget(parser/ttype)
859
860 UGENS_C = parser/constr.c       \
861         parser/binding.c        \
862         parser/pbinding.c       \
863         parser/coresyn.c        \
864         parser/entidt.c         \
865         parser/literal.c        \
866         parser/list.c           \
867         parser/maybe.c          \
868         parser/either.c         \
869         parser/qid.c            \
870         parser/hpragma.c        \
871         parser/tree.c           \
872         parser/ttype.c
873
874 /* Putting the -#include"hspincl.h" option into the
875    PARSER_HS_OPTS line really does not work (it depends
876    on the 'make' that you use).
877 */
878 PARSER_HS_OPTS = if_ghc(-fvia-C -I$(COMPINFO_DIR) -Iparser)
879
880 compile(parser/UgenAll,lhs,if_ghc(-fvia-C))
881 compile(parser/UgenUtil,lhs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
882 compile(parser/U_constr,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
883 compile(parser/U_binding,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
884 compile(parser/U_pbinding,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
885 compile(parser/U_coresyn,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
886 compile(parser/U_entidt,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
887 compile(parser/U_hpragma,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
888 compile(parser/U_list,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
889 compile(parser/U_literal,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
890 compile(parser/U_maybe,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
891 compile(parser/U_either,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
892 compile(parser/U_qid,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
893 compile(parser/U_tree,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
894 compile(parser/U_ttype,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
895
896 /* finished with local macros */
897 #undef compile
898 #undef compile_rec
899 #undef if_ghc
900
901 /* *** misc *************************************************** */
902
903 DEPSRCS = $(ALLSRCS_LHS) $(ALLSRCS_HS)
904
905 #if GhcWithHscBuiltViaC == NO
906 MKDEPENDHS_OPTS= -I$(MAIN_INCLUDE_DIR) -I$(COMPINFO_DIR) -x HsVersions.h
907 #else /* booting from .hc */
908 MKDEPENDHS_OPTS= -o .hc -I$(MAIN_INCLUDE_DIR) -I$(COMPINFO_DIR)  -x HsVersions.h
909 #endif /* booting from .hc files */
910
911 #if HaskellCompilerType != HC_USE_HC_FILES
912     /* otherwise, the dependencies jeopardize our .hc files --
913         which are all we have! */
914 HaskellDependTarget( $(DEPSRCS) )
915 #endif
916
917 ExtraStuffToClean( $(ALLOBJS) $(HSP_OBJS_O) )
918 #if GhcWithHscBuiltViaC == YES
919 ExtraStuffToClean( $(ALLHCS) )
920 #endif
921 ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )
922
923 ClearTagsFile()
924 HsTagsTarget( $(ALLSRCS_LHS) )
925 HSTAGS_OPTS = $(HC_OPTS) -I$(MAIN_INCLUDE_DIR)
926
927 /* count the number of lines in the source files */
928 count_lines ::
929         ./count_lines $(ALLSRCS_LHS) $(ALLSRCS_HS)
930
931 /* accumulate similar info about the sizes of object files */
932 count_bytes ::
933         ./count_bytes $(ALLSRCS_LHS) $(ALLSRCS_HS)