Jmakefile 23.8 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
/* preliminaries */

/* (only subdir is the test suite) */

#if IncludeTestDirsInBuild == YES
# define IHaveSubdirs

# define __ghc_compiler_tests_dir tests
#else
# define __ghc_compiler_tests_dir /* nothing */
#endif
SUBDIRS = __ghc_compiler_tests_dir
#undef __ghc_compiler_tests_dir
14
15
16
17
18
19

#define NoAllTargetForSubdirs
#define NoDocsTargetForSubdirs
#define NoInstallDocsTargetForSubdirs
#define NoDependTargetForSubdirs
#define NoInstallTargetForSubdirs
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#define NoTagTargetForSubdirs

/* Suffix rules: we do not use them much at all in GHC.
   We need some magic stuff (from suffixes-GEN.ljm) for
   the parser files.
*/
SuffixRules_flexish()
SuffixRule_c_o()
LitSuffixRule(.lprl,.prl) /* for makeSymbolList.prl */

/* assume ALL source is in subdirectories one level below
   they don't have Jmakefiles; this Jmakefile controls everything
*/

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57

#ifdef MainIncludeDir
MAIN_INCLUDE_DIR=MainIncludeDir
#else
MAIN_INCLUDE_DIR=$(TOP_PWD)/$(CURRENT_DIR)/$(GHC_INCLUDES)
#endif

/* helps to find GhcConstants.h in codeGen/CgCompInfo.lhs */
#ifdef CompInfoDir
COMPINFO_DIR=CompInfoDir
#else
COMPINFO_DIR=$(TOP_PWD)/$(CURRENT_DIR)/codeGen
#endif
/* nativeGen, elsewhere */
#ifdef NativeGenDir
NATIVEGEN_DIR=NativeGenDir
#else
NATIVEGEN_DIR=$(TOP_PWD)/$(CURRENT_DIR)/nativeGen
#endif

/* in order-of-passes order, utility modules at the end */

58
59
60
61
62
63
64
65
66
67
68
69
70
#define READERSRCS_HS	\
parser/U_constr.hs	\
parser/U_binding.hs	\
parser/U_pbinding.hs	\
parser/U_entidt.hs	\
parser/U_list.hs	\
parser/U_literal.hs	\
parser/U_maybe.hs	\
parser/U_either.hs	\
parser/U_qid.hs		\
parser/U_tree.hs 	\
parser/U_ttype.hs

71
#define hsp_library libhsp.a
72

73
#define READERSRCS_LHS	\
74
75
parser/UgenUtil.lhs	\
parser/UgenAll.lhs	\
76
reader/ReadPrefix.lhs	\
77
\
78
79
reader/PrefixSyn.lhs	\
reader/PrefixToHs.lhs	\
80
reader/RdrHsSyn.lhs	\
81
\
82
83
84
85
86
87
88
89
90
91
92
93
94
hsSyn/HsBinds.lhs  /* abstract Haskell syntax */ \
hsSyn/HsCore.lhs \
hsSyn/HsDecls.lhs \
hsSyn/HsExpr.lhs \
hsSyn/HsImpExp.lhs \
hsSyn/HsLit.lhs \
hsSyn/HsMatches.lhs \
hsSyn/HsPat.lhs \
hsSyn/HsPragmas.lhs \
hsSyn/HsTypes.lhs \
hsSyn/HsSyn.lhs

#define NOT_SO_BASICSRCS_LHS 	\
95
basicTypes/FieldLabel.lhs	\
96
97
98
99
basicTypes/Id.lhs		\
basicTypes/IdInfo.lhs		\
basicTypes/IdUtils.lhs		\
basicTypes/Literal.lhs		\
100
101
102
103
104
105
basicTypes/Name.lhs 		\
basicTypes/PprEnv.lhs		\
basicTypes/PragmaInfo.lhs	\
basicTypes/SrcLoc.lhs		\
basicTypes/UniqSupply.lhs 	\
basicTypes/Unique.lhs		\
106
\
107
108
109
110
111
112
113
types/Class.lhs			\
types/Kind.lhs			\
types/PprType.lhs		\
types/TyCon.lhs			\
types/TyVar.lhs			\
types/Usage.lhs			\
types/Type.lhs			\
114
\
115
116
specialise/SpecEnv.lhs

117
118
#define RENAMERSRCS_HS \
rename/ParseIface.hs
119
120

#define RENAMERSRCS_LHS \
121
rename/ParseUtils.lhs \
122
rename/RnHsSyn.lhs \
123
124
125
126
127
128
129
130
rename/RnMonad.lhs \
rename/Rename.lhs \
rename/RnNames.lhs \
rename/RnSource.lhs \
rename/RnBinds.lhs \
rename/RnExpr.lhs \
rename/RnIfaces.lhs \
rename/RnUtils.lhs
131
132

