-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
executable file
·428 lines (342 loc) · 16.3 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
#!/usr/bin/make -f
.PHONY: ehcs dist www www-sync install lib src build ruler1
###########################################################################################
# Location from which make is invoked
###########################################################################################
TOP_PREFIX :=
###########################################################################################
# First (default) target just explains what can be done
###########################################################################################
default: uhc
#default: 99/ehclib
help: explanation
###########################################################################################
# Definitions, dependencies, rules, etc: spread over subdirectories for subproducts
###########################################################################################
# do not change the order of these includes
-include latex/files.mk
-include lhs2TeX/files.mk
include mk/config.mk
### BEGIN of Ruler1
# This definitely should not remain here....!!!!
# Ruler1, will be obsolete until all type rules are specified with Ruler2 (currently not in Explicit/implicit story)
RULER1 := bin/ruler1$(EXEC_SUFFIX)
RULER1_DIR := ruler1
RULER1_MAIN := Ruler
RULER1_AG := $(RULER1_MAIN).ag
RULER1_HS := $(RULER1_AG:.ag=.hs)
RULER1_DERIV := $(RULER1_DIR)/$(RULER1_HS)
RULER1_SRC := $(RULER1_DIR)/$(RULER1_AG)
ruler1: $(RULER1)
$(RULER1): $(RULER1_DIR)/$(RULER1_AG) $(LIB_EH_UTIL_INS_FLAG)
cd $(RULER1_DIR) && \
$(AGC) -csdfr --module=Main `basename $<` && \
$(GHC) --make $(GHC_OPTS) -package $(LIB_EH_UTIL_PKG_NAME) $(RULER1_HS) -o ../$@ && \
$(STRIP) ../$@
### END of Ruler1
include src/files.mk
include $(SRC_PREFIX)ehc/shared.mk
include $(MK_PREFIX)shared.mk
include $(SRC_PREFIX)libutil/files.mk
-include $(SRC_PREFIX)top/files.mk
-include $(SRC_PREFIX)helium/files.mk
-include $(SRC_PREFIX)lvm/files.mk
-include $(SRC_PREFIX)text2text/files.mk
include $(SRC_PREFIX)shuffle/files.mk
include $(SRC_PREFIX)ruler2/files.mk
include $(SRC_PREFIX)ehc/variant.mk
include $(SRC_PREFIX)gen/files.mk
include $(SRC_PREFIX)ehc/files1.mk
-include $(SRC_PREFIX)grini/files.mk
-include $(SRC_PREFIX)experiments/files.mk
-include $(SRC_EXPERIMENTS_PREFIX)subst/files.mk
include extlibs/files.mk
ifeq ($(EHC_CFG_GMPLIB),gmp)
include $(EXTLIBS_PREFIX)bgc/files.mk
endif
ifeq ($(EHC_CFG_MPLIB),gmp)
include $(EXTLIBS_PREFIX)gmp/files.mk
endif
include $(EXTLIBS_PREFIX)ltm/files.mk
include ehclib/files1.mk
include $(SRC_PREFIX)rts/files.mk
ifeq ($(ENABLE_JAVA),yes)
-include $(SRC_PREFIX)jazy/files.mk
endif
ifeq ($(ENABLE_JSCRIPT),yes)
-include $(SRC_PREFIX)jscript/files.mk
endif
include $(SRC_PREFIX)ehc/files2.mk
-include $(SRC_PREFIX)agprimer/files.mk
-include $(SRC_PREFIX)infer2pass/variant.mk
-include $(SRC_PREFIX)infer2pass/files.mk
-include figs/files.mk
-include text/files1.mk
-include text/files-variants.mk
-include $(wildcard text/files1-*.mk)
-include text/files2.mk
-include text/files-targets.mk
-include $(wildcard text/files2-*.mk)
-include www/files.mk
include ehclib/files2.mk
include test/files.mk
include test/benchmark/files.mk
-include $(MK_PREFIX)dist.mk
###########################################################################################
# all versions (as used by testing)
###########################################################################################
VERSIONS := $(EHC_PUB_VARIANTS)
# distributed/published stuff for WWW
#WWW_SRC_TGZ := www/current-ehc-src.tgz
#WWW_DOC_PDF := www/current-ehc-doc.pdf
###########################################################################################
# UHC specific definitions
###########################################################################################
UHC_INSTALL_VARIANT_PREFIX := $(call FUN_INSTALLABS_VARIANT_PREFIX,$(EHC_UHC_INSTALL_VARIANT))
UHC_INSTALL_VARIANTNAME := $(UHC_EXEC_NAME)-$(EH_VERSION_FULL)
UHC_INSTALL_PREFIX := $(call FUN_DIR_VARIANT_PREFIX,$(INSTALL_UHC_ROOT),$(UHC_INSTALL_VARIANTNAME))
UHC_INSTALL_EHCBINARY := $(UHC_INSTALL_PREFIX)bin/$(EHC_EXEC_NAME)$(EXEC_SUFFIX)
###########################################################################################
# Target: explain what can be done
###########################################################################################
explanation:
@$(EXIT_IF_ABSENT_LIB_OR_TOOL)
@echo "UHC" ; \
echo "===" ; \
echo "make : defaults to 'make uhc'" ; \
echo "make uhc : make uhc and library (ehc variant 101)" ; \
echo "make install : make uhc and install globally (into $(UHC_INSTALL_PREFIX)), possibly needing admin permission" ; \
echo "make uninstall : uninstall uhc, possibly needing admin permission" ; \
echo "make test : regress test uhc" ; \
echo "" ; \
echo "EHC & tools" ; \
echo "===========" ; \
echo "make <n>/ehc : make compiler variant <n> (in bin/, where <n> in {$(EHC_PUB_VARIANTS)})" ; \
echo "make <n>/ehclib : make ehc library (i.e. used to compile with ehc) variant <n> (in bin/, where <n> in {$(EHC_PREL_VARIANTS)})" ; \
echo "make <n>/ehclibs : make ehc libraries for all codegen targets" ; \
echo "make <n>/rts : make only the rts part of a library" ; \
echo "make <n>/bare : make bare source dir for variant <n> (in bare/)," ; \
echo " then 'cd' to there and 'make'" ; \
echo "make $(RULER2_NAME) : make ruler tool" ; \
echo "make $(SHUFFLE_NAME) : make shuffle tool" ; \
echo "" ; \
echo "Documentation" ; \
echo "=============" ; \
echo "make help : print this help" ; \
echo "make www : make www documentation: $(TEXT_WWW_DOC_PDFS)" ; \
echo "make www-sync : install www documentation in the EHC web (http://www.cs.uu.nl/wiki/Ehc/WebHome)" ; \
echo "" ; \
echo "make doc/<d>.pdf : make (public) documentation <d> (where <d> in {$(TEXT_PUB_VARIANTS)})," ; \
echo " or (non-public): <d> in {$(TEXT_PRIV_VARIANTS)}" ; \
echo " or (doc): <d> in {$(TEXT_DOCLTX_VARIANTS)}" ; \
echo " only if text src available, otherwise already generated" ; \
echo "" ; \
echo "Testing" ; \
echo "===========" ; \
echo "make test-regress : run regression test," ; \
echo " restrict to versions <v> by specifying 'TEST_VARIANTS=<v>' (default '${TEST_VARIANTS}')," ; \
echo " requires corresponding $(EHC_EXEC_NAME)/$(GRINI_EXEC_NAME)/$(EHCLIB_EHCLIB) already built" ; \
echo "make test-expect : make expected output (for later comparison with test-regress), see test-regress for remarks" ; \
echo "make benchmark : run 16 nofib programs with 3 compilers on 3 inputs each"; \
echo "" ; \
echo "Cleaning up" ; \
echo "===========" ; \
echo "make <n>/clean : cleanup for variant <n>" ; \
echo "make clean : cleanup all variants + internal libraries and tools" ; \
echo "make clean-extlibs : cleanup external libraries" ; \
echo "" ; \
echo "Other" ; \
echo "=====" ; \
echo "make ehcs : make all compiler ($(EHC_EXEC_NAME)) versions" ; \
echo "make top : make Typing Our Programs library" ; \
echo "make lvm : make Lazy Virtual Machine library" ; \
echo "make helium : make Helium library" ; \
echo "make heliumdoc : make Haddock documentation for Helium, Top and Lvm (in hdoc/)" ; \
echo "" ; \
echo "Obsolesence candidates" ; \
echo "======================" ; \
echo "make <n>/infer2pass : make infer2pass demo version <n> (in bin/, where <n> in {$(INF2PS_VARIANTS)})" ; \
echo "make <n>/grini : make grin interpreter variant <n> (in bin/, where <n> in {$(GRIN_PUB_VARIANTS)}) (obsolete)" ; \
echo "make <n>/hdoc : make Haddock documentation for variant <n> (in hdoc/)" ; \
echo "make grinis : make all grin interpreter ($(GRINI_EXEC_NAME)) versions" ; \
echo "" ; \
###########################################################################################
# Target: make every variant of something
###########################################################################################
ehcs: $(EHC_ALL_PUB_EXECS)
grinis: $(GRINI_ALL_PUB_EXECS)
grinllvms: $(GRINLLVM_ALL_PUB_EXECS)
docs: $(TEXT_DIST_DOC_FILES)
cleans: $(patsubst %,%/clean,$(EHC_VARIANTS))
###########################################################################################
# Target: www stuff + sync to www. The full content of www is copied, including releases
###########################################################################################
# www: $(WWW_SRC_TGZ) www-ex $(WWW_DOC_FILES)
www: $(WWW_DOC_FILES)
# www/DoneSyncStamp: www-ex
www/DoneSyncStamp: www
(date "+%G%m%d %H:%M") > www/DoneSyncStamp ; \
chmod 664 www/* ; \
rsync --progress -azv -e ssh www/* `whoami`@shell.cs.uu.nl:/users/www/groups/ST/Projects/ehc
www-sync: www/DoneSyncStamp
###########################################################################################
# Target: helium doc
###########################################################################################
heliumdoc: $(LIB_HELIUM_ALL_DRV_HS) $(LIB_TOP_HS_DRV) $(LIB_LVM_HS_DRV)
mkdir -p hdoc/helium
haddock --html --odir=hdoc/helium $(LIB_HELIUM_ALL_DRV_HS) $(LIB_TOP_HS_DRV) $(LIB_LVM_HS_DRV)
###########################################################################################
# Target: UHC: uhc + libs
###########################################################################################
uhc: $(EHC_FOR_UHC_BLD_EXEC) $(EHC_UHC_INSTALL_VARIANT)/ehclibs
uhc-install: uhc
@rm -f $(UHC_INSTALL_EXEC)
@echo "Copying files to $(UHC_INSTALL_PREFIX) ..."
@mkdir -p $(UHC_INSTALL_PREFIX)
@$(call FUN_COPY_FILES_AND_RENAME,$(UHC_INSTALL_VARIANT_PREFIX),$(UHC_INSTALL_PREFIX),$(EHC_UHC_INSTALL_VARIANT),$(UHC_INSTALL_VARIANTNAME)) ; \
alltargets="`$(EHC_FOR_UHC_BLD_EXEC) --meta-targets`" ; \
echo "Postprocessing installation ..." ; \
for target in $${alltargets} ; \
do \
$(MAKE) uhc-install-postprocess-$${target} EHC_VARIANT_TARGET=$${target} ; \
done ; \
rm -f $(UHC_INSTALL_EXEC) ; \
mkdir -p $(INSTALL_UHC_BIN_PREFIX) ; \
$(STRIP) $(UHC_INSTALL_EHCBINARY) ; \
echo "Generating wrapper ..." ; \
$(call FUN_GEN_SHELL_ALIAS,$(UHC_INSTALL_EHCBINARY),$(UHC_INSTALL_SHELL),--cfg-install-root=$(TOPLEVEL_SYSTEM_ABSPATH_PREFIX)$(INSTALL_UHC_ROOT) --cfg-install-variant=$(UHC_INSTALL_VARIANTNAME))
@echo "Installation done"
# ln -s $(UHC_INSTALL_EHCBINARY) $(UHC_INSTALL_EXEC)
# $(UHC_INSTALL_EXEC) --meta-export-env=$(TOPLEVEL_SYSTEM_ABSPATH_PREFIX)$(INSTALL_UHC_ROOT),$(UHC_INSTALL_VARIANTNAME)
uhc-uninstall:
@echo "Removing installation $(UHC_INSTALL_PREFIX) ..."
rm -fr $(UHC_INSTALL_PREFIX) $(UHC_INSTALL_EXEC)
uhc-install-postprocess-bc:
@cd $(call FUN_DIR_VARIANT_LIB_TARGET_PREFIX,$(INSTALL_UHC_ROOT),$(UHC_INSTALL_VARIANTNAME),$(EHC_VARIANT_TARGET)) ; \
for pkg in $(EHC_PACKAGES_ASSUMED) ; \
do \
rm -f $${pkg}/$(EHCLIB_MAIN)* ; \
done
# rm -f $${pkg}/*.{hs,hs-cpp,c} $${pkg}/*/*.{hs,hs-cpp,c} $${pkg}/$(EHCLIB_MAIN)* ; \
uhc-install-postprocess-C:
@cd $(call FUN_DIR_VARIANT_LIB_TARGET_PREFIX,$(INSTALL_UHC_ROOT),$(UHC_INSTALL_VARIANTNAME),$(EHC_VARIANT_TARGET)) ; \
for pkg in $(EHC_PACKAGES_ASSUMED) ; \
do \
rm -f $${pkg}/$(EHCLIB_MAIN)* ; \
done
# rm -f $${pkg}/*.{hs,hs-cpp} $${pkg}/*/*.{hs,hs-cpp} $${pkg}/$(EHCLIB_MAIN)* ; \
uhc-install-postprocess-core:
uhc-install-postprocess-jazy:
uhc-install-postprocess-jscript:
uhc-install-postprocess-llvm:
# still to do: uhc --meta-export-env=$(INSTALL_UHC_LIB_PREFIX),$(UHC_EXEC_NAME)
###########################################################################################
# Target: UHC: installation
###########################################################################################
install: uhc-install
uninstall: uhc-uninstall
###########################################################################################
# Target: UHC: regression test
###########################################################################################
uhc-test: thaw-test-expect
@echo "WARNING: output may slightly differ for tests commented with 'platform',"
@echo " and (because of visible internal naming) for:" IO2.hs IO3.hs
$(MAKE) test-regress TEST_VARIANTS=uhc
test: uhc-test
###########################################################################################
# Target: clean build stuff
###########################################################################################
clean:
$(MAKE) cleans
$(MAKE) ruler-clean
$(MAKE) shuffle-clean
$(MAKE) libutil-clean
# @echo "NOTE: all but external libraries (gmp, ...) is cleaned. Use 'make clean-extlibs' for cleaning those."
clean-extlibs:
#$(MAKE) bgc-clean
#$(MAKE) gmp-clean
###########################################################################################
# Version incrementing/bumping
###########################################################################################
bump-major:
@echo $$(($(EH_VERSION_MAJOR)+1)).0.0 > VERSION ; \
echo "bumped version to `cat VERSION`"
bump-minor:
@echo $(EH_VERSION_MAJOR).$$(($(EH_VERSION_MINOR)+1)).0 > VERSION ; \
echo "bumped version to `cat VERSION`"
bump-minorminor:
@echo $(EH_VERSION_MAJOR).$(EH_VERSION_MINOR).$$(($(EH_VERSION_MINORMINOR)+1)) > VERSION ; \
echo "bumped version to `cat VERSION`"
###########################################################################################
# Releasing, construct distribution
###########################################################################################
# NOTE: not maintained for some time already; guaranteed to be broken
DISTS_DIR := $(BLD_PREFIX)dists
DIST_UHC_SRC_NM := uhc-$(TODAY)-$(EH_VERSION_FULL)-src
uhc-src-dist:
mkdir -p $(DISTS_DIR)/$(DIST_UHC_SRC_NM) ; \
( (tar cf - --exclude '.*' \
src \
ehclib extlibs \
doc/*-doc.pdf \
bin/filterOutEmptyFiles bin/agdepend bin/llvm-*.in \
test/files.mk test/regress/frozen-test-expect.tgz \
Makefile mk \
configure.ac configure install-sh config.sub config.guess \
Setup.hs \
VERSION README ANNOUNCE LICENSE \
) \
| (cd $(DISTS_DIR)/$(DIST_UHC_SRC_NM) && tar xf -) \
) ; \
$(call FUN_GEN_CABAL_EXEC \
, uhc \
, $(EH_VERSION_FULL) \
, mtl \
, \
, Utrecht Haskell Compiler \
, \
, \
) > $(DISTS_DIR)/$(DIST_UHC_SRC_NM)/uhc.cabal ; \
(cd $(DISTS_DIR) && tar cfj $(DIST_UHC_SRC_NM).tar.bz2 $(DIST_UHC_SRC_NM)) ; \
cp $(DISTS_DIR)/$(DIST_UHC_SRC_NM).tar.bz2 www
###########################################################################################
# Releasing, currently just svn copying
###########################################################################################
release:
cd ../.. ; \
svn cp trunk/EHC releases/$(EH_VERSION_FULL)
$(MAKE) uhc-src-dist
release-prepare:
$(MAKE) uhc
@echo "WARNING: password may be needed to install uhc"
sudo $(MAKE) install
$(MAKE) test-expect TEST_VARIANTS=uhc
$(MAKE) freeze-test-expect
###########################################################################################
# Target: try outs and debugging of make variable definitions
###########################################################################################
FUN_PREFIX2DIR = $(patsubst %/,%,$(1))
tst:
@echo $(INSABS_EHC_LIB_ALL_AG)
@echo $(EHC_AG_D_DDPDS_DERIV_AG)
tstv:
$(MAKE) INCLUDE_DERIVED_MK=yes EHC_VARIANT=100 tst
###########################################################################################
# Target: obsolete or to become so
###########################################################################################
#: afp-full ehcs doc grinis
# $(MAKE) initial-test-expect
rules2.tex: rules2.rul
$(RULER1) -l --base=rules $< | $(LHS2TEX) $(LHS2TEX_OPTS_POLY) > $@
A_EH_TEST := $(word 1,$(wildcard test/*.eh))
A_EH_TEST_EXP := $(addsuffix .exp$(VERSION_FIRST),$(A_EH_TEST))
$(A_EH_TEST_EXP): $(A_EH_TEST)
$(MAKE) test-expect
initial-test-expect: $(A_EH_TEST_EXP)
WWW_EXAMPLES_TMPL := www/ehc-examples-templ.html
WWW_EXAMPLES_HTML := www/ehc-examples.html
www-ex: $(WWW_EXAMPLES_HTML)
$(WWW_EXAMPLES_HTML): $(WWW_EXAMPLES_TMPL)
$(call PERL_SUBST_EHC,$(WWW_EXAMPLES_TMPL),$(WWW_EXAMPLES_HTML))
$(WWW_SRC_TGZ): $(DIST_TGZ)
cp $^ $@