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 \
20 BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
22 EXCL=$(EXCLUDE:%=--exclude=%)
23 BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
24 BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
27 OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
29 # Procedure to do first time:
31 # git clone ... coccinelle
34 # Procedure to do each time:
36 # 1) make prerelease # WARN: These will clean your local rep. of pending modifications
38 # UPDATE VERSION number in ./version
43 # The project is then automatically licensified.
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/...
52 # if WEBSITE is set properly, you can also run 'make website'
53 # Check that run an ocaml in /usr/bin
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.
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.
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.
72 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
73 @echo "\n\tEdit ./version"
74 @echo "\tCommit with 'make release'\n"
78 ./configure --without-python
80 yes | ./spatch.opt -testall
81 cp tests/SCORE_actual.sexp tests/SCORE_expected_orig.sexp
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)
90 @echo "\n\tRun 'make package'\n"
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"
100 $(MAKE) distclean # Clean project
105 $(MAKE) distclean # Clean project
106 ./configure --without-python
109 # $(MAKE) staticbintar
112 $(MAKE) distclean # Clean project
113 ./configure # Reconfigure project with Python support
114 $(MAKE) bintar-python
115 $(MAKE) bytecodetar-python
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'.
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).
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)
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)
140 staticbintar: all.opt
142 rm -f $(TMP)/$(PACKAGE)
143 ln -s `pwd` $(TMP)/$(PACKAGE)
145 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
146 rm -f $(TMP)/$(PACKAGE)
148 # add ocaml version in name ?
151 rm -f $(TMP)/$(PACKAGE)
152 ln -s `pwd` $(TMP)/$(PACKAGE)
154 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
155 rm -f $(TMP)/$(PACKAGE)
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)
164 # add ocaml version in name ?
165 bytecodetar-python: all
167 rm -f $(TMP)/$(PACKAGE)
168 ln -s `pwd` $(TMP)/$(PACKAGE)
170 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
171 rm -f $(TMP)/$(PACKAGE)
174 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
175 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
176 rm -rf $(TMP)/$(CCPACKAGE)
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
188 # No need to licensify 'demos'. Because these is basic building blocks
191 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
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
196 # When checking out the source from diku sometimes I have some "X in the future"
199 echo do 'touch **/*.*'
202 @echo $(OCAMLVERSION)
205 ##############################################################################
206 # Packaging rules -- To build deb packages
207 ##############################################################################
209 # Run 'make packsrc' to build a Deb source package
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.
215 # You should have a "coccinelle" project configured
216 # for dput in your ~/.dput.cf file.
218 # The 'packbin' target is to build a deb package
219 # locally. It is only for testing purpose.
222 EXCL_SYNC=--exclude ".git" \
223 --exclude ".gitignore" \
224 --exclude ".cvsignore" \
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
236 rm -rf $(TMP)/$(PACKAGE)/
239 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
240 rm -rf $(TMP)/$(PACKAGE)/
241 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
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
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
256 # Produces a source tarball
257 # Note: start from a fresh working directory
258 # Note: configure first
263 tar cvfz $(PACKAGE).tar.gz --transform="s,^,$(PACKAGE)/,S" --exclude=$(PACKAGE).tar.gz --exclude-backups --exclude-vcs *