Coccinelle release 1.0.0-rc3
[bpt/coccinelle.git] / Makefile.release
1
2 ##############################################################################
3 # Release rules to generate website archives
4 ##############################################################################
5
6 PACKAGE=$(PRJNAME)-$(VERSION)
7 CCPACKAGE=coccicheck-$(CCVERSION)
8
9 EXCLUDE=$(PACKAGE)/debian .depend
10
11 BINSRC=spatch env.sh env.csh standard.h standard.iso \
12 *.txt \
13 docs/manual/manual.pdf docs/manual/options.pdf docs/manual/main_grammar.pdf docs/spatch.1 \
14 docs/manual/cocci-python.txt \
15 demos/*
16 BINSRC-PY=$(BINSRC) $(PYLIB) python/coccilib/
17
18 EXCL=$(EXCLUDE:%=--exclude=%)
19 BINSRC2=$(BINSRC:%=$(PACKAGE)/%)
20 BINSRC2-PY=$(BINSRC-PY:%=$(PACKAGE)/%)
21
22 TMP=/tmp
23 OCAMLVERSION=$(shell ocaml -version |perl -p -e 's/.*version (.*)/$$1/;')
24
25 # Procedure to do first time:
26 # cd ~/release
27 # cvs checkout coccinelle -dP
28 # cd coccinelle
29 #
30 # Procedure to do each time:
31 #
32 # 1) make prerelease # WARN: These will clean your local rep. of pending modifications
33 #
34 # UPDATE VERSION number in globals/config.ml.in
35 # and commit it with
36 #
37 # 2) make release
38 #
39 # The project is then automatically licensified.
40 #
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/...
45 #
46 # 3) make package
47 #
48 # if WEBSITE is set properly, you can also run 'make website'
49 # Check that run an ocaml in /usr/bin
50
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.
54
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.
59
60 prerelease:
61 cvs up -CdP
62 $(MAKE) fix-expected
63 $(MAKE) distclean
64 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
65 @echo "\n\tEdit globals/config.ml.in"
66 @echo "\tCommit with 'make release'\n"
67
68 fix-expected:
69 $(MAKE) distclean
70 ./configure --without-python
71 $(MAKE) world
72 yes | ./spatch.opt -testall
73 cp tests/SCORE_actual.sexp tests/SCORE_expected_orig.sexp
74
75 release:
76 cvs ci -m "Release $(VERSION)" globals/config.ml.in
77 $(MAKE) licensify
78 @echo "\n\tRun 'make package'\n"
79
80 package:
81 $(MAKE) package-src
82 $(MAKE) package-nopython
83 $(MAKE) package-python
84 @echo "\tPut online with 'make website'"
85 @echo "\tThe coccinelle CVS repository must be in $(WEBBASE)\n"
86
87 package-src:
88 $(MAKE) distclean # Clean project
89 $(MAKE) srctar
90 $(MAKE) coccicheck
91
92 package-nopython:
93 $(MAKE) distclean # Clean project
94 ./configure --without-python
95 $(MAKE) docs
96 $(MAKE) bintar
97 $(MAKE) bytecodetar
98 # $(MAKE) staticbintar
99
100 package-python:
101 $(MAKE) distclean # Clean project
102 ./configure # Reconfigure project with Python support
103 $(MAKE) docs
104 $(MAKE) bintar-python
105 $(MAKE) bytecodetar-python
106
107
108 # I currently pre-generate the parser so the user does not have to
109 # install menhir on his machine. We could also do a few cleanups.
110 # You may have first to do a 'make licensify'.
111 #
112 # update: make docs generates pdf but also some ugly .log files, so
113 # make clean is there to remove them while not removing the pdf
114 # (only distclean remove the pdfs).
115 srctar:
116 $(MAKE) distclean
117 $(MAKE) docs
118 $(MAKE) clean
119 cp -a . $(TMP)/$(PACKAGE)
120 cd $(TMP)/$(PACKAGE); cd parsing_cocci/; $(MAKE) parser_cocci_menhir.ml
121 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
122 rm -rf $(TMP)/$(PACKAGE)
123
124 bintar: all
125 rm -f $(TMP)/$(PACKAGE)
126 ln -s `pwd` $(TMP)/$(PACKAGE)
127 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
128 rm -f $(TMP)/$(PACKAGE)
129
130 staticbintar: all.opt
131 rm -f $(TMP)/$(PACKAGE)
132 ln -s `pwd` $(TMP)/$(PACKAGE)
133 $(MAKE) static
134 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
135 rm -f $(TMP)/$(PACKAGE)
136
137 # add ocaml version in name ?
138 bytecodetar: all
139 rm -f $(TMP)/$(PACKAGE)
140 ln -s `pwd` $(TMP)/$(PACKAGE)
141 $(MAKE) purebytecode
142 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
143 rm -f $(TMP)/$(PACKAGE)
144
145 bintar-python: all
146 rm -f $(TMP)/$(PACKAGE)
147 ln -s `pwd` $(TMP)/$(PACKAGE)
148 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
149 rm -f $(TMP)/$(PACKAGE)
150
151 # add ocaml version in name ?
152 bytecodetar-python: all
153 rm -f $(TMP)/$(PACKAGE)
154 ln -s `pwd` $(TMP)/$(PACKAGE)
155 $(MAKE) purebytecode
156 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
157 rm -f $(TMP)/$(PACKAGE)
158
159 coccicheck:
160 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
161 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
162 rm -rf $(TMP)/$(CCPACKAGE)
163
164 clean-packages::
165 rm -f $(TMP)/$(PACKAGE).tgz
166 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
167 # rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
168 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
169 rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
170 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
171 rm -f $(TMP)/$(CCPACKAGE).tgz
172
173 #
174 # No need to licensify 'demos'. Because these is basic building blocks
175 # to use SmPL.
176 #
177 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
178 licensify:
179 ocaml str.cma tools/licensify.ml
180 set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml str.cma ../tools/licensify.ml; cd ..; done
181
182 # When checking out the source from diku sometimes I have some "X in the future"
183 # error messages.
184 fixdates:
185 echo do 'touch **/*.*'
186
187 #fixCVS:
188 # cvs update -d -P
189 # echo do 'rm -rf **/CVS'
190
191 ocamlversion:
192 @echo $(OCAMLVERSION)
193
194
195 ##############################################################################
196 # Packaging rules -- To build deb packages
197 ##############################################################################
198 #
199 # Run 'make packsrc' to build a Deb source package
200 #
201 # The package is prepared in $(TMP), usually /tmp
202 # Once the package has been build, it is uploaded
203 # to a PPA on launchpad.
204 #
205 # You should have a "coccinelle" project configured
206 # for dput in your ~/.dput.cf file.
207 #
208 # The 'packbin' target is to build a deb package
209 # locally. It is only for testing purpose.
210 #
211
212 EXCL_SYNC=--exclude ".git" \
213 --exclude ".gitignore" \
214 --exclude ".cvsignore" \
215 --exclude "tests" \
216 --exclude "TODO" \
217 --cvs-exclude
218
219 packsrc: prepack
220 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
221 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
222 $(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
223 $(MAKE) -C $(TMP)/$(PACKAGE)/debian natty
224 $(MAKE) push
225 rm -rf $(TMP)/$(PACKAGE)/
226
227 packbin: prepack
228 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
229 rm -rf $(TMP)/$(PACKAGE)/
230 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
231
232 prepack:
233 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
234 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
235 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
236 rm -rf $(TMP)/$(PACKAGE)/tools
237
238 push:
239 cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION)*_source.changes`; do dput $(PRJNAME) $$p ; done
240 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.changes
241 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.$(PRJNAME).upload
242 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.dsc
243 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.tar.gz
244