#define TCSRCS_LHS \
133
typecheck/TcHsSyn.lhs \
134
typecheck/GenSpecEtc.lhs \
135
typecheck/Inst.lhs	\
136
137
138
139
140
141
typecheck/TcBinds.lhs \
typecheck/TcClassDcl.lhs \
typecheck/TcDefaults.lhs \
typecheck/TcDeriv.lhs \
typecheck/TcExpr.lhs \
typecheck/TcGenDeriv.lhs \
142
typecheck/TcGRHSs.lhs \
143
144
typecheck/TcIfaceSig.lhs \
typecheck/TcInstDcls.lhs \
145
typecheck/TcInstUtil.lhs \
146
147
148
typecheck/TcMatches.lhs \
typecheck/TcModule.lhs \
typecheck/TcMonad.lhs \
149
150
151
typecheck/TcEnv.lhs \
typecheck/TcKind.lhs \
typecheck/TcType.lhs \
152
153
154
typecheck/TcMonoType.lhs \
typecheck/TcPat.lhs \
typecheck/TcSimplify.lhs \
155
typecheck/TcTyClsDecls.lhs \
156
157
158
typecheck/TcTyDecls.lhs \
typecheck/Unify.lhs

159
160
161
162
/*
typecheck/TcPragmas.lhs \
*/

163
164
165
166
167
168
169
170
171
#define DSSRCS_LHS \
deSugar/Desugar.lhs \
deSugar/Match.lhs \
deSugar/MatchCon.lhs \
deSugar/MatchLit.lhs \
deSugar/DsBinds.lhs \
deSugar/DsCCall.lhs \
deSugar/DsExpr.lhs \
deSugar/DsGRHSs.lhs \
172
deSugar/DsHsSyn.lhs \
173
174
175
176
deSugar/DsListComp.lhs \
deSugar/DsMonad.lhs \
deSugar/DsUtils.lhs \
\
177
178
179
coreSyn/CoreLift.lhs \
coreSyn/CoreLint.lhs

180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
#if GhcWithDeforester != YES
#define __omit_deforester_flag -DOMIT_DEFORESTER=1
#define DEFORESTER_SRCS_LHS /*none*/
#else
#define __omit_deforester_flag /*nope*/
#define DEFORESTER_SRCS_LHS \
deforest/DefSyn.lhs \
deforest/Core2Def.lhs \
deforest/Def2Core.lhs \
deforest/Deforest.lhs \
deforest/DefUtils.lhs \
deforest/DefExpr.lhs \
deforest/Cyclic.lhs \
deforest/TreelessForm.lhs
#endif /* GhcWithDeforester */

196
197
198
199
#define SIMPL_SRCS_LHS \
coreSyn/AnnCoreSyn.lhs \
coreSyn/FreeVars.lhs \
\
200
specialise/Specialise.lhs \
201
specialise/SpecUtils.lhs \
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
\
simplCore/SimplCase.lhs \
simplCore/SimplEnv.lhs \
simplCore/SimplMonad.lhs \
simplCore/SimplPgm.lhs \
simplCore/SimplUtils.lhs \
simplCore/SimplVar.lhs \
simplCore/Simplify.lhs \
\
simplCore/LiberateCase.lhs \
\
simplCore/ConFold.lhs \
simplCore/FloatIn.lhs \
simplCore/FloatOut.lhs \
simplCore/SAT.lhs \
simplCore/SATMonad.lhs \
simplCore/SetLevels.lhs \
simplCore/SimplCore.lhs \
simplCore/OccurAnal.lhs \
simplCore/FoldrBuildWW.lhs \
simplCore/AnalFBWW.lhs \
\
stranal/StrictAnal.lhs \
stranal/SaLib.lhs \
stranal/SaAbsInt.lhs \
stranal/WwLib.lhs \
stranal/WorkWrap.lhs \
\
230
profiling/SCCauto.lhs DEFORESTER_SRCS_LHS
231

232
#define STG_SRCS_LHS \
233
234
stgSyn/CoreToStg.lhs \
stgSyn/StgSyn.lhs \
235
stgSyn/StgUtils.lhs \
236
stgSyn/StgLint.lhs \
237
profiling/SCCfinal.lhs \
238
239
240
241
242
243
244
245
\
simplStg/SatStgRhs.lhs \
simplStg/LambdaLift.lhs \
simplStg/StgVarInfo.lhs \
simplStg/UpdAnal.lhs \
simplStg/StgStats.lhs \
simplStg/StgSATMonad.lhs \
simplStg/StgSAT.lhs \
246
247
248
simplStg/SimplStg.lhs

