forked from coccinelle/coccinelle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.release
250 lines (213 loc) · 7.26 KB
/
Makefile.release
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
##############################################################################
# Release rules to generate website archives
##############################################################################
PACKAGE=$(PRJNAME)-$(VERSION)
CCPACKAGE=coccicheck-$(CCVERSION)
EXCLUDE=$(PACKAGE)/debian .depend
DOC=docs/manual/manual.pdf \
docs/manual/options.pdf \
docs/manual/main_grammar.pdf \
docs/html \
docs/man \
docs/spatch.1 \
docs/manual/cocci-python.txt
BINSRC=spatch env.sh env.csh standard.h standard.iso \
*.txt $(DOC) demos/*
BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
EXCL=$(EXCLUDE:%=--exclude=%)
BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
TMP=/tmp
OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
# Procedure to do first time:
# cd ~/release
# cvs checkout coccinelle -dP
# cd coccinelle
#
# Procedure to do each time:
#
# 1) make prerelease # WARN: These will clean your local rep. of pending modifications
#
# UPDATE VERSION number in globals/config.ml.in
# and commit it with
#
# 2) make release
#
# The project is then automatically licensified.
#
# Remember to comment the -g -dtypes in this Makefile
# You can also remove a few things, for instance I removed in this
# Makefile things related to popl/ and popl09/
# make sure that ocaml is the distribution ocaml of /usr/bin, not ~pad/...
#
# 3) make package
#
# if WEBSITE is set properly, you can also run 'make website'
# Check that run an ocaml in /usr/bin
# To test you can try compile and run spatch from different instances
# like my ~/coccinelle, ~/release/coccinelle, and the /tmp/coccinelle-0.X
# downloaded from the website.
# For 'make srctar' it must done from a clean
# repo such as ~/release/coccinelle. It must also be a repo where
# the scripts/licensify has been run at least once.
# For the 'make bintar' I can do it from my original repo.
prerelease:
cvs up -CdP
$(MAKE) fix-expected
$(MAKE) distclean
sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
@echo "\n\tEdit globals/config.ml.in"
@echo "\tCommit with 'make release'\n"
fix-expected:
$(MAKE) distclean
./configure --without-python
$(MAKE) world
yes | ./spatch.opt -testall
cp tests/SCORE_actual.sexp tests/SCORE_expected_orig.sexp
release:
cvs ci -m "Release $(VERSION)" globals/config.ml.in
$(MAKE) licensify
@echo "\n\tRun 'make package'\n"
package:
$(MAKE) package-src
$(MAKE) package-nopython
$(MAKE) package-python
@echo "\tPut online with 'make website'"
@echo "\tThe coccinelle CVS repository must be in $(WEBBASE)\n"
package-src:
$(MAKE) distclean # Clean project
$(MAKE) srctar
$(MAKE) coccicheck
package-nopython:
$(MAKE) distclean # Clean project
./configure --without-python
$(MAKE) bintar
$(MAKE) bytecodetar
# $(MAKE) staticbintar
package-python:
$(MAKE) distclean # Clean project
./configure # Reconfigure project with Python support
$(MAKE) bintar-python
$(MAKE) bytecodetar-python
# I currently pre-generate the parser so the user does not have to
# install menhir on his machine. We could also do a few cleanups.
# You may have first to do a 'make licensify'.
#
# update: make docs generates pdf but also some ugly .log files, so
# make clean is there to remove them while not removing the pdf
# (only distclean remove the pdfs).
srctar:
$(MAKE) docs
$(MAKE) clean
cp -a . $(TMP)/$(PACKAGE)
cd $(TMP)/$(PACKAGE); cd parsing_cocci/; $(MAKE) parser_cocci_menhir.ml
cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
rm -rf $(TMP)/$(PACKAGE)
bintar: all
$(MAKE) docs
rm -f $(TMP)/$(PACKAGE)
ln -s `pwd` $(TMP)/$(PACKAGE)
cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
rm -f $(TMP)/$(PACKAGE)
staticbintar: all.opt
$(MAKE) docs
rm -f $(TMP)/$(PACKAGE)
ln -s `pwd` $(TMP)/$(PACKAGE)
$(MAKE) static
cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
rm -f $(TMP)/$(PACKAGE)
# add ocaml version in name ?
bytecodetar: all
$(MAKE) docs
rm -f $(TMP)/$(PACKAGE)
ln -s `pwd` $(TMP)/$(PACKAGE)
$(MAKE) purebytecode
cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
rm -f $(TMP)/$(PACKAGE)
bintar-python: all
$(MAKE) docs
rm -f $(TMP)/$(PACKAGE)
ln -s `pwd` $(TMP)/$(PACKAGE)
cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
rm -f $(TMP)/$(PACKAGE)
# add ocaml version in name ?
bytecodetar-python: all
$(MAKE) docs
rm -f $(TMP)/$(PACKAGE)
ln -s `pwd` $(TMP)/$(PACKAGE)
$(MAKE) purebytecode
cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
rm -f $(TMP)/$(PACKAGE)
coccicheck:
cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
rm -rf $(TMP)/$(CCPACKAGE)
clean-packages::
rm -f $(TMP)/$(PACKAGE).tgz
rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
# rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
rm -f $(TMP)/$(CCPACKAGE).tgz
#
# No need to licensify 'demos'. Because these is basic building blocks
# to use SmPL.
#
TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
licensify:
ocaml str.cma tools/licensify.ml
set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml str.cma ../tools/licensify.ml; cd ..; done
# When checking out the source from diku sometimes I have some "X in the future"
# error messages.
fixdates:
echo do 'touch **/*.*'
#fixCVS:
# cvs update -d -P
# echo do 'rm -rf **/CVS'
ocamlversion:
@echo $(OCAMLVERSION)
##############################################################################
# Packaging rules -- To build deb packages
##############################################################################
#
# Run 'make packsrc' to build a Deb source package
#
# The package is prepared in $(TMP), usually /tmp
# Once the package has been build, it is uploaded
# to a PPA on launchpad.
#
# You should have a "coccinelle" project configured
# for dput in your ~/.dput.cf file.
#
# The 'packbin' target is to build a deb package
# locally. It is only for testing purpose.
#
EXCL_SYNC=--exclude ".git" \
--exclude ".gitignore" \
--exclude ".cvsignore" \
--exclude "tests" \
--exclude "TODO" \
--cvs-exclude
packsrc: prepack
$(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
$(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
$(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
$(MAKE) -C $(TMP)/$(PACKAGE)/debian natty
$(MAKE) push
rm -rf $(TMP)/$(PACKAGE)/
packbin: prepack
$(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
rm -rf $(TMP)/$(PACKAGE)/
rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
prepack:
rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
$(MAKE) -C $(TMP)/$(PACKAGE) licensify
sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
rm -rf $(TMP)/$(PACKAGE)/tools
push:
cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION)*_source.changes`; do dput $(PRJNAME) $$p ; done
rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.changes
rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.$(PRJNAME).upload
rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.dsc
rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.tar.gz