Coccinelle release-1.0.0-rc11
[bpt/coccinelle.git] / Makefile.release
1
2 ##############################################################################
3 # Release rules to generate website archives
4 ##############################################################################
5
6 PACKAGE=$(PRJNAME)-$(VERSION)
7 CCPACKAGE=coccicheck-$(CCVERSION)
8
9 EXCLUDE=$(PACKAGE)/debian .depend
10
11 DOC=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
18 BINSRC=spatch env.sh env.csh standard.h standard.iso \
19 *.txt $(DOC) demos/*
20 BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
21
22 EXCL=$(EXCLUDE:%=--exclude=%)
23 BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
24 BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
25
26 TMP=/tmp
27 OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
28
29 # Procedure to do first time:
30 # cd ~/release
31 # git clone ... coccinelle
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 #
38 # UPDATE VERSION number in ./version
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
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
68 prerelease:
69 git pull --rebase
70 $(MAKE) fix-expected
71 $(MAKE) distclean
72 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
73 @echo "\n\tEdit ./version"
74 @echo "\tCommit with 'make release'\n"
75
76 fix-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
83 release:
84 sed -i -e 's|^let version = ".*"$$|let version = "$(VERSION)"|g' globals/config.ml.in
85 git add ./ version globals/config.ml.in
86 git commit -m "Release $(VERSION)"
87 git tag -a -m "Release $(VERSION)" $(VERSION)
88 git push --mirror
89 $(MAKE) licensify
90 @echo "\n\tRun 'make package'\n"
91
92 package:
93 $(MAKE) package-src
94 $(MAKE) package-nopython
95 $(MAKE) package-python
96 @echo "\tPut online with 'make website'"
97 @echo "\tThe coccinelle SVN repository must be in $(WEBBASE)\n"
98
99 package-src:
100 $(MAKE) distclean # Clean project
101 $(MAKE) srctar
102 $(MAKE) coccicheck
103
104 package-nopython:
105 $(MAKE) distclean # Clean project
106 ./configure --without-python
107 $(MAKE) bintar
108 $(MAKE) bytecodetar
109 # $(MAKE) staticbintar
110
111 package-python:
112 $(MAKE) distclean # Clean project
113 ./configure # Reconfigure project with Python support
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).
125 srctar:
126 $(MAKE) docs
127 $(MAKE) clean
128 cp -a . $(TMP)/$(PACKAGE)
129 cd $(TMP)/$(PACKAGE); cd parsing_cocci/; $(MAKE) parser_cocci_menhir.ml
130 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
131 rm -rf $(TMP)/$(PACKAGE)
132
133 bintar: all
134 $(MAKE) docs
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
140 staticbintar: all.opt
141 $(MAKE) docs
142 rm -f $(TMP)/$(PACKAGE)
143 ln -s `pwd` $(TMP)/$(PACKAGE)
144 $(MAKE) static
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 ?
149 bytecodetar: all
150 $(MAKE) docs
151 rm -f $(TMP)/$(PACKAGE)
152 ln -s `pwd` $(TMP)/$(PACKAGE)
153 $(MAKE) purebytecode
154 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
155 rm -f $(TMP)/$(PACKAGE)
156
157 bintar-python: all
158 $(MAKE) docs
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 ?
165 bytecodetar-python: all
166 $(MAKE) docs
167 rm -f $(TMP)/$(PACKAGE)
168 ln -s `pwd` $(TMP)/$(PACKAGE)
169 $(MAKE) purebytecode
170 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
171 rm -f $(TMP)/$(PACKAGE)
172
173 coccicheck:
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
178 clean-packages::
179 rm -f $(TMP)/$(PACKAGE).tgz
180 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
181 # rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
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 #
191 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
192 licensify:
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.
198 fixdates:
199 echo do 'touch **/*.*'
200
201 ocamlversion:
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
222 EXCL_SYNC=--exclude ".git" \
223 --exclude ".gitignore" \
224 --exclude ".cvsignore" \
225 --exclude ".svn" \
226 --exclude "tests" \
227 --exclude "TODO" \
228 --cvs-exclude
229
230 packsrc: prepack
231 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
232 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
233 $(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
234 $(MAKE) -C $(TMP)/$(PACKAGE)/debian natty
235 $(MAKE) push
236 rm -rf $(TMP)/$(PACKAGE)/
237
238 packbin: prepack
239 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
240 rm -rf $(TMP)/$(PACKAGE)/
241 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
242
243 prepack:
244 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
245 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
246 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
247 rm -rf $(TMP)/$(PACKAGE)/tools
248
249 push:
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
255
256 # Produces a source tarball
257 # Note: start from a fresh working directory
258 # Note: configure first
259 dist:
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 *