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