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