#define BACKSRCS_LHS \
249
absCSyn/AbsCUtils.lhs \
250
absCSyn/AbsCSyn.lhs \
251
absCSyn/CLabel.lhs \
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
absCSyn/Costs.lhs \
absCSyn/HeapOffs.lhs \
absCSyn/PprAbsC.lhs \
\
codeGen/CodeGen.lhs \
codeGen/ClosureInfo.lhs \
codeGen/SMRep.lhs \
codeGen/CgConTbls.lhs \
codeGen/CgMonad.lhs \
codeGen/CgUsages.lhs \
codeGen/CgHeapery.lhs \
codeGen/CgStackery.lhs \
codeGen/CgExpr.lhs \
codeGen/CgCase.lhs \
codeGen/CgLetNoEscape.lhs \
codeGen/CgTailCall.lhs \
codeGen/CgClosure.lhs \
codeGen/CgCon.lhs \
codeGen/CgRetConv.lhs \
codeGen/CgBindery.lhs \
codeGen/CgUpdate.lhs

#if GhcWithNativeCodeGen == NO || GhcWithHscBuiltViaC == YES
    /* if building via C, we *assume* that it is the
       distributed C files, which do not have a native-code
       generator in them
    */
279
280
# define __omit_ncg_maybe -DOMIT_NATIVE_CODEGEN=1
# define NATIVEGEN_SRCS_LHS /*none*/
281
#else
282
# define __omit_ncg_maybe /*none*/
283

284
# define NATIVEGEN_SRCS_LHS \
285
286
287
nativeGen/AbsCStixGen.lhs \
nativeGen/AsmCodeGen.lhs \
nativeGen/AsmRegAlloc.lhs \
288
289
290
291
292
nativeGen/MachCode.lhs \
nativeGen/MachMisc.lhs \
nativeGen/MachRegs.lhs \
nativeGen/PprMach.lhs \
nativeGen/RegAllocInfo.lhs \
293
294
295
296
nativeGen/Stix.lhs \
nativeGen/StixInfo.lhs \
nativeGen/StixInteger.lhs \
nativeGen/StixPrim.lhs \
297
nativeGen/StixMacro.lhs
298
299
300
#endif

#define UTILSRCS_LHS \
301
utils/Argv.lhs \
302
303
utils/Bag.lhs \
utils/BitSet.lhs \
304
305
306
utils/CharSeq.lhs \
utils/Digraph.lhs \
utils/FiniteMap.lhs \
307
utils/ListSetOps.lhs \
308
309
310
utils/MatchEnv.lhs \
utils/Maybes.lhs \
utils/OrdList.lhs \
311
utils/Outputable.lhs \
312
313
314
utils/PprStyle.lhs \
utils/Pretty.lhs \
utils/SST.lhs \
315
316
utils/UniqFM.lhs \
utils/UniqSet.lhs \
317
utils/Unpretty.lhs \
318
319
320
321
utils/Util.lhs

#define MAIN_SRCS_LHS \
main/CmdLineOpts.lhs \
322
323
main/ErrUtils.lhs \
main/MkIface.lhs \
324
main/Main.lhs
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344

#define VBASICSRCS_LHS \
prelude/PrelMods.lhs \
prelude/PrimRep.lhs \
prelude/PrimOp.lhs \
prelude/TysPrim.lhs \
prelude/TysWiredIn.lhs \
prelude/PrelVals.lhs \
prelude/PrelInfo.lhs \
\
absCSyn/CStrings.lhs \
codeGen/CgCompInfo.lhs \
coreSyn/CoreSyn.lhs \
coreSyn/CoreUnfold.lhs \
coreSyn/CoreUtils.lhs \
coreSyn/PprCore.lhs \
profiling/CostCentre.lhs \
simplCore/BinderInfo.lhs \
simplCore/MagicUFs.lhs

345
ALLSRCS_HS = READERSRCS_HS RENAMERSRCS_HS
346
ALLSRCS_LHS = /* all pieces of the compiler */ \
347
348
349
350
351
VBASICSRCS_LHS		\
NOT_SO_BASICSRCS_LHS	\
UTILSRCS_LHS 		\
MAIN_SRCS_LHS 		\
READERSRCS_LHS 		\
352
353
RENAMERSRCS_LHS		\
TCSRCS_LHS		\
354
355
356
357
DSSRCS_LHS 		\
SIMPL_SRCS_LHS 		\
STG_SRCS_LHS 		\
BACKSRCS_LHS NATIVEGEN_SRCS_LHS
358

359
/*
360
\
361
*/
362
363
364
/* NB: all the ones that may be empty (e.g., NATIVEGEN_SRCS_LHS)
	need to be on the last line.
*/
365
366

/* should't use these fancy `make' things, really */
367
ALLHCS =$(ALLSRCS_LHS:.lhs=.hc) $(ALLSRCS_HS:.hs=.hc)
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
ALLOBJS=$(ALLSRCS_LHS:.lhs=.o)  $(ALLSRCS_HS:.hs=.o)
ALLINTS=$(ALLSRCS_LHS:.lhs=.hi) $(ALLSRCS_HS:.hs=.hi)

