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