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