.PRECIOUS: $(ALLINTS)

#if GhcWithHscDebug == YES
# define use_DDEBUG -DDEBUG
#else
# define use_DDEBUG /*nothing*/
#endif

#if GhcWithHscOptimised == YES
#define __version_sensitive_flags -DUSE_ATTACK_PRAGMAS -fshow-pragma-name-errs -fomit-reexported-instances -fshow-import-specs
#else
#define __version_sensitive_flags -fomit-reexported-instances
#endif

/* avoid use of AllProjectsHcOpts; then put in HcMaxHeapFlag "by hand" */
#undef  AllProjectsHcOpts
#define AllProjectsHcOpts /**/

389
HC_OPTS = -cpp HcMaxHeapFlag -fhaskell-1.3 -fglasgow-exts -DCOMPILING_GHC \
390
391
	-fomit-derived-read \
	-I. -i$(SUBDIR_LIST) \
392
	use_DDEBUG __version_sensitive_flags __omit_ncg_maybe __omit_deforester_flag
393
394
395
396
397
398
399

#undef __version_sensitive_flags
#undef __omit_ncg_maybe
#undef __omit_deforester_flag

#if GhcWithHscBuiltViaC == YES /* not using a Haskell compiler */

400
hcs:: $(ALLHCS)
401

402
# if HaskellCompilerType == HC_USE_HC_FILES
403
HC = $(GHC) /* uses the driver herein */
404
# endif
405
406
407
408
409

#endif /* using .hc files */

/*
    -DCOMPILING_GHC
410
411
412
413
414
	Used when compiling GHC.  Some GHC utility modules are
	*also* part of the GHC library.  There are a few bits
	of those modules that only apply to GHC itself and
	should not be in the library stuff.  We use this
	CPP thing to isolate those bits.
415
416
*/

417
BuildPgmFromHaskellModules(hsc,$(ALLOBJS) parser/hsclink.o parser/hschooks.o,,libhsp.a)
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464

#if DoInstallGHCSystem == YES
MakeDirectories(install, $(INSTLIBDIR_GHC))
InstallBinaryTarget(hsc,$(INSTLIBDIR_GHC))
#endif

/* set up for going either to .hc or to .o files */
#if GhcWithHscBuiltViaC == YES

/*OLD:SuffixRule_hc_o() */

# if HaskellCompilerType == HC_USE_HC_FILES
    /* if we do not, we never try to compile .lhs files;
	we *blast* the macro we would normally use (HACK) (WDP 94/12)
     */

#  undef HaskellCompileWithSpecifiedFlags
#  define HaskellCompileWithSpecifiedFlags(module,isuf,osuf,flags)	@@\
module.osuf : module.isuf						\
_body_HaskellCompileWithSpecifiedFlags(module.isuf,module.osuf,module,isuf,flags)

#  define compile(module,isuf,extra_flags) \
HaskellCompileWithExtraFlags(module,hc,o,-c,extra_flags)

#  define compile_rec(module,isuf,extra_flags) \
HaskellCompileWithExtraFlags_Recursive(module,hc,o,-c,extra_flags)

# else /* we do! */

#  define compile(module,isuf,extra_flags) \
HaskellCompileWithExtraFlags(module,isuf,hc,-C,extra_flags)

#  define compile_rec(module,isuf,extra_flags) \
HaskellCompileWithExtraFlags_Recursive(module,isuf,hc,-C,extra_flags)

# endif /* ... == HC_USE_HC_FILES */

#else /* ! booting from C */

# define compile(module,isuf,extra_flags) \
HaskellCompileWithExtraFlags(module,isuf,o,-c,extra_flags)

# define compile_rec(module,isuf,extra_flags) \
HaskellCompileWithExtraFlags_Recursive(module,isuf,o,-c,extra_flags)

#endif /* ! booting from C */

465
466
#define if_ghc(x) x
#if GhcBuilderVersion >= 26
467
#  define if_ghc26(x) x
468
#else
469
470
471
472
473
#  define if_ghc26(x) /*nothing*/
#endif

/* OK, here we go: */

474
475
476
utils/Ubiq.hi : utils/Ubiq.lhi
	$(GHC_UNLIT) utils/Ubiq.lhi utils/Ubiq.hi

477
478
absCSyn/AbsCLoop.hi : absCSyn/AbsCLoop.lhi
	$(GHC_UNLIT) absCSyn/AbsCLoop.lhi absCSyn/AbsCLoop.hi
479
480
basicTypes/IdLoop.hi : basicTypes/IdLoop.lhi
	$(GHC_UNLIT) basicTypes/IdLoop.lhi basicTypes/IdLoop.hi
