Coccinelle release 1.0.0-rc1
[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 @echo "\n\tEdit globals/config.ml.in"
65 @echo "\tCommit with 'make release'\n"
66
67 release:
68 cvs ci -m "Release $(VERSION)" globals/config.ml.in
69 $(MAKE) licensify
70 @echo "\n\tRun 'make package'\n"
71
72 package:
73 $(MAKE) package-src
74 $(MAKE) package-nopython
75 $(MAKE) package-python
76 @echo "\tPut online with 'make website'"
77 @echo "\tThe coccinelle CVS repository must be in $(WEBBASE)\n"
78
79 package-src:
80 $(MAKE) distclean # Clean project
81 $(MAKE) srctar
82 $(MAKE) coccicheck
83
84 package-nopython:
85 $(MAKE) distclean # Clean project
86 ./configure --without-python
87 $(MAKE) docs
88 $(MAKE) bintar
89 $(MAKE) bytecodetar
90 # $(MAKE) staticbintar
91
92 package-python:
93 $(MAKE) distclean # Clean project
94 ./configure # Reconfigure project with Python support
95 $(MAKE) docs
96 $(MAKE) bintar-python
97 $(MAKE) bytecodetar-python
98
99
100 # I currently pre-generate the parser so the user does not have to
101 # install menhir on his machine. We could also do a few cleanups.
102 # You may have first to do a 'make licensify'.
103 #
104 # update: make docs generates pdf but also some ugly .log files, so
105 # make clean is there to remove them while not removing the pdf
106 # (only distclean remove the pdfs).
107 srctar:
108 $(MAKE) distclean
109 $(MAKE) docs
110 $(MAKE) clean
111 cp -a . $(TMP)/$(PACKAGE)
112 cd $(TMP)/$(PACKAGE); cd parsing_cocci/; $(MAKE) parser_cocci_menhir.ml
113 cd $(TMP); tar cvfz $(PACKAGE).tgz --exclude-vcs $(EXCL) $(PACKAGE)
114 rm -rf $(TMP)/$(PACKAGE)
115
116 bintar: all
117 rm -f $(TMP)/$(PACKAGE)
118 ln -s `pwd` $(TMP)/$(PACKAGE)
119 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86.tgz --exclude-vcs $(BINSRC2)
120 rm -f $(TMP)/$(PACKAGE)
121
122 staticbintar: all.opt
123 rm -f $(TMP)/$(PACKAGE)
124 ln -s `pwd` $(TMP)/$(PACKAGE)
125 $(MAKE) static
126 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-static.tgz --exclude-vcs $(BINSRC2)
127 rm -f $(TMP)/$(PACKAGE)
128
129 # add ocaml version in name ?
130 bytecodetar: all
131 rm -f $(TMP)/$(PACKAGE)
132 ln -s `pwd` $(TMP)/$(PACKAGE)
133 $(MAKE) purebytecode
134 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz --exclude-vcs $(BINSRC2)
135 rm -f $(TMP)/$(PACKAGE)
136
137 bintar-python: all
138 rm -f $(TMP)/$(PACKAGE)
139 ln -s `pwd` $(TMP)/$(PACKAGE)
140 cd $(TMP); tar cvfz $(PACKAGE)-bin-x86-python.tgz --exclude-vcs $(BINSRC2-PY)
141 rm -f $(TMP)/$(PACKAGE)
142
143 # add ocaml version in name ?
144 bytecodetar-python: all
145 rm -f $(TMP)/$(PACKAGE)
146 ln -s `pwd` $(TMP)/$(PACKAGE)
147 $(MAKE) purebytecode
148 cd $(TMP); tar cvfz $(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz --exclude-vcs $(BINSRC2-PY)
149 rm -f $(TMP)/$(PACKAGE)
150
151 coccicheck:
152 cp -a `pwd`/scripts/coccicheck $(TMP)/$(CCPACKAGE)
153 tar cvfz $(TMP)/$(CCPACKAGE).tgz -C $(TMP) --exclude-vcs $(CCPACKAGE)
154 rm -rf $(TMP)/$(CCPACKAGE)
155
156 clean-packages::
157 rm -f $(TMP)/$(PACKAGE).tgz
158 rm -f $(TMP)/$(PACKAGE)-bin-x86.tgz
159 # rm -f $(TMP)/$(PACKAGE)-bin-x86-static.tgz
160 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION).tgz
161 rm -f $(TMP)/$(PACKAGE)-bin-x86-python.tgz
162 rm -f $(TMP)/$(PACKAGE)-bin-bytecode-$(OCAMLVERSION)-python.tgz
163 rm -f $(TMP)/$(CCPACKAGE).tgz
164
165 #
166 # No need to licensify 'demos'. Because these is basic building blocks
167 # to use SmPL.
168 #
169 TOLICENSIFY=ctl engine globals parsing_cocci popl popl09 python scripts tools
170 licensify:
171 ocaml str.cma tools/licensify.ml
172 set -e; for i in $(TOLICENSIFY); do cd $$i; ocaml str.cma ../tools/licensify.ml; cd ..; done
173
174 # When checking out the source from diku sometimes I have some "X in the future"
175 # error messages.
176 fixdates:
177 echo do 'touch **/*.*'
178
179 #fixCVS:
180 # cvs update -d -P
181 # echo do 'rm -rf **/CVS'
182
183 ocamlversion:
184 @echo $(OCAMLVERSION)
185
186
187 ##############################################################################
188 # Packaging rules -- To build deb packages
189 ##############################################################################
190 #
191 # Run 'make packsrc' to build a Deb source package
192 #
193 # The package is prepared in $(TMP), usually /tmp
194 # Once the package has been build, it is uploaded
195 # to a PPA on launchpad.
196 #
197 # You should have a "coccinelle" project configured
198 # for dput in your ~/.dput.cf file.
199 #
200 # The 'packbin' target is to build a deb package
201 # locally. It is only for testing purpose.
202 #
203
204 EXCL_SYNC=--exclude ".git" \
205 --exclude ".gitignore" \
206 --exclude ".cvsignore" \
207 --exclude "tests" \
208 --exclude "TODO" \
209 --cvs-exclude
210
211 packsrc: prepack
212 $(MAKE) -C $(TMP)/$(PACKAGE)/debian lucid
213 $(MAKE) -C $(TMP)/$(PACKAGE)/debian karmic
214 $(MAKE) -C $(TMP)/$(PACKAGE)/debian maverick
215 $(MAKE) push
216 rm -rf $(TMP)/$(PACKAGE)/
217
218 packbin: prepack
219 $(MAKE) -C $(TMP)/$(PACKAGE)/debian binary
220 rm -rf $(TMP)/$(PACKAGE)/
221 rm -rf $(TMP)/$(PACKAGE)_$(VERSION)*_source.build
222
223 prepack:
224 rsync -a $(EXCL_SYNC) . $(TMP)/$(PACKAGE)
225 $(MAKE) -C $(TMP)/$(PACKAGE) licensify
226 sed -i "s|^OCAMLCFLAGS=.*$$|OCAMLCFLAGS=|" $(TMP)/$(PACKAGE)/Makefile
227 rm -rf $(TMP)/$(PACKAGE)/tools
228
229 push:
230 cd $(TMP)/ && for p in `ls $(PRJNAME)_$(VERSION)*_source.changes`; do dput $(PRJNAME) $$p ; done
231 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.changes
232 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*_source.$(PRJNAME).upload
233 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.dsc
234 rm -rf $(TMP)/$(PRJNAME)_$(VERSION)*.tar.gz
235