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