-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
165 lines (130 loc) · 4.46 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
# The Makefile is for the following PolyP-version
export polyp_version = 2.${shell date +%y%m%d}
default: ghc
# Choose the desired version of Haskell ...
export HASKELLVERSION = 98
# ... and of the compiler
export ghc = ghc
export hbc = hbc
export hugs = runhugs
TAR = tar
# TAR = gtar
POLYPDIR = ${shell pwd}
INSTALLBINDIR = ${HOME}/bin
LN_S = ln -s
INSTALL = ./install-sh
MKINSTALLDIRS = ./mkinstalldirs
help:
@echo Makefile for PolyP by Patrik Jansson
@echo Usage:
@echo " gmake X where X is ghc (or hbc or hugs)"
@echo " makes the sources and compiles them with compiler X"
@echo " gmake install"
@echo " installs into " $INSTALLBINDIR
@echo " gmake check.X"
@echo " runs some regression tests."
# Use some version of the PolyP compiler in the bin directory
# with polyp (somewhere on the path) as a fall-back option
export PolyP := ${firstword ${wildcard ${POLYPDIR}/bin/*polyp} polyp}
# For a quick test of PolyP - use hugs to avoid compilation
# Make PolyP using hugs, ghc or hbc
hugs ghc hbc: bin/chase
# Make the source
-mkdir $@src
${MAKE} -C src $@src "hc=${$@}"
# compile[1] the source
${MAKE} -C $@src "hc=${$@}"
@echo Read the files src/[email protected] and USAGE for details on how to run PolyP
# compile (with the new polyp) the standard library PolyLib
${MAKE} -C polylib all
${INSTALLBINDIR}:
${MKINSTALLDIRS} ${INSTALLBINDIR}
install: ${INSTALLBINDIR} ghc
${INSTALL} -m 755 ${POLYPDIR}/bin/ghcpolyp ${INSTALLBINDIR}/ghcpolyp
-${LN_S} ${INSTALLBINDIR}/ghcpolyp ${INSTALLBINDIR}/polyp
${INSTALL} -m 755 ${POLYPDIR}/bin/chase ${INSTALLBINDIR}/chase
# [1] For hbc and ghc the source is really compiled, but as hugs is an
# interpreter, its makefile only provides a name for the call to
# runhugs hugssrc/Main.lhs
# Run some regression tests
# -s makes the testcompilations silent (unless there is an error)
check: ghc boilerplate.mk
${MAKE} -e -s -C examples check
${MAKE} -e -s -C test check
check.% : % boilerplate.mk
${MAKE} -e -s -C examples check PolyP=../bin/$*polyp
${MAKE} -e -s -C test check PolyP=../bin/$*polyp
# compile with all three compilers and check the results
checkdist: check.ghc check.hbc check.hugs
POLYLIBDIR = ${POLYPDIR}/polylib
PERL = ${shell which perl}
bin/chase: src/chase.in
mkdir -p bin
echo '#!'${PERL} > bin/chase
echo '$$POLYLIBDIR='\'${POLYLIBDIR}\'\; >>bin/chase
cat src/chase.in >> bin/chase
chmod +x bin/chase
boilerplate.mk:
echo POLYPDIR=${POLYPDIR} > boilerplate.mk
oldhugs:
# Make the source for older (before ~1998) versions of hugs
-mkdir hugssrc
${MAKE} -C src $@src
clean:
rm -f *~
rm -f \#*\#
${MAKE} -C src clean
rm -f polylib/*~
rm -f docs/*~
-${MAKE} -C examples clean
${MAKE} -C polylib clean
${MAKE} -C book clean
rm -fr polyp-${polyp_version} polyp-${polyp_version}.tar.gz
veryclean: clean
${MAKE} -C src veryclean
rm -fr hugssrc
rm -fr hbcsrc
rm -fr ghcsrc
${MAKE} -C examples veryclean
${MAKE} -C book veryclean
distclean: veryclean
rm -f bin/hugspolyp bin/ghcpolyp bin/hbcpolyp bin/polyp bin/chase
# Distribution
dist: polyp-${polyp_version}.tar.gz
polyp-${polyp_version}:
-rm -r $@
cvs export -D now -d $@ PolyP
polyp-${polyp_version}.tar.gz: polyp-${polyp_version}
-rm -r $@
${TAR} -zcf $@ $<
WWWDIR = ${HOME}/pub/www/poly
www: polyp-${polyp_version}.tar.gz
cp polyp-${polyp_version}.tar.gz ${WWWDIR}
cd ${WWWDIR}; ${MAKE} -e polyp-${polyp_version}
rm -rf polyp-${polyp_version}.tar.gz polyp-${polyp_version}
# make `-e' `--environment-overrides'
# Give variables taken from the environment precedence over
# variables from makefiles. Used here to export ${polyp_version}
packpolylib:
${TAR} -zcf polylib.tar.gz polylib examples
local: polyp-${polyp_version}
${MAKE} -C polyp-${polyp_version} ghc
${MAKE} -C polyp-${polyp_version} check.ghc
cp polyp-${polyp_version}/bin/ghcpolyp ${HOME}/bin/polyp
@echo Skicka brev lokalt och meddela detta
fromwww:
lynx -source 'http://www.cs.chalmers.se/~patrikj/poly/polyp.tar.gz'\
> polyp.tar.gz
gunzip < polyp.tar.gz | tar xf -
cd polyp-${polyp_version}; ${MAKE} check.ghc
WEBSITE = http://www.cs.chalmers.se/~patrikj/poly/polyp/
WEBDIR = ${HOME}/pub/www/poly/polyp
README: index.html
mv ${WEBDIR}/index.html qqq
cp index.html ${WEBDIR}
lynx -dump ${WEBSITE} >README
mv qqq ${WEBDIR}/index.html
# These targets are not real files
.PHONY: help install hugs ghc hbc clean distclean packpolylib \
www fromwww local installdirs
# for some reason, checkhbc, checkghc, checkhugs should not be in that list