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