2 ##############################################################################
3 # Release rules to generate website archives
4 ##############################################################################
6 PACKAGE=$(PRJNAME)-$(VERSION)
7 CCPACKAGE=coccicheck-$(CCVERSION)
9 EXCLUDE=$(PACKAGE)/debian .depend
11 DOC=docs/manual/manual.pdf \
12 docs/manual/options.pdf \
13 docs/manual/main_grammar.pdf \
17 docs/manual/cocci-python.txt
18 BINSRC=spatch* env.sh env.csh standard.h standard.iso \
19 *.txt $(DOC) demos/* scripts/spatch*
20 BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
22 EXCL=$(EXCLUDE:%=--exclude=%)
23 BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
24 BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
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.
35 # should be defined by Makefile.config
37 OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
40 # can be overriden in the environment
45 # the release process rewrites the Makefile.config, so we need
46 # to save important configure flags.
47 remember_ocamlbuild:=$(FEATURE_OCAMLBUILD)
49 ifeq ($(remember_ocamlbuild),yes)
50 extra_configure_flags := --enable-ocamlbuild
52 extra_configure_flags :=
57 # Procedure to do first time:
59 # git clone ... coccinelle
62 # Procedure to do each time:
64 # 1) make prerelease # WARN: These will clean your local rep. of pending modifications
66 # UPDATE VERSION number in ./version
71 # The project is then automatically licensified.
75 # if WEBSITE is set properly, you can also run 'make website'
76 # Check that run an ocaml in /usr/bin
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.
83 @echo "To make a release, perform the following steps:"
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"
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."
102 @echo "pulling changes from the repository"
105 $(MAKE) distclean KEEP_CONFIG=1
106 @echo "\n\tEdit ./version"
107 @echo "\tCommit with 'make release'\n"
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."
112 @echo "going to generate: tests/SCORE_expected_orig.sexp"
114 ./configure --enable-release --disable-python $(extra_configure_flags)
116 yes | ./spatch.opt -testall --iso-file ./standard.iso --macro-file-builtins ./standard.h
117 cp tests/SCORE_actual.sexp tests/SCORE_expected_orig.sexp
118 @echo "generated: test/SCORE_expected_orig.sexp"
121 @echo "Marking version: $(VERSION)"
122 echo -n "$(VERSION)" > ./version
124 -$(GIT) commit -m "Release $(VERSION)"
125 -$(GIT) tag -a -m "Release $(VERSION)" $(VERSION)
128 @echo "\n\tLicensify has run: do not commit any files from now on!"
129 @echo "\n\tRun 'make package'\n"
133 $(MAKE) package-nopython
134 $(MAKE) package-python
135 @echo "\tPut online with 'make website'"
136 @echo "\tThe coccinelle SVN repository must be in $(WEBBASE)\n"
139 ./configure --enable-release --disable-python --disable-pcre-syntax $(extra_configure_flags)
143 # Reconfigures the project without Python support
144 # Note: we disable pcre syntax as well to eliminate the dependency
145 # on those libraries.
148 ./configure --enable-release --disable-python --disable-pcre-syntax --disable-menhirLib --disable-pycaml $(extra_configure_flags)
152 # Reconfigure project with Python support
153 # Note: we disable pcre syntax as well to eliminate the dependency
154 # on those libraries.
157 ./configure --enable-release --enable-python --disable-pcre-syntax --disable-menhirLib --disable-pycaml $(extra_configure_flags)
158 $(MAKE) bintar-python
159 $(MAKE) bytecodetar-python
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'.
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).
169 srctar: Makefile.config
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
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)/"
177 rm -f $(TMP)/$(PACKAGE)/Makefile.config
178 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
179 rm -rf $(TMP)/$(PACKAGE)
183 rm -f $(TMP)/$(PACKAGE)
184 ln -s `pwd` $(TMP)/$(PACKAGE)
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
189 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
190 rm -f $(TMP)/$(PACKAGE)
192 staticbintar: all-release
194 rm -f $(TMP)/$(PACKAGE)
195 ln -s `pwd` $(TMP)/$(PACKAGE)
197 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
198 rm -f $(TMP)/$(PACKAGE)
202 rm -f $(TMP)/$(PACKAGE)
203 ln -s `pwd` $(TMP)/$(PACKAGE)
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')
211 rm -f $(TMP)/$(PACKAGE)
212 rm -f dllpycaml_stubs.so dllpcre_stubs.so
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
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)
225 bytecodetar-python: all-dev
227 rm -f $(TMP)/$(PACKAGE)
228 ln -s `pwd` $(TMP)/$(PACKAGE)
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')
236 rm -f $(TMP)/$(PACKAGE)
237 rm -f dllpycaml_stubs.so dllpcre_stubs.so
240 cp -a ./scripts/coccicheck $(TMP)/$(CCPACKAGE)
241 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
242 rm -rf $(TMP)/$(CCPACKAGE)
245 rm -f $(TMP)/$(PACKAGE).tgz
246 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
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
253 # No need to licensify 'demos'. Because these are basic building blocks
256 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
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
261 # When checking out the source from diku sometimes I have some "X in the future"
264 echo do 'touch **/*.*'
267 @echo $(OCAMLVERSION)
270 ##############################################################################
271 # Packaging rules -- To build deb packages
272 ##############################################################################
274 # Run 'make packsrc' to build a Deb source package
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.
280 # You should have a "coccinelle" project configured
281 # for dput in your ~/.dput.cf file.
283 # The 'packbin' target is to build a deb package
284 # locally. It is only for testing purpose.
287 EXCL_SYNC=--exclude ".git" \
288 --exclude ".gitignore" \
289 --exclude ".cvsignore" \
296 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
297 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
298 $(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
299 $(MAKE) -C $(TMP)/$(PACKAGE)/debian natty
300 $(MAKE) -C $(TMP)/$(PACKAGE)/debian oneiric
302 rm -rf $(TMP)/$(PACKAGE)/
305 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
306 rm -rf $(TMP)/$(PACKAGE)/
307 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
310 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
311 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
312 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
313 rm -rf $(TMP)/$(PACKAGE)/tools
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
322 # Produces a source tarball
323 # Note: start from a fresh working directory
324 # Note: configure first
328 $(MAKE) -C parsing_cocci parser_cocci_menhir.ml
329 $(MAKE) distclean KEEP_CONFIG=1 KEEP_GENERATED=1
330 tar cvfz $(PACKAGE).tar.gz --transform="s,^,$(PACKAGE)/,S" --exclude=$(PACKAGE).tar.gz --exclude-backups --exclude-vcs *