481
482
483
484
codeGen/CgLoop1.hi : codeGen/CgLoop1.lhi
	$(GHC_UNLIT) codeGen/CgLoop1.lhi codeGen/CgLoop1.hi
codeGen/CgLoop2.hi : codeGen/CgLoop2.lhi
	$(GHC_UNLIT) codeGen/CgLoop2.lhi codeGen/CgLoop2.hi
485
486
487
488
deSugar/DsLoop.hi : deSugar/DsLoop.lhi
	$(GHC_UNLIT) deSugar/DsLoop.lhi deSugar/DsLoop.hi
hsSyn/HsLoop.hi : hsSyn/HsLoop.lhi
	$(GHC_UNLIT) hsSyn/HsLoop.lhi hsSyn/HsLoop.hi
489
490
nativeGen/NcgLoop.hi : nativeGen/NcgLoop.lhi
	$(GHC_UNLIT) nativeGen/NcgLoop.lhi nativeGen/NcgLoop.hi
491
492
493
494
495
496
497
498
499
500
501
502
503
prelude/PrelLoop.hi : prelude/PrelLoop.lhi
	$(GHC_UNLIT) prelude/PrelLoop.lhi prelude/PrelLoop.hi
rename/RnLoop.hi : rename/RnLoop.lhi
	$(GHC_UNLIT) rename/RnLoop.lhi rename/RnLoop.hi
simplCore/SmplLoop.hi : simplCore/SmplLoop.lhi
	$(GHC_UNLIT) simplCore/SmplLoop.lhi simplCore/SmplLoop.hi
typecheck/TcMLoop.hi : typecheck/TcMLoop.lhi
	$(GHC_UNLIT) typecheck/TcMLoop.lhi typecheck/TcMLoop.hi
typecheck/TcLoop.hi : typecheck/TcLoop.lhi
	$(GHC_UNLIT) typecheck/TcLoop.lhi typecheck/TcLoop.hi
types/TyLoop.hi : types/TyLoop.lhi
	$(GHC_UNLIT) types/TyLoop.lhi types/TyLoop.hi

504
rename/ParseIface.hs : rename/ParseIface.y
505
	$(RM) rename/ParseIface.hs rename/ParseIface.hinfo
506
	happy -g -i rename/ParseIface.hinfo rename/ParseIface.y
507
	@chmod 444 rename/ParseIface.hs
508

509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
compile(absCSyn/AbsCUtils,lhs,)
compile(absCSyn/CStrings,lhs,)
compile(absCSyn/CLabel,lhs,)
compile(absCSyn/Costs,lhs,)
compile(absCSyn/HeapOffs,lhs,)
compile(absCSyn/PprAbsC,lhs,)
compile(absCSyn/AbsCSyn,lhs,if_ghc(-fno-omit-reexported-instances))

compile(hsSyn/HsBinds,lhs,)
compile(hsSyn/HsCore,lhs,)
compile(hsSyn/HsDecls,lhs,)
compile(hsSyn/HsExpr,lhs,)
compile(hsSyn/HsImpExp,lhs,)
compile(hsSyn/HsLit,lhs,)
compile(hsSyn/HsMatches,lhs,)
compile(hsSyn/HsPat,lhs,)
compile(hsSyn/HsPragmas,lhs,)
compile(hsSyn/HsTypes,lhs,)
compile(hsSyn/HsSyn,lhs,if_ghc(-fno-omit-reexported-instances))

529
compile(basicTypes/FieldLabel,lhs,)
530
531
532
533
534
compile(basicTypes/Id,lhs,)
compile(basicTypes/IdInfo,lhs,-K2m)
compile(basicTypes/IdUtils,lhs,)
compile(basicTypes/Literal,lhs,)
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
540
541
compile(basicTypes/Unique,lhs,)

compile(codeGen/CgBindery,lhs,)
542
543
544
compile(codeGen/CgCase,lhs,)
compile(codeGen/CgClosure,lhs,)
compile(codeGen/CgCompInfo,lhs,-I$(COMPINFO_DIR))
545
546
compile(codeGen/CgCon,lhs,)
compile(codeGen/CgConTbls,lhs,)
547
compile(codeGen/CgExpr,lhs,)
548
549
compile(codeGen/CgHeapery,lhs,)
compile(codeGen/CgLetNoEscape,lhs,)
550
551
compile(codeGen/CgMonad,lhs,)
compile(codeGen/CgRetConv,lhs,)
552
553
554
555
compile(codeGen/CgStackery,lhs,)
compile(codeGen/CgTailCall,lhs,)
compile(codeGen/CgUpdate,lhs,)
compile(codeGen/CgUsages,lhs,)
556
compile(codeGen/ClosureInfo,lhs,)
557
558
559
560
compile(codeGen/CodeGen,lhs,)
compile(codeGen/SMRep,lhs,)

