Release coccinelle-0.2.3rc1
[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=debian
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=$(PACKAGE)/%)
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) distclean
63 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" Makefile
64
65 release:
66 cvs ci -m "Release $(VERSION)" globals/config.ml.in
67 $(MAKE) licensify
68
69 package:
70 $(MAKE) package-src
71 $(MAKE) package-nopython
72 $(MAKE) package-python
73
74 package-src:
75 $(MAKE) distclean # Clean project
76 $(MAKE) srctar
77 $(MAKE) coccicheck
78
79 package-nopython:
80 $(MAKE) distclean # Clean project
81 ./configure --without-python
82 $(MAKE) docs
83 $(MAKE) bintar
84 $(MAKE) bytecodetar
85 $(MAKE) staticbintar
86
87 package-python:
88 $(MAKE) distclean # Clean project
89 ./configure # Reconfigure project with Python support
90 $(MAKE) docs
91 $(MAKE) bintar-python
92 $(MAKE) bytecodetar-python
93
94
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'.
98 #
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).
102 srctar:
103 make distclean
104 make docs
105 make clean
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)
110
111
112 bintar: all
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)
117
118 staticbintar: all.opt
119 rm -f $(TMP)/$(PACKAGE)
120 ln -s `pwd` $(TMP)/$(PACKAGE)
121 make static
122 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
123 rm -f $(TMP)/$(PACKAGE)
124
125 # add ocaml version in name ?
126 bytecodetar: all
127 rm -f $(TMP)/$(PACKAGE)
128 ln -s `pwd` $(TMP)/$(PACKAGE)
129 make purebytecode
130 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
131 rm -f $(TMP)/$(PACKAGE)
132
133 bintar-python: all
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)
138
139 # add ocaml version in name ?
140 bytecodetar-python: all
141 rm -f $(TMP)/$(PACKAGE)
142 ln -s `pwd` $(TMP)/$(PACKAGE)
143 make purebytecode
144 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
145 rm -f $(TMP)/$(PACKAGE)
146
147 coccicheck:
148 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
149 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
150 rm -rf $(TMP)/$(CCPACKAGE)
151
152 clean-packages::
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
160
161 #
162 # No need to licensify 'demos'. Because these is basic building blocks
163 # to use SmPL.
164 #
165 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
166 licensify:
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
169
170 # When checking out the source from diku sometimes I have some "X in the future"
171 # error messages.
172 fixdates:
173 echo do 'touch **/*.*'
174
175 #fixCVS:
176 # cvs update -d -P
177 # echo do 'rm -rf **/CVS'
178
179 ocamlversion:
180 @echo $(OCAMLVERSION)
181
182
183 ##############################################################################
184 # Packaging rules -- To build deb packages
185 ##############################################################################
186 #
187 # Run 'make packsrc' to build a Deb source package
188 #
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.
192 #
193 # You should have a "coccinelle" project configured
194 # for dput in your ~/.dput.cf file.
195 #
196 # The 'packbin' target is to build a deb package
197 # locally. It is only for testing purpose.
198 #
199
200 EXCL_SYNC=--exclude ".git" \
201 --exclude ".gitignore" \
202 --exclude ".cvsignore" \
203 --exclude "tests" \
204 --exclude "TODO" \
205 --cvs-exclude
206
207 packsrc: prepack
208 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
209 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
210 $(MAKE) push
211 rm -rf $(TMP)/$(PACKAGE)/
212
213 packbin: prepack
214 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
215 rm -rf $(TMP)/$(PACKAGE)/
216 rm -rf $(TMP)/$(PRJNAME)_$(VERSION).deb*_source.build
217
218 prepack:
219 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
220 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
221 rm -rf $(TMP)/$(PACKAGE)/tools
222
223 push:
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