aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.devel
blob: 93b144381ea5164761f12fd2609399a91a89afaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
##
## Makefile for Proof General development.
## 
## Author:  David Aspinall <da@dcs.ed.ac.uk>
##
## Maintainer:  Proof General maintainer <proofgen@dcs.ed.ac.uk>
##
## Developer use only, not part of distribution.
##
##    make clean	  - remove intermediate files
##    make distclean	  - remove all generated files
##
##    make ChangeLog	  - make ChangeLog from CVS sources (uses emacs)
##    make tag		  - tag the CVS sources with CVS_RELEASENAME
##    make untag	  - remove tag CVS_RELEASENAME from the sources
##    make dist           - make a distribution from sources with above tag
##    make rpm		  - make RPM packages based on etc/ProofGeneral.spec
##
##    make release	  - make tag, dist, and install it in RELEASEDIR.
##    make releaseall	  - make release and rpmrelease.
##
## $Id$
## 
###########################################################################


# TODO: (da) Add target for byte compilation.

# Release tags. 
#   NB: 1. CVS tags can't have points in them.
#       2. RPM names can't have hyphens in them
RELEASE_TAG=2.0pre$(shell date "+%y%m%d")
CVS_RELEASE_TAG=2-0pre$(shell date "+%y%m%d")
NAME = ProofGeneral
# Name of tar file and RPM file.
RELEASENAME = ProofGeneral-$(RELEASE_TAG)
CVS_RELEASENAME = Release-$(CVS_RELEASE_TAG)

# Where to release (i.e. copy) a new distribution to
RELEASEDIR = /home/proofgen/www/

CVSNAME = ProofGeneral
#CVSROOT = /home/proofgen/src

# Remote commands to use CVS in server mode and install files.
# With these settings the build can be done remotely.
# MACHINE=hope
# CVSROOT = :ext:$(USER)@$(MACHINE).dcs.ed.ac.uk:/home/proofgen/src
# CVS_RSH=ssh
CVSROOT = /home/proofgen/src


# Byte compilation command
BYTECOMP = $(EMACS) -batch -q -f batch-byte-compile
EMACS=xemacs


# Files not to include the distribution area or tarball 
NONDISTFILES=todo html etc Makefile doc/Makefile images/*.xcf images/notes.txt images/gimp images/Makefile

# Files not to include in the distribution tarball
IGNOREDFILES=doc/ProofGeneral.dvi 

# Temporary directory to to build a distribution in
DISTBUILDIR = /tmp/ProofGeneralRelease

# Temporary RPM topdir for building packages as non-root user.
RPMTOPDIR=/tmp/ProofGeneral-rpm
RPMRC=$(RPMTOPDIR)/rpmrc
RPM=rpm --rcfile $(RPMRC)

RELEASENAMETAR = $(RELEASENAME).tar
RELEASENAMETARGZ = $(RELEASENAMETAR).gz



# Files not kept under cvs to clean away.
FILES_NONCVS = ChangeLog 

FORCE:

# Targets to pre-compile for distribution
# Slightly dodgy to include elisp compile here, because
# it can be incompatible across emacs versions.
alldist:	alldocs



############################################################
#
# Re-Build ChangeLog.  CVSROOT must be set correctly.
# Correct dependency would be to check repository for changes!
#
ChangeLog:	FORCE
	rm -f ChangeLog
	$(EMACS) -batch -q -f vc-update-change-log -f save-buffer



############################################################
#
# Clean up intermediate files
#
clean:	
	(cd doc; $(MAKE) clean)
	(cd images; $(MAKE) clean)


############################################################
#
# Clean up all generated files.
#
distclean:	clean
	(cd doc; $(MAKE) distclean)
	(cd images; $(MAKE) distclean)

############################################################
#
# Clean up all non-cvs files.
#
cvsclean:	clean
	rm -rf $(FILES_NONCVS)
	(cd doc; $(MAKE) distclean)
	(cd images; $(MAKE) cvsclean)

############################################################
#
# Documentation
#
doc:	FORCE
	(cd doc; $(MAKE) doc)

alldocs: FORCE
	(cd doc; $(MAKE) all)


############################################################
##
## tag:    tag the CVS sources of working directory with RELEASE_TAG,
##	   and edit version stamp in proof-site.el
##	   (Developers only)
##
tag:		
	@echo "*************************************************"
	@echo " Tagging sources... (fails if CVS source dirty)"
	@echo "*************************************************"
	if [ -n "`cvs -n -q update`" ]; then exit 1; fi
	(cd generic; mv proof-site.el proof-site.el.old; sed -e 's/defconst proof-general-version\n \".*\"/defconst proof-general-version\n \"Proof General, Version $(RELEASE_TAG) released by da,tms. Email proofgen@dcs.ed.ac.uk.\"/g' proof-site.el.old > proof-site.el; rm proof-site.el.old)
	(cd html; mv download.html download.html.old; sed -e 's|ProofGeneral-2\.0*\.|ProofGeneral-$(RELEASE_TAG).|g' download.html.old > download.html.old2 ; sed -e 's|ProofGeneral-2\.0*-|ProofGeneral-$(RELEASE_TAG)-|g' download.html.old2 > download.html; rm download.html.old*)
	(cd etc; mv ProofGeneral.spec ProofGeneral.spec.old; sed -e 's/Version:.*$$/Version:	$(RELEASE_TAG)/g' ProofGeneral.spec.old > ProofGeneral.spec; rm ProofGeneral.spec.old)
# This hack to SOURCE: name is only needed because we have an obsolete version
# of rpm installed on standard machines at dcs.ed, and we have to build with
# that version.
	(cd etc; mv ProofGeneral.spec ProofGeneral.spec.old; sed -e 's/ProofGeneral-.*.tar.gz/ProofGeneral-$(RELEASE_TAG).tar.gz/g' ProofGeneral.spec.old > ProofGeneral.spec; rm ProofGeneral.spec.old)
	cvs commit -m"Set version tag for release." generic/proof-site.el html/download.html etc/ProofGeneral.spec
	cvs tag "$(CVS_RELEASENAME)"

############################################################
##
## untag:  Remove the CVS_RELEASENAME tag from the CVS sources.
##

untag:
	cvs tag -d "$(CVS_RELEASENAME)"


############################################################
##
## dist: make a distribution in DISTBUILDIR from CVS sources
##       Builds from sources tagged with CVS_RELEASE_TAG.
##	 Moves html files to parent directory, and removes
##       non-distributed files.
##	 (Developer only)
##	    
dist:	
	@echo "*************************************************"
	@echo " Cleaning dist build directory..."
	@echo "*************************************************"
	rm -rf $(DISTBUILDIR)
	mkdir -p $(DISTBUILDIR)
	@echo "*************************************************"
	@echo " Running cvs export .."
	@echo "*************************************************"
	(cd $(DISTBUILDIR); cvs export -kv -r "Release-$(CVS_RELEASE_TAG)" -d $(RELEASENAME) $(CVSNAME))
	@echo "*************************************************"
	@echo " Running 'make alldist' for new release .."
	@echo "*************************************************"
	(cd $(DISTBUILDIR)/$(RELEASENAME); make alldist)
	(cd $(DISTBUILDIR)/$(RELEASENAME); make clean)
	@echo "*************************************************"
	@echo " Copying doc files .."
	@echo "*************************************************"
	(cp -pr $(DISTBUILDIR)/$(RELEASENAME)/doc $(DISTBUILDIR))
	@echo "*************************************************"
	@echo " Moving html files .."
	@echo "*************************************************"
	(cd $(DISTBUILDIR)/$(RELEASENAME)/html; mv * ../..)
	@echo "*************************************************"
	@echo " Cleaning non-distributed files .."
	@echo "*************************************************"
	(cd $(DISTBUILDIR)/$(RELEASENAME); rm -rf $(NONDISTFILES))
	@echo "*************************************************"
	@echo " Making compressed tar file..."
	@echo "*************************************************"
	(cd $(DISTBUILDIR); for f in $(IGNOREDFILES); do echo $$f >> ignoredfiles; done)
	tar -cvhf $(DISTBUILDIR)/$(RELEASENAMETAR) -C $(DISTBUILDIR) $(RELEASENAME) -X $(DISTBUILDIR)/ignoredfiles
	gzip -9 $(DISTBUILDIR)/$(RELEASENAMETAR)
	@echo "*************************************************"
	@echo " Finished making dist."
	@echo "*************************************************"


############################################################
##
## release:
##     tag the CVS sources, and make a distribution.
##     Then install the distribution in RELEASEDIR.
##     WARNING: RELEASEDIR is not cleaned, but files there
##     with same names will be overwritten.
##     Moreover, a link ProofGeneral -> ProofGeneral-<version>
##     is made.
##	  
release: distclean tag dist
	mkdir -p $(RELEASEDIR)
	cp -pfr $(DISTBUILDIR)/* $(RELEASEDIR)
	(cd $(RELEASEDIR); rm -f $(NAME); ln -s $(RELEASENAME) $(NAME))
	@echo "*************************************************"
	@echo " Finished installing dist."
	@echo "*************************************************"


############################################################
##
## rpm:
##     Build an RPM package from the recently made distribution 
##     $(DISTBUILDIR)/$(RELEASENAMETAR).gz, using the spec and
##     patch file in ./etc
##
##	  
rpm:	
	rm -rf $(RPMTOPDIR)
	mkdir -p $(RPMTOPDIR) $(RPMTOPDIR)/BUILD $(RPMTOPDIR)/SOURCES $(RPMTOPDIR)/SRPMS $(RPMTOPDIR)/RPMS $(RPMTOPDIR)/RPMS/noarch
	echo "topdir: $(RPMTOPDIR)" > $(RPMRC)
	cp -p etc/ProofGeneral.patch $(RPMTOPDIR)/SOURCES
	cp -p $(DISTBUILDIR)/$(RELEASENAMETARGZ) $(RPMTOPDIR)/SOURCES
	$(RPM) -ba etc/ProofGeneral.spec


############################################################
##
## rpmrelease:
##     Build and install RPM packages into RELEASEDIR.
##	  
rpmrelease: rpm
	cp -pf $(RPMTOPDIR)/SRPMS/* $(RPMTOPDIR)/RPMS/noarch/* $(RELEASEDIR)


############################################################
##
## releaseall:
##     Do everything!
##	  
releaseall: release rpmrelease