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