compile(coreSyn/AnnCoreSyn,lhs,if_ghc(-fno-omit-reexported-instances))
561
compile(coreSyn/CoreUtils,lhs,)
562
563
564
compile(coreSyn/CoreLift,lhs,)
compile(coreSyn/CoreLint,lhs,)
compile(coreSyn/CoreSyn,lhs,)
565
compile(coreSyn/PprCore,lhs,)
566
567
568
569
compile(coreSyn/CoreUnfold,lhs,)
compile(coreSyn/FreeVars,lhs,)

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
576
compile(deSugar/DsListComp,lhs,)
compile(deSugar/DsMonad,lhs,)
577
578
compile(deSugar/DsUtils,lhs,)
compile(deSugar/Match,lhs,)
579
580
581
compile(deSugar/MatchCon,lhs,)
compile(deSugar/MatchLit,lhs,)

582
583
584
compile(main/CmdLineOpts,lhs,if_ghc(-fvia-C))
compile(main/ErrUtils,lhs,)
compile(main/Main,lhs,if_ghc(-fvia-C))
585
586
587
588
589
compile(main/MkIface,lhs,)

#if GhcWithNativeCodeGen == YES
compile(nativeGen/AbsCStixGen,lhs,)
compile(nativeGen/AsmCodeGen,lhs,-I$(COMPINFO_DIR))
590
compile(nativeGen/AsmRegAlloc,lhs,-I$(COMPINFO_DIR))
591
592
593
594
595
compile(nativeGen/MachCode,lhs,-I$(NATIVEGEN_DIR))
compile(nativeGen/MachMisc,lhs,-I$(NATIVEGEN_DIR))
compile(nativeGen/MachRegs,lhs,-I$(NATIVEGEN_DIR))
compile(nativeGen/PprMach,lhs,-I$(NATIVEGEN_DIR))
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
602
#endif

603
604
compile(prelude/PrelInfo,lhs,)
compile(prelude/PrelMods,lhs,)
605
compile(prelude/PrelVals,lhs,)
606
607
compile(prelude/PrimRep,lhs,-I$(COMPINFO_DIR))
compile(prelude/PrimOp,lhs,-K3m -H10m)
608
609
610
611
612
613
614
615
compile(prelude/TysPrim,lhs,)
compile(prelude/TysWiredIn,lhs,)

compile(profiling/SCCauto,lhs,)
compile(profiling/SCCfinal,lhs,)
compile(profiling/CostCentre,lhs,)

compile(reader/PrefixSyn,lhs,)
616
617
618
compile(reader/PrefixToHs,lhs,)
compile(reader/ReadPrefix,lhs,if_ghc(-fvia-C -I$(COMPINFO_DIR) -Iparser '-#include"hspincl.h"'))
compile(reader/RdrHsSyn,lhs,)
619

620
compile(rename/ParseIface,hs,)
621
compile(rename/ParseUtils,lhs,)
622
623
compile(rename/RnHsSyn,lhs,)
compile(rename/RnMonad,lhs,)
624
compile(rename/Rename,lhs,)
625
626
627
628
629
compile(rename/RnNames,lhs,)
compile(rename/RnSource,lhs,)
compile(rename/RnBinds,lhs,)
compile(rename/RnExpr,lhs,)
compile(rename/RnIfaces,lhs,)
630
compile(rename/RnUtils,lhs,)
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645

compile(simplCore/BinderInfo,lhs,)
compile(simplCore/ConFold,lhs,)
compile(simplCore/FloatIn,lhs,)
compile(simplCore/FloatOut,lhs,)
compile(simplCore/LiberateCase,lhs,)
compile(simplCore/MagicUFs,lhs,)
compile(simplCore/OccurAnal,lhs,)

compile(simplCore/AnalFBWW,lhs,)
compile(simplCore/FoldrBuildWW,lhs,)

compile(simplCore/SAT,lhs,)
compile(simplCore/SATMonad,lhs,)
compile(simplCore/SetLevels,lhs,)
646
compile(simplCore/SimplCase,lhs,)
647
compile(simplCore/SimplCore,lhs,)
648
compile(simplCore/SimplEnv,lhs,)
649
650
651
compile(simplCore/SimplMonad,lhs,)
compile(simplCore/SimplPgm,lhs,)
compile(simplCore/SimplUtils,lhs,)
652
compile(simplCore/SimplVar,lhs,)
653
654
655
656
657
658
659
660
661
662
663
664
665
666
compile(simplCore/Simplify,lhs,)

compile(simplStg/SatStgRhs,lhs,)
compile(simplStg/LambdaLift,lhs,)
compile(simplStg/StgVarInfo,lhs,)
compile(simplStg/UpdAnal,lhs,)
compile(simplStg/StgStats,lhs,)
compile(simplStg/StgSATMonad,lhs,)
compile(simplStg/StgSAT,lhs,)
compile(simplStg/SimplStg,lhs,)

#if GhcWithDeforester == YES
compile(deforest/Core2Def,lhs,)
compile(deforest/Cyclic,lhs,)
667
668
compile(deforest/Def2Core,lhs,)
compile(deforest/DefExpr,lhs,)
669
compile(deforest/DefSyn,lhs,)
670
compile(deforest/DefUtils,lhs,)
671
672
673
674
compile(deforest/Deforest,lhs,)
compile(deforest/TreelessForm,lhs,)
#endif

675
676
677
compile(specialise/Specialise,lhs,)
compile(specialise/SpecEnv,lhs,)
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
685
686
687
688
689
690

compile(stranal/SaAbsInt,lhs,)
compile(stranal/SaLib,lhs,)
compile(stranal/StrictAnal,lhs,)
compile(stranal/WorkWrap,lhs,)
compile(stranal/WwLib,lhs,)

compile(typecheck/GenSpecEtc,lhs,)
691
692
compile(typecheck/Inst,lhs,)
compile(typecheck/TcHsSyn,lhs,)
693
compile(typecheck/TcBinds,lhs,)
694
compile(typecheck/TcClassDcl,lhs,)
695
compile(typecheck/TcDefaults,lhs,)
696
697
698
699
compile(typecheck/TcDeriv,lhs,)
compile(typecheck/TcExpr,lhs,)
compile(typecheck/TcGRHSs,lhs,)
compile(typecheck/TcGenDeriv,lhs,)
700
compile(typecheck/TcIfaceSig,lhs,)
701
702
compile(typecheck/TcInstDcls,lhs,)
compile(typecheck/TcInstUtil,lhs,)
703
704
compile(typecheck/TcMatches,lhs,)
compile(typecheck/TcModule,lhs,)
705
706
707
708
compile(typecheck/TcMonad,lhs,)
compile(typecheck/TcKind,lhs,)
compile(typecheck/TcType,lhs,)
compile(typecheck/TcEnv,lhs,)
709
compile(typecheck/TcMonoType,lhs,)
710
711
compile(typecheck/TcPat,lhs,)
compile(typecheck/TcPragmas,lhs,)
712
compile(typecheck/TcSimplify,lhs,)
713
compile(typecheck/TcTyClsDecls,lhs,)
714
715
716
compile(typecheck/TcTyDecls,lhs,)
compile(typecheck/Unify,lhs,)

717
718
719
720
721
722
723
compile(types/Class,lhs,)
compile(types/Kind,lhs,)
compile(types/PprType,lhs,)
compile(types/TyCon,lhs,)
compile(types/TyVar,lhs,)
compile(types/Usage,lhs,)
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
729
compile(utils/CharSeq,lhs,if_ghc(-fvia-C)) /* uses stg_putc */
compile(utils/Digraph,lhs,)
730
compile(utils/FiniteMap,lhs,)
731
732
compile(utils/ListSetOps,lhs,)
compile(utils/Maybes,lhs,)
733
734
735
736
737
738
compile(utils/OrdList,lhs,)
compile(utils/Outputable,lhs,)
compile(utils/PprStyle,lhs,)
compile(utils/Pretty,lhs,)
compile(utils/SST,lhs,if_ghc(-fvia-C))
compile(utils/UniqFM,lhs,)
739
740
compile(utils/UniqSet,lhs,)
compile(utils/Unpretty,lhs,)
741
742
compile(utils/MatchEnv,lhs,)
compile(utils/Util,lhs,)
743
744
745
746
747
748
749

/* for convenience in cross-compiling */
objs:: $(ALLOBJS)

/* *** parser ************************************************* */

YACC_OPTS = -d
750
CC_OPTS = -Iparser -I. -I$(COMPINFO_DIR) -DUGEN_DEBUG=1 /*-DHSP_DEBUG=1*/ -g
751
752
753
754
755

/* add to these on the command line with, e.g., EXTRA_YACC_OPTS=-v */

XCOMM D_DEBUG = -DDEBUG

756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
CPP_DEFINES = $(D_DEBUG)

HSP_SRCS_C =    parser/constr.c		\
		parser/binding.c	\
		parser/pbinding.c	\
		parser/entidt.c		\
		parser/hslexer.c	\
		parser/hsparser.tab.c	\
		parser/id.c		\
		parser/infix.c		\
		parser/list.c		\
		parser/literal.c	\
		parser/maybe.c		\
		parser/either.c		\
		parser/qid.c		\
		parser/syntax.c		\
		parser/tree.c		\
		parser/ttype.c		\
		parser/type2context.c	\
		parser/util.c

HSP_OBJS_O =    parser/constr.o		\
		parser/binding.o	\
		parser/pbinding.o	\
		parser/entidt.o		\
		parser/hslexer.o	\
		parser/hsparser.tab.o	\
		parser/id.o		\
		parser/infix.o		\
		parser/list.o		\
		parser/literal.o	\
		parser/maybe.o		\
		parser/either.o		\
		parser/qid.o		\
		parser/syntax.o		\
		parser/tree.o		\
		parser/ttype.o		\
		parser/type2context.o	\
		parser/util.o
795
796

/* this is for etags */
797
798
799
800
801
802
803
804
805
REAL_HSP_SRCS_C = parser/main.c 	\
		parser/hschooks.c	\
		parser/hsclink.c	\
		parser/id.c 		\
		parser/util.c 		\
		parser/syntax.c 	\
		parser/type2context.c 	\
		parser/infix.c 		\
		parser/printtree.c
806
807
808
809
810
811
812
813
814
815

UgenNeededHere(all depend)

/* Most hsp files are in libhsp.a, so we can either make
   a standalone parser, or incorporate the files into
   the hsc compiler directly (WDP 94/10)
*/
NormalLibraryTarget(hsp,$(HSP_OBJS_O))

/* We need the hsp program for hstags to work! */
816
BuildPgmFromCFiles(hsp,parser/printtree.o parser/main.o,,libhsp.a)
817
818
819
820
821
822

#if DoInstallGHCSystem == YES
MakeDirectories(install, $(INSTLIBDIR_GHC))
InstallBinaryTarget(hsp,$(INSTLIBDIR_GHC))
#endif /* DoInstall... */

823
YaccRunWithExpectMsg(parser/hsparser,14,0)
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867

UgenTarget(parser/constr)
UgenTarget(parser/binding)
UgenTarget(parser/pbinding)
UgenTarget(parser/entidt)
UgenTarget(parser/list)
UgenTarget(parser/literal)
UgenTarget(parser/maybe)
UgenTarget(parser/either)
UgenTarget(parser/qid)
UgenTarget(parser/tree)
UgenTarget(parser/ttype)

UGENS_C = parser/constr.c	\
	parser/binding.c	\
	parser/pbinding.c	\
	parser/entidt.c		\
	parser/literal.c	\
	parser/list.c		\
	parser/maybe.c		\
	parser/either.c		\
	parser/qid.c		\
	parser/tree.c		\
	parser/ttype.c

/* Putting the -#include"hspincl.h" option into the
   PARSER_HS_OPTS line really does not work (it depends
   on the 'make' that you use).
*/
PARSER_HS_OPTS = if_ghc(-fvia-C -I$(COMPINFO_DIR) -Iparser)

compile(parser/UgenAll,lhs,if_ghc(-fvia-C))
compile(parser/UgenUtil,lhs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_constr,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_binding,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_pbinding,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_entidt,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_list,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_literal,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_maybe,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_either,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_qid,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_tree,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
compile(parser/U_ttype,hs,$(PARSER_HS_OPTS) '-#include"hspincl.h"')
868
869
870
871
872
873
874
875

/* finished with local macros */
#undef compile
#undef compile_rec
#undef if_ghc

/* *** misc *************************************************** */

876
DEPSRCS = $(ALLSRCS_LHS) $(ALLSRCS_HS)
877
878

#if GhcWithHscBuiltViaC == NO
879
880
881
MKDEPENDHS_OPTS= -I$(MAIN_INCLUDE_DIR) -I$(COMPINFO_DIR) -x HsVersions.h
#else /* booting from .hc */
MKDEPENDHS_OPTS= -o .hc -I$(MAIN_INCLUDE_DIR) -I$(COMPINFO_DIR)  -x HsVersions.h
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
#endif /* booting from .hc files */

#if HaskellCompilerType != HC_USE_HC_FILES
    /* otherwise, the dependencies jeopardize our .hc files --
	which are all we have! */
HaskellDependTarget( $(DEPSRCS) )
#endif

ExtraStuffToClean( $(ALLOBJS) $(HSP_OBJS_O) )
#if GhcWithHscBuiltViaC == YES
ExtraStuffToClean( $(ALLHCS) )
#endif
ExtraStuffToBeVeryClean( $(STD_VERY_CLEAN) )

ClearTagsFile()
HsTagsTarget( $(ALLSRCS_LHS) )
HSTAGS_OPTS = $(HC_OPTS) -I$(MAIN_INCLUDE_DIR)

/* count the number of lines in the source files */
count_lines ::
	./count_lines $(ALLSRCS_LHS) $(ALLSRCS_HS)

/* accumulate similar info about the sizes of object files */
count_bytes ::
	./count_bytes $(ALLSRCS_LHS) $(ALLSRCS_HS)