2 ##############################################################################
3 # Release rules to generate website archives
4 ##############################################################################
6 PACKAGE=$(PRJNAME)-$(VERSION)
7 CCPACKAGE=coccicheck-$(CCVERSION)
11 BINSRC=spatch env.sh env.csh standard.h standard.iso \
13 docs/manual/manual.pdf docs/manual/options.pdf docs/manual/main_grammar.pdf docs/spatch.1 \
14 docs/manual/cocci-python.txt \
16 BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
18 EXCL=$(EXCLUDE:%=--exclude=$(PACKAGE)/%)
19 BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
20 BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
23 OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
25 # Procedure to do first time:
27 # cvs checkout coccinelle -dP
30 # Procedure to do each time:
32 # 1) make prerelease # WARN: These will clean your local rep. of pending modifications
34 # UPDATE VERSION number in globals/config.ml.in
39 # The project is then automatically licensified.
41 # Remember to comment the -g -dtypes in this Makefile
42 # You can also remove a few things, for instance I removed in this
43 # Makefile things related to popl/ and popl09/
44 # make sure that ocaml is the distribution ocaml of /usr/bin, not ~pad/...
48 # if WEBSITE is set properly, you can also run 'make website'
49 # Check that run an ocaml in /usr/bin
51 # To test you can try compile and run spatch from different instances
52 # like my ~/coccinelle, ~/release/coccinelle, and the /tmp/coccinelle-0.X
53 # downloaded from the website.
55 # For 'make srctar' it must done from a clean
56 # repo such as ~/release/coccinelle. It must also be a repo where
57 # the scripts/licensify has been run at least once.
58 # For the 'make bintar' I can do it from my original repo.
63 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
66 cvs ci -m "Release $(VERSION)" globals/config.ml.in
71 $(MAKE) package-nopython
72 $(MAKE) package-python
75 $(MAKE) distclean # Clean project
80 $(MAKE) distclean # Clean project
81 ./configure --without-python
88 $(MAKE) distclean # Clean project
89 ./configure # Reconfigure project with Python support
92 $(MAKE) bytecodetar-python
95 # I currently pre-generate the parser so the user does not have to
96 # install menhir on his machine. We could also do a few cleanups.
97 # You may have first to do a 'make licensify'.
99 # update: make docs generates pdf but also some ugly .log files, so
100 # make clean is there to remove them while not removing the pdf
101 # (only distclean remove the pdfs).
106 cp -a . $(TMP)/$(PACKAGE)
107 cd $(TMP)/$(PACKAGE); cd parsing_cocci/; make parser_cocci_menhir.ml
108 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
109 rm -rf $(TMP)/$(PACKAGE)
113 rm -f $(TMP)/$(PACKAGE)
114 ln -s `pwd` $(TMP)/$(PACKAGE)
115 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
116 rm -f $(TMP)/$(PACKAGE)
118 staticbintar: all.opt
119 rm -f $(TMP)/$(PACKAGE)
120 ln -s `pwd` $(TMP)/$(PACKAGE)
122 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
123 rm -f $(TMP)/$(PACKAGE)
125 # add ocaml version in name ?
127 rm -f $(TMP)/$(PACKAGE)
128 ln -s `pwd` $(TMP)/$(PACKAGE)
130 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
131 rm -f $(TMP)/$(PACKAGE)
134 rm -f $(TMP)/$(PACKAGE)
135 ln -s `pwd` $(TMP)/$(PACKAGE)
136 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
137 rm -f $(TMP)/$(PACKAGE)
139 # add ocaml version in name ?
140 bytecodetar-python: all
141 rm -f $(TMP)/$(PACKAGE)
142 ln -s `pwd` $(TMP)/$(PACKAGE)
144 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
145 rm -f $(TMP)/$(PACKAGE)
148 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
149 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
150 rm -rf $(TMP)/$(CCPACKAGE)
153 rm -f $(TMP)/$(PACKAGE).tgz
154 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
155 rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
156 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
157 rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
158 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
159 rm -f $(TMP)/$(CCPACKAGE).tgz
162 # No need to licensify 'demos'. Because these is basic building blocks
165 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
167 ocaml str.cma tools/licensify.ml
168 set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml str.cma ../tools/licensify.ml; cd ..; done
170 # When checking out the source from diku sometimes I have some "X in the future"
173 echo do 'touch **/*.*'
177 # echo do 'rm -rf **/CVS'
180 @echo $(OCAMLVERSION)
183 ##############################################################################
184 # Packaging rules -- To build deb packages
185 ##############################################################################
187 # Run 'make packsrc' to build a Deb source package
189 # The package is prepared in $(TMP), usually /tmp
190 # Once the package has been build, it is uploaded
191 # to a PPA on launchpad.
193 # You should have a "coccinelle" project configured
194 # for dput in your ~/.dput.cf file.
196 # The 'packbin' target is to build a deb package
197 # locally. It is only for testing purpose.
200 EXCL_SYNC=--exclude ".git" \
201 --exclude ".gitignore" \
202 --exclude ".cvsignore" \
208 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
209 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
211 rm -rf $(TMP)/$(PACKAGE)/
214 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
215 rm -rf $(TMP)/$(PACKAGE)/
216 rm -rf $(TMP)/$(PRJNAME)_$(VERSION).deb*_source.build
219 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
220 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
221 rm -rf $(TMP)/$(PACKAGE)/tools
224 cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION).deb*_source.changes`; do dput $(PRJNAME) $$p ; done
225 rm -rf $(TMP)/$(PRJNAME)_$(VERSION).deb*_source.changes
226 rm -rf $(TMP)/$(PRJNAME)_$(VERSION).deb*_source.$(PRJNAME).upload
227 rm -rf $(TMP)/$(PRJNAME)_$(VERSION).deb*.dsc
228 rm -rf $(TMP)/$(PRJNAME)_$(VERSION).deb*.tar.gz