-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
144 lines (105 loc) · 3.97 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
#-----------------------------------------------------------------------------
# PXSL Makefile
#
# CVS: $Id: Makefile,v 1.11 2005/01/27 14:43:52 thor Exp $
#
# Copyright (C) 2003-07 Tom Moertel <[email protected]>
# Licensed under the terms of the GNU General Public License.
# See the LICENSE file in the project distribution for details.
#-----------------------------------------------------------------------------
PROJECT = pxsl
VERSION = 1.0.2
TARGETS = dist/build/pxslcc/pxslcc
DOCDIR = docs
TESTDIR = tests
MIRRORHOST =
SPECFILE = pxsl-tools.spec
DISTDIR = sources/$(PROJECT)-$(VERSION)
TARBALL = $(DISTDIR).tar.gz
BINDISTDIR = Linux-binaries/$(PROJECT)-$(VERSION)-$(shell uname -ms | tr 'A-Z ' 'a-z-')
BINTARGETS := README $(TARGETS) examples
HASKELL := $(wildcard src/*.hs src/*.hs.in)
TESTS_IN := $(wildcard $(TESTDIR)/*.xsl)
TESTS_OUT_PXSL := $(TESTS_IN:.xsl=.pxsl)
TESTS_OUT_XSL2 := $(TESTS_IN:.xsl=.xsl2)
TESTS_OUT_DIFF := $(TESTS_IN:.xsl=.diff)
TESTS_OUT_PXSL2 := $(TESTS_IN:.xsl=.pxsl2)
DIST_MANIFEST := README README.html LICENSE Makefile xsl2pxsl.xsl \
text-to-html.pl $(HASKELL) examples TODO \
$(SPECFILE)
GENERATED := $(sort $(TARGETS) $(TESTS_OUT_PXSL) $(TESTS_OUT_XSL2) \
$(TESTS_OUT_PXSL2) $(TESTS_OUT_DIFF))
YEAR2 := $(shell date +%y)
#-----------------------------------------------------------------------------
# top level targets: all docs dist
#-----------------------------------------------------------------------------
.PHONY : all allfast allopt allstatic dist bindist
all : $(TARGETS) README.html
allfast : ; make GHC_OPT='' all
allopt : ; make GHC_OPT='-O2' all
allstatic : ; make GHC_OPT='-O2 -optl-static' all
dist : $(DISTDIR)
bindist : $(BINDISTDIR)
$(DISTDIR) : $(DIST_MANIFEST)
mkdir -p $@
rm -rf $@
rsync -avC --delete-excluded $(DIST_MANIFEST) $@/
echo $(DIST_MANIFEST) | tr ' ' \\012 > $@/MANIFEST
touch $@
cd $(dir $@) && \
rm -f $(notdir [email protected]) && \
tar zcf $(notdir [email protected]) $(notdir $@)
$(BINDISTDIR) : $(BINTARGETS)
@[ -d $@ ] || mkdir -p $@
rsync -avC $(BINTARGETS) $@/
touch $@
rm -f [email protected] && tar zcf [email protected] $@
$(DOCDIR) : $(HASKELL)
@[ -d $@ ] || mkdir -p $@
haddock --html -o $(DOCDIR) $(HASKELL) && touch $@
.PHONY : test
test : $(TESTS_OUT_PXSL2) $(TESTS_OUT_DIFF)
.PHONY : rpms
rpms : dist
rpmbuild -ta $(TARBALL)
.PHONY : mirror
mirror : README-online.html
rsync -e ssh -avC README-online.html $(MIRRORHOST)/pxsl/README.html
rsync -e ssh -avRC examples sources/*.gz Linux-binaries/*.gz \
$(MIRRORHOST)/pxsl/
rsync -e ssh -avC $(HOME)/rpm/RPMS/*/pxsl*rpm $(HOME)/rpm/SRPMS/pxsl*rpm \
$(MIRRORHOST)/pxsl/RPMS
README-online.html : README.html
perl -lpe'BEGIN{print "<!--"} s{(<body>)}{$$1 -->}i' $< > $@
#-----------------------------------------------------------------------------
# helpers
#-----------------------------------------------------------------------------
# run tests
.SECONDARY : $(TESTS_OUT_PXSL) $(TESTS_OUT_XSL2)
%.pxsl : %.xsl xsl2pxsl.xsl ; xsltproc xsl2pxsl.xsl $< > $@
%.xsl2 : %.pxsl $(TARGETS) ; ./pxslcc -i --xslt $< > $@
%.pxsl2 : %.xsl2 xsl2pxsl.xsl ; xsltproc xsl2pxsl.xsl $< > $@
%.diff : %.xsl %.xsl2 ; diff -uw $^ > $@ || :
# build rules for Haskell
dist/build/pxslcc/pxslcc : $(HASKELL) Makefile
sed -e 's/@VERSION@/$(VERSION)/' -e 's/@YEAR@/$(YEAR2)/' src/pxslcc.hs.in > src/pxslcc.hs
runhaskell Setup.lhs configure
runhaskell Setup.lhs build
# make README.html from README
README.html : README text-to-html.pl
perl text-to-html.pl $< > $@
# stamp RPM spec files
%.spec : %.spec.in Makefile
perl -pe's/\@\@VERSION\@\@/$(VERSION)/g;' $< > $@
# maintenance rules
.PHONY : clean
clean :
rm -f *.o *.hi src/*.o src/*.hi src/*.bak $(GENERATED)
rm -rf $(DOCDIR)
.PHONY : cleandeps
cleandeps :
rm -f *.d
.PHONY : squeakyclean
squeakyclean : clean cleandeps
TAGS : $(HASKELL)
hasktags $(HASKELL)