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