Debian Codegraph @

Makefile.release

raw
1 # This file is part of Coccinelle, licensed under the terms of the GPL v2.
2 # See copyright.txt in the Coccinelle source code for more information.
3 # The Coccinelle source code can be obtained at http://coccinelle.lip6.fr
4
5 ##############################################################################
6 # Release rules to generate website archives
7 ##############################################################################
8
9 PACKAGE=$(PRJNAME)-$(VERSION)
10 CCPACKAGE=coccicheck-$(CCVERSION)
11
12 EXCLUDE=$(PACKAGE)/debian .depend
13
14 DOC=docs/manual/manual.pdf \
15 docs/manual/options.pdf \
16 docs/manual/main_grammar.pdf \
17 # docs/html \
18 # docs/man \
19 docs/spatch.1 \
20 docs/manual/cocci-python.txt
21 BINSRC=spatch* env.sh env.csh standard.h standard.iso \
22 *.txt $(DOC) demos/* scripts/spatch*
23 BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
24
25 EXCL=$(EXCLUDE:%=--exclude=%)
26 BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
27 BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
28
29 # TMP should point to a folder that is private to the release
30 # process. In addition, it should not be the direct parent of
31 # the directory in which the release is performed, because it
32 # creates temporary directories that in this case could have
33 # a name clash with the current directory.
34 ifndef TMP
35 TMP=/var/tmp
36 endif
37
38 # should be defined by Makefile.config
39 ifndef OCAMLVERSION
40 OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
41 endif
42
43 # can be overridden in the environment
44 ifndef GIT
45 GIT=git
46 endif
47
48 # the release process rewrites the Makefile.config, so we need
49 # to save important configure flags.
50
51 extra_configure_flags :=
52
53 # Procedure to do first time:
54 # cd ~/release
55 # git clone ... coccinelle
56 # cd coccinelle
57 #
58 # Procedure to do each time:
59 #
60 # 1) make prerelease # WARN: These will clean your local rep. of pending modifications
61 #
62 # UPDATE VERSION number in ./version
63 # and commit it with
64 #
65 # 2) make release
66 #
67 # 3) make package
68 #
69 # if WEBSITE is set properly, you can also run 'make website'
70 # Check that run an ocaml in /usr/bin
71
72 # The 'git rebase' is in there just in case you started with
73 # unpushed changes. However, that is probably something you should
74 # not do in the first place.
75
76 release-help:
77 @echo "To make a release, perform the following steps:"
78 @echo ""
79 @echo "1. Make sure that all changes are committed and pushed."
80 @echo " (making a release will destroy any uncommitted changes)"
81 @echo " Preferably, start from a fresh clone of the coccinelle repo."
82 @echo "2. Run 'make prerelease'. It will generate some files that are not"
83 @echo " in the repository but part of the release tarballs."
84 @echo "3. Edit ./version. It must be a new version."
85 @echo "4. Run 'make release'. It makes changes to the git repository that"
86 @echo " are not idempotent. Running this step again is likely to result"
87 @echo " in some git errors. These are not dramatic and are therefore"
88 @echo " ignored."
89 @echo "5. Run 'make package'. It will build many tarballs."
90 @echo "6. Run 'make website'. Make sure that $(WEBBASE) exists beforehand."
91 @echo " Hint: run step 5 and 6 directly after each other. The tarballs"
92 @echo " are stored temporarily in $(TMP)."
93 @echo "7. Updated some webpages and commit them to svn."
94
95 prerelease:
96 @echo "Pulling changes from the repository"
97 $(GIT) pull --rebase
98 $(MAKE) fix-expected
99 $(MAKE) distclean KEEP_CONFIG=1
100 @echo "\n\tEdit ./version"
101 @echo "\n\tRun ./autogen --ignore_localversion"
102 @echo "\tCommit with 'make release'\n"
103 @echo "\t* set the GIT env variable to 'echo' to skip performing any git commands"
104 @echo "\t* changes to files other than ./version will not be committed automatically."
105
106 fix-expected:
107 @echo "going to generate: tests/SCORE_expected_orig.sexp"
108 $(MAKE) distclean
109 ./autogen
110 ./configure --disable-python $(extra_configure_flags)
111 $(MAKE) opt-only
112 yes | ./spatch.opt -testall --iso-file ./standard.iso --macro-file-builtins ./standard.h
113 yes | ./spatch.opt -cpptestall --iso-file ./standard.iso --macro-file-builtins ./standard.h
114 cp tests/SCORE_actual.sexp tests/SCORE_expected_orig.sexp
115 @echo "generated: test/SCORE_expected_orig.sexp"
116
117 release:
118 @echo "Marking version: $(VERSION)"
119 $(GIT) add ./version
120 $(GIT) add setup/Makefile.in
121 $(GIT) commit -m "Release $(VERSION)"
122 $(GIT) tag -a -m "Release $(VERSION)" $(VERSION)
123 $(GIT) push origin $(VERSION) master:master
124 @echo "\n\tDo not commit any files from now on!"
125 @echo "\n\tRun 'make package'\n"
126
127 package:
128 $(MAKE) package-src
129 $(MAKE) package-nopython
130 $(MAKE) package-python
131 @echo "\tPut online with 'make website'"
132 @echo "\tThe coccinelle SVN repository must be in $(WEBBASE)\n"
133
134 package-src:
135 if [ ! -f ./configure ]; then ./autogen; fi
136 ./configure --disable-python --disable-pcre-syntax $(extra_configure_flags)
137 $(MAKE) srctar
138 $(MAKE) coccicheck
139
140 # Reconfigures the project without Python support
141 # Note: we disable pcre syntax as well to eliminate the dependency
142 # on those libraries.
143 package-nopython:
144 $(MAKE) distclean
145 ./autogen
146 ./configure --disable-python --disable-pcre-syntax --disable-menhirLib --disable-pycaml $(extra_configure_flags)
147 $(MAKE) bintar
148 $(MAKE) bytecodetar
149
150 # Reconfigure project with Python support
151 # Note: we disable pcre syntax as well to eliminate the dependency
152 # on those libraries.
153 package-python:
154 $(MAKE) distclean
155 ./autogen
156 ./configure --enable-python --disable-pcre-syntax --disable-menhirLib --disable-pycaml $(extra_configure_flags)
157 $(MAKE) bintar-python
158 $(MAKE) bytecodetar-python
159
160
161 # I currently pre-generate the parser so the user does not have to
162 # install menhir on his machine. We could also do a few cleanups.
163 #
164 # update: make docs generates pdf but also some ugly .log files, so
165 # make clean is there to remove them while not removing the pdf
166 # (only distclean remove the pdfs).
167 srctar: Makefile.config
168 $(MAKE) docs
169 $(MAKE) -C parsing_cocci parser_cocci_menhir.ml
170 $(MAKE) -C parsing_cocci parser_cocci_menhir.mli
171 $(MAKE) distclean KEEP_GENERATED=1 KEEP_CONFIG=1
172 if test -L "$(TMP)/$(PACKAGE)"; then rm -f "$(TMP)/$(PACKAGE)"; fi # remove it if it is a symlink
173 $(MKDIR_P) "$(TMP)/$(PACKAGE)/"
174 cp -fa ./* "$(TMP)/$(PACKAGE)/"
175 rm -f $(TMP)/$(PACKAGE)/Makefile.config
176 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
177 rm -rf $(TMP)/$(PACKAGE)
178
179 bintar: all-dev
180 $(MAKE) docs
181 rm -f $(TMP)/$(PACKAGE)
182 ln -s `pwd` $(TMP)/$(PACKAGE)
183 @if test -n "${PATCHELF}" -a -f spatch; then \
184 $(PATCHELF) --set-interpreter "/lib/ld-linux.so.2" --set-rpath "" spatch; fi
185 @if test -n "${PATCHELF}" -a -f spatch.opt; then \
186 $(PATCHELF) --set-interpreter "/lib/ld-linux.so.2" --set-rpath "" spatch.opt; fi
187 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
188 rm -f $(TMP)/$(PACKAGE)
189
190 staticbintar: all-release
191 $(MAKE) docs
192 rm -f $(TMP)/$(PACKAGE)
193 ln -s `pwd` $(TMP)/$(PACKAGE)
194 $(MAKE) static
195 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
196 rm -f $(TMP)/$(PACKAGE)
197
198 bytecodetar: all-dev
199 $(MAKE) docs
200 rm -f $(TMP)/$(PACKAGE)
201 ln -s `pwd` $(TMP)/$(PACKAGE)
202 $(MAKE) purebytecode
203 $(MAKE) copy-stubs
204 @if test -n "${PATCHELF}" -a -f dllpycaml_stubs.so; then \
205 $(PATCHELF) --set-rpath "" dllpycaml_stubs.so; fi
206 @if test -n "${PATHCELF}" -a -f dllpcre_stubs.so; then \
207 $(PATCHELF) --set-rpath "" dllpcre_stubs.so; fi
208 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2) $$(find -L $(PACKAGE) -maxdepth 1 -name 'dll*.so')
209 rm -f $(TMP)/$(PACKAGE)
210 rm -f dllpycaml_stubs.so dllpcre_stubs.so
211
212 bintar-python: all
213 $(MAKE) docs
214 @if test -n "${PATCHELF}" -a -f spatch; then \
215 $(PATCHELF) --set-interpreter "/lib/ld-linux.so.2" --set-rpath "" spatch; fi
216 @if test -n "${PATCHELF}" -a -f spatch.opt; then \
217 $(PATCHELF) --set-interpreter "/lib/ld-linux.so.2" --set-rpath "" spatch.opt; fi
218 rm -f $(TMP)/$(PACKAGE)
219 ln -s `pwd` $(TMP)/$(PACKAGE)
220 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
221 rm -f $(TMP)/$(PACKAGE)
222
223 bytecodetar-python: all-dev
224 $(MAKE) docs
225 rm -f $(TMP)/$(PACKAGE)
226 ln -s `pwd` $(TMP)/$(PACKAGE)
227 $(MAKE) purebytecode
228 $(MAKE) copy-stubs
229 @if test -n "${PATCHELF}" -a -f dllpycaml_stubs.so; then \
230 $(PATCHELF) --set-rpath "" dllpycaml_stubs.so; fi
231 @if test -n "${PATHCELF}" -a -f dllpcre_stubs.so; then \
232 $(PATCHELF) --set-rpath "" dllpcre_stubs.so; fi
233 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY) $$(find -L $(PACKAGE) -maxdepth 1 -name 'dll*.so')
234 rm -f $(TMP)/$(PACKAGE)
235 rm -f dllpycaml_stubs.so dllpcre_stubs.so
236
237 coccicheck:
238 cp -a ./scripts/coccicheck $(TMP)/$(CCPACKAGE)
239 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
240 rm -rf $(TMP)/$(CCPACKAGE)
241
242 clean-packages::
243 rm -f $(TMP)/$(PACKAGE).tgz
244 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
245 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
246 rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
247 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
248 rm -f $(TMP)/$(CCPACKAGE).tgz
249
250 # When checking out the source from diku sometimes I have some "X in the future"
251 # error messages.
252 fixdates:
253 echo do 'touch **/*.*'
254
255 ocamlversion:
256 @echo $(OCAMLVERSION)
257
258
259 ##############################################################################
260 # Packaging rules -- To build deb packages
261 ##############################################################################
262 #
263 # Run 'make packsrc' to build a Deb source package
264 #
265 # The package is prepared in $(TMP), usually /tmp
266 # Once the package has been build, it is uploaded
267 # to a PPA on launchpad.
268 #
269 # You should have a "coccinelle" project configured
270 # for dput in your ~/.dput.cf file.
271 #
272 # The 'packbin' target is to build a deb package
273 # locally. It is only for testing purpose.
274 #
275
276 EXCL_SYNC=--exclude ".git" \
277 --exclude ".gitignore" \
278 --exclude "tests" \
279 --exclude "TODO" \
280 --cvs-exclude
281
282 packsrc: prepack
283 $(MAKE) -C $(TMP)/$(PACKAGE)/debian
284 $(MAKE) push
285 rm -rf $(TMP)/$(PACKAGE)/
286
287 packbin: prepack
288 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
289 rm -rf $(TMP)/$(PACKAGE)/
290 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
291
292 prepack:
293 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
294 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
295 rm -rf $(TMP)/$(PACKAGE)/tools
296
297 push:
298 cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION)*_source.changes`; do dput $(PRJNAME) $$p ; done
299 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.changes
300 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.$(PRJNAME).upload
301 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.dsc
302 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.tar.gz
303
304 # Produces a source tarball
305 # Note: start from a fresh working directory
306 # Note: configure first
307 dist:
308 $(MAKE) docs
309 $(MAKE) -C parsing_cocci parser_cocci_menhir.ml
310 $(MAKE) distclean KEEP_CONFIG=1 KEEP_GENERATED=1
311 tar cvfz $(PACKAGE).tar.gz --transform="s,^,$(PACKAGE)/,S" --exclude=$(PACKAGE).tar.gz --exclude-backups --exclude-vcs *