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