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 globals/config.ml.in
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 globals/config.ml.in"
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 git add globals/config.ml.in
85 git commit -m "Release $(VERSION)"
86 git tag -a -m "Release $(VERSION)" $(VERSION)
89 @echo "\n\tRun 'make package'\n"
93 $(MAKE) package-nopython
94 $(MAKE) package-python
95 @echo "\tPut online with 'make website'"
96 @echo "\tThe coccinelle SVN repository must be in $(WEBBASE)\n"
99 $(MAKE) distclean # Clean project
104 $(MAKE) distclean # Clean project
105 ./configure --without-python
108 # $(MAKE) staticbintar
111 $(MAKE) distclean # Clean project
112 ./configure # Reconfigure project with Python support
113 $(MAKE) bintar-python
114 $(MAKE) bytecodetar-python
117 # I currently pre-generate the parser so the user does not have to
118 # install menhir on his machine. We could also do a few cleanups.
119 # You may have first to do a 'make licensify'.
121 # update: make docs generates pdf but also some ugly .log files, so
122 # make clean is there to remove them while not removing the pdf
123 # (only distclean remove the pdfs).
127 cp -a . $(TMP)/$(PACKAGE)
128 cd $(TMP)/$(PACKAGE); cd parsing_cocci/; $(MAKE) parser_cocci_menhir.ml
129 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
130 rm -rf $(TMP)/$(PACKAGE)
134 rm -f $(TMP)/$(PACKAGE)
135 ln -s `pwd` $(TMP)/$(PACKAGE)
136 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
137 rm -f $(TMP)/$(PACKAGE)
139 staticbintar: all.opt
141 rm -f $(TMP)/$(PACKAGE)
142 ln -s `pwd` $(TMP)/$(PACKAGE)
144 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
145 rm -f $(TMP)/$(PACKAGE)
147 # add ocaml version in name ?
150 rm -f $(TMP)/$(PACKAGE)
151 ln -s `pwd` $(TMP)/$(PACKAGE)
153 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
154 rm -f $(TMP)/$(PACKAGE)
158 rm -f $(TMP)/$(PACKAGE)
159 ln -s `pwd` $(TMP)/$(PACKAGE)
160 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
161 rm -f $(TMP)/$(PACKAGE)
163 # add ocaml version in name ?
164 bytecodetar-python: all
166 rm -f $(TMP)/$(PACKAGE)
167 ln -s `pwd` $(TMP)/$(PACKAGE)
169 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
170 rm -f $(TMP)/$(PACKAGE)
173 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
174 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
175 rm -rf $(TMP)/$(CCPACKAGE)
178 rm -f $(TMP)/$(PACKAGE).tgz
179 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
180 # rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
181 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
182 rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
183 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
184 rm -f $(TMP)/$(CCPACKAGE).tgz
187 # No need to licensify 'demos'. Because these is basic building blocks
190 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
192 ocaml str.cma tools/licensify.ml
193 set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml str.cma ../tools/licensify.ml; cd ..; done
195 # When checking out the source from diku sometimes I have some "X in the future"
198 echo do 'touch **/*.*'
201 @echo $(OCAMLVERSION)
204 ##############################################################################
205 # Packaging rules -- To build deb packages
206 ##############################################################################
208 # Run 'make packsrc' to build a Deb source package
210 # The package is prepared in $(TMP), usually /tmp
211 # Once the package has been build, it is uploaded
212 # to a PPA on launchpad.
214 # You should have a "coccinelle" project configured
215 # for dput in your ~/.dput.cf file.
217 # The 'packbin' target is to build a deb package
218 # locally. It is only for testing purpose.
221 EXCL_SYNC=--exclude ".git" \
222 --exclude ".gitignore" \
223 --exclude ".cvsignore" \
230 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
231 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
232 $(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
233 $(MAKE) -C $(TMP)/$(PACKAGE)/debian natty
235 rm -rf $(TMP)/$(PACKAGE)/
238 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
239 rm -rf $(TMP)/$(PACKAGE)/
240 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
243 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
244 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
245 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
246 rm -rf $(TMP)/$(PACKAGE)/tools
249 cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION)*_source.changes`; do dput $(PRJNAME) $$p ; done
250 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.changes
251 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.$(PRJNAME).upload
252 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.dsc
253 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.tar.gz