Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / Makefile.release
CommitLineData
5636bb2c
C
1
2##############################################################################
3# Release rules to generate website archives
4##############################################################################
5
6PACKAGE=$(PRJNAME)-$(VERSION)
7CCPACKAGE=coccicheck-$(CCVERSION)
8
65038c61 9EXCLUDE=$(PACKAGE)/debian .depend
5636bb2c 10
f3c4ece6
C
11DOC=docs/manual/manual.pdf \
12 docs/manual/options.pdf \
13 docs/manual/main_grammar.pdf \
14 docs/html \
15 docs/man \
16 docs/spatch.1 \
17 docs/manual/cocci-python.txt
5636bb2c 18BINSRC=spatch env.sh env.csh standard.h standard.iso \
f3c4ece6 19 *.txt $(DOC) demos/*
5636bb2c
C
20BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
21
65038c61 22EXCL=$(EXCLUDE:%=--exclude=%)
5636bb2c
C
23BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
24BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
25
26TMP=/tmp
27OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
28
29# Procedure to do first time:
30# cd ~/release
97111a47 31# git clone ... coccinelle
5636bb2c
C
32# cd coccinelle
33#
34# Procedure to do each time:
35#
36# 1) make prerelease # WARN: These will clean your local rep. of pending modifications
37#
17ba0788 38# UPDATE VERSION number in ./version
5636bb2c
C
39# and commit it with
40#
41# 2) make release
42#
43# The project is then automatically licensified.
44#
45# Remember to comment the -g -dtypes in this Makefile
46# You can also remove a few things, for instance I removed in this
47# Makefile things related to popl/ and popl09/
48# make sure that ocaml is the distribution ocaml of /usr/bin, not ~pad/...
49#
50# 3) make package
51#
52# if WEBSITE is set properly, you can also run 'make website'
53# Check that run an ocaml in /usr/bin
54
55# To test you can try compile and run spatch from different instances
56# like my ~/coccinelle, ~/release/coccinelle, and the /tmp/coccinelle-0.X
57# downloaded from the website.
58
59# For 'make srctar' it must done from a clean
60# repo such as ~/release/coccinelle. It must also be a repo where
61# the scripts/licensify has been run at least once.
62# For the 'make bintar' I can do it from my original repo.
63
97111a47
C
64# The 'git rebase' is in there just in case you started with
65# unpushed changes. However, that is probably something you should
66# not do in the first place.
67
5636bb2c 68prerelease:
97111a47 69 git pull --rebase
8babbc8f 70 $(MAKE) fix-expected
5636bb2c
C
71 $(MAKE) distclean
72 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
17ba0788 73 @echo "\n\tEdit ./version"
174d1640 74 @echo "\tCommit with 'make release'\n"
5636bb2c 75
8babbc8f
C
76fix-expected:
77 $(MAKE) distclean
78 ./configure --without-python
79 $(MAKE) world
80 yes | ./spatch.opt -testall
81 cp tests/SCORE_actual.sexp tests/SCORE_expected_orig.sexp
82
5636bb2c 83release:
17ba0788
C
84 sed -i -e 's|^let version = ".*"$$|let version = "$(VERSION)"|g' globals/config.ml.in
85 git add ./ version globals/config.ml.in
97111a47
C
86 git commit -m "Release $(VERSION)"
87 git tag -a -m "Release $(VERSION)" $(VERSION)
88 git push --mirror
5636bb2c 89 $(MAKE) licensify
174d1640 90 @echo "\n\tRun 'make package'\n"
5636bb2c
C
91
92package:
93 $(MAKE) package-src
94 $(MAKE) package-nopython
95 $(MAKE) package-python
785a3008 96 @echo "\tPut online with 'make website'"
97111a47 97 @echo "\tThe coccinelle SVN repository must be in $(WEBBASE)\n"
5636bb2c
C
98
99package-src:
100 $(MAKE) distclean # Clean project
101 $(MAKE) srctar
102 $(MAKE) coccicheck
103
104package-nopython:
105 $(MAKE) distclean # Clean project
106 ./configure --without-python
5636bb2c
C
107 $(MAKE) bintar
108 $(MAKE) bytecodetar
3a314143 109# $(MAKE) staticbintar
5636bb2c
C
110
111package-python:
112 $(MAKE) distclean # Clean project
113 ./configure # Reconfigure project with Python support
5636bb2c
C
114 $(MAKE) bintar-python
115 $(MAKE) bytecodetar-python
116
117
118# I currently pre-generate the parser so the user does not have to
119# install menhir on his machine. We could also do a few cleanups.
120# You may have first to do a 'make licensify'.
121#
122# update: make docs generates pdf but also some ugly .log files, so
123# make clean is there to remove them while not removing the pdf
124# (only distclean remove the pdfs).
125srctar:
174d1640
C
126 $(MAKE) docs
127 $(MAKE) clean
5636bb2c 128 cp -a . $(TMP)/$(PACKAGE)
174d1640 129 cd $(TMP)/$(PACKAGE); cd parsing_cocci/; $(MAKE) parser_cocci_menhir.ml
5636bb2c
C
130 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
131 rm -rf $(TMP)/$(PACKAGE)
132
5636bb2c 133bintar: all
f3c4ece6 134 $(MAKE) docs
5636bb2c
C
135 rm -f $(TMP)/$(PACKAGE)
136 ln -s `pwd` $(TMP)/$(PACKAGE)
137 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
138 rm -f $(TMP)/$(PACKAGE)
139
140staticbintar: all.opt
f3c4ece6 141 $(MAKE) docs
5636bb2c
C
142 rm -f $(TMP)/$(PACKAGE)
143 ln -s `pwd` $(TMP)/$(PACKAGE)
174d1640 144 $(MAKE) static
5636bb2c
C
145 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
146 rm -f $(TMP)/$(PACKAGE)
147
148# add ocaml version in name ?
149bytecodetar: all
f3c4ece6 150 $(MAKE) docs
5636bb2c
C
151 rm -f $(TMP)/$(PACKAGE)
152 ln -s `pwd` $(TMP)/$(PACKAGE)
174d1640 153 $(MAKE) purebytecode
5636bb2c
C
154 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
155 rm -f $(TMP)/$(PACKAGE)
156
157bintar-python: all
f3c4ece6 158 $(MAKE) docs
5636bb2c
C
159 rm -f $(TMP)/$(PACKAGE)
160 ln -s `pwd` $(TMP)/$(PACKAGE)
161 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
162 rm -f $(TMP)/$(PACKAGE)
163
164# add ocaml version in name ?
165bytecodetar-python: all
f3c4ece6 166 $(MAKE) docs
5636bb2c
C
167 rm -f $(TMP)/$(PACKAGE)
168 ln -s `pwd` $(TMP)/$(PACKAGE)
174d1640 169 $(MAKE) purebytecode
5636bb2c
C
170 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
171 rm -f $(TMP)/$(PACKAGE)
172
173coccicheck:
174 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
175 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
176 rm -rf $(TMP)/$(CCPACKAGE)
177
178clean-packages::
179 rm -f $(TMP)/$(PACKAGE).tgz
180 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
3a314143 181# rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
5636bb2c
C
182 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
183 rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
184 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
185 rm -f $(TMP)/$(CCPACKAGE).tgz
186
187#
188# No need to licensify 'demos'. Because these is basic building blocks
189# to use SmPL.
190#
191TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
192licensify:
193 ocaml str.cma tools/licensify.ml
194 set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml str.cma ../tools/licensify.ml; cd ..; done
195
196# When checking out the source from diku sometimes I have some "X in the future"
197# error messages.
198fixdates:
199 echo do 'touch **/*.*'
200
5636bb2c
C
201ocamlversion:
202 @echo $(OCAMLVERSION)
203
204
205##############################################################################
206# Packaging rules -- To build deb packages
207##############################################################################
208#
209# Run 'make packsrc' to build a Deb source package
210#
211# The package is prepared in $(TMP), usually /tmp
212# Once the package has been build, it is uploaded
213# to a PPA on launchpad.
214#
215# You should have a "coccinelle" project configured
216# for dput in your ~/.dput.cf file.
217#
218# The 'packbin' target is to build a deb package
219# locally. It is only for testing purpose.
220#
221
222EXCL_SYNC=--exclude ".git" \
223 --exclude ".gitignore" \
224 --exclude ".cvsignore" \
97111a47 225 --exclude ".svn" \
5636bb2c
C
226 --exclude "tests" \
227 --exclude "TODO" \
228 --cvs-exclude
229
230packsrc: prepack
231 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
232 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
e6509c05 233 $(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
8babbc8f 234 $(MAKE) -C $(TMP)/$(PACKAGE)/debian natty
5636bb2c
C
235 $(MAKE) push
236 rm -rf $(TMP)/$(PACKAGE)/
237
238packbin: prepack
239 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
240 rm -rf $(TMP)/$(PACKAGE)/
aba5c457 241 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
5636bb2c
C
242
243prepack:
244 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
245 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
1eddfd50 246 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
5636bb2c
C
247 rm -rf $(TMP)/$(PACKAGE)/tools
248
249push:
aba5c457
C
250 cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION)*_source.changes`; do dput $(PRJNAME) $$p ; done
251 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.changes
252 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.$(PRJNAME).upload
253 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.dsc
254 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.tar.gz
174d1640 255
17ba0788
C
256# Produces a source tarball
257# Note: start from a fresh working directory
258# Note: configure first
259dist:
260 $(MAKE) licensify
261 $(MAKE) docs
262 $(MAKE) clean
263 tar cvfz $(PACKAGE).tar.gz --transform="s,^,$(PACKAGE)/,S" --exclude=$(PACKAGE).tar.gz --exclude-backups --exclude-vcs *