aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.devel
blob: 62bab01ffa7301a9ad943114bc45496efb18c2b9 (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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
##
## 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, local installation and rpmrelease.
##
##    make distinstall	  - install distribution build by 'make dist'
##			    into DISTINSTALLDIR.
##
##    make releaseclean   - clean up after 'make dist' 'make rpmrelease'.
##
##
## Notes:
##   Use 'make untag' before re-trying if 'make releaseall' fails and files
##    are changed. This will make sure tags move to correct files
##   Use 'make releaseclean' if giving up, to remove temp dirs.
##
##   No facility to edit html to make a full release in this makefile.  
##   Too much effort for infrequenty used function.  
##   Must edit download.html by hand, then run 
##
##    make releaseall VERSION=2.0
##
##   Or similar to make the required version.
##
## To customize the tags in case of a re-release with the same official
## version:
##
##    make releaseall VERSION=2.0 CVS_VERSION=2_0_1
##
##
## $Id$
## 
###########################################################################


# Release tag.  For pre-releases.  Watch out with
# substitution in tag target below, which edits $(DOWNLOADHTML)
PRERELEASE_TAG=2.1pre$(shell date "+%y%m%d")

# html/download.phtml
DOWNLOADHTML=download.phtml


# This is used for full releases to control the tag name
# and distribution name.  No editing of html is done
# when PRERELEASE_TAG != VERSION
VERSION=$(PRERELEASE_TAG)

NAME = ProofGeneral
LATESTNAME = ProofGeneral-latest
DEVELLATESTNAME = ProofGeneral-devel-latest

#   NB: CVS tags can't have points in them.  
#   Substitute points for hyphens.
CVS_VERSION=$(shell echo $(VERSION) | sed 's/\./-/g')

# Name of tar file and RPM file.
RELEASENAME = ProofGeneral-$(VERSION)
DEVELRELEASENAME = ProofGeneral-$(VERSION)-devel
CVS_RELEASENAME = Release-$(CVS_VERSION)

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

CVSNAME = ProofGeneral

# 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

# Emacs
EMACS=xemacs

# GNU version of tar, please
TAR=tar

# For recursive make
DEVELMAKE=make -f Makefile.devel

# Files not to include the distribution area or tarball 
NONDISTFILES=.cvsignore */.cvsignore html etc Makefile.devel doc/notes.txt images/*.xcf images/notes.txt images/gimp images/Makefile isa/wip.ML html/notes.txt plastic/ isar/ 

# Files not to include in the distribution tarball
IGNOREDFILES=doc/ProofGeneral.dvi Makefile.devel todo isa/wip.ML

# 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
# What the RPM should be called.
RELEASENAMERPM = $(RELEASENAME)-1.noarch.rpm

DEVELRELEASENAMETAR = $(DEVELRELEASENAME).tar
DEVELRELEASENAMETARGZ = $(DEVELRELEASENAMETAR).gz


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

# Where to install a distribution 
# DISTINSTALLDIR=/usr/local/share/elisp/proofgeneral
# value for dcs.ed.ac.uk:
DISTINSTALLDIR=/export/local/share/elisp

# Copied from distributed Makefile
ELISP_DIRS=generic lego coq isa

PWD=$(shell pwd)

BYTECOMP = $(EMACS) -batch -q -no-site-file -eval '(setq load-path (append (list "$(PWD)/generic" "$(PWD)/lego" "$(PWD)/coq" "$(PWD)/isa") load-path))' -f batch-byte-compile

EL=$(shell for f in $(ELISP_DIRS); do ls $$f/*.el; done)
ELC=$(EL:.el=.elc)

.SUFFIXES:	.el .elc

.el.elc:
	$(BYTECOMP) $*.el

FORCE:

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


############################################################
#
# Make tags file
#
tags:	$(ELC)
	etags $(EL) > TAGS



############################################################
#
# 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 -eval "(setq a (default-directory))" -eval "(require 'vc)" -f vc-update-change-log -eval '(write-file (concat a "ChangeLog"))'



############################################################
#
# 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)

############################################################
#
# Images
#
images:	FORCE
	(cd images; $(MAKE) images)




############################################################
##
## tag:    tag the CVS sources of working directory with CVS_RELEASENAME,
##	   set version stamp in proof-site.el and ProofGeneral.spec 
##         to VERSION, and edit $(DOWNLOADHTML) if VERSION matches 
##	   PRERELEASE_TAG.
##
tag:		
	@echo "*************************************************"
	@echo " Tagging sources... (fails if CVS source dirty)"
	@echo "*************************************************"
	if [ -n "`cvs -n -q update`" ]; then exit 1; fi
# Tag proof-site.el and ProofGeneral.spec
	(cd generic; mv proof-site.el proof-site.el.old; sed -e 's/defconst proof-version \".*\"/defconst proof-version \"Proof General, Version $(VERSION) released by da. Email proofgen@dcs.ed.ac.uk.\"/g' proof-site.el.old > proof-site.el; rm proof-site.el.old)
	(cd etc; mv ProofGeneral.spec ProofGeneral.spec.old; sed -e 's/Version:.*$$/Version:	$(VERSION)/g' ProofGeneral.spec.old > ProofGeneral.spec; rm ProofGeneral.spec.old)
# Edit $(DOWNLOADHTML) only for prereleases.
# Careful: the sed command below relies on previous value of PRERELEASE_TAG.
	if [ $(PRERELEASE_TAG) = $(VERSION) ]; then \
	  (cd html; mv $(DOWNLOADHTML) $(DOWNLOADHTML).old; sed -e 's|ProofGeneral-2\.1pre......|ProofGeneral-$(PRERELEASE_TAG)|g' $(DOWNLOADHTML).old > $(DOWNLOADHTML); rm $(DOWNLOADHTML).old) \
	fi
# 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.  Otherwise we could use the %{version} macro in the spec file.
	(cd etc; mv ProofGeneral.spec ProofGeneral.spec.old; sed -e 's/ProofGeneral-.*.tar.gz/$(RELEASENAMETARGZ)/g' ProofGeneral.spec.old > ProofGeneral.spec; rm ProofGeneral.spec.old)
	cvs commit -m"Set version tag for new release." generic/proof-site.el html/$(DOWNLOADHTML) 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 for user-distribution, from sources tagged 
##       with CVS_RELEASENAME.
##	 Moves html files to parent directory, removes
##       non-distributed files.
##	    
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 "$(CVS_RELEASENAME)" -d $(RELEASENAME) $(CVSNAME))
	@echo "*************************************************"
	@echo " Running 'make alldist' for new release .."
	@echo "*************************************************"
	(cd $(DISTBUILDIR)/$(RELEASENAME); $(DEVELMAKE) alldist)
	(cd $(DISTBUILDIR)/$(RELEASENAME); $(DEVELMAKE) 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 "*************************************************"

############################################################
##
## develdist: make a distribution for developers from 
##	  raw CVS sources.
##	    
develdist:
	@echo "*************************************************"
	@echo " Making developer distribution..."
	@echo "*************************************************"
	mkdir -p $(DISTBUILDIR)
	(cd $(DISTBUILDIR); cvs export -kv -r "$(CVS_RELEASENAME)" -d $(RELEASENAME)-devel $(CVSNAME))
	$(TAR) -cvhf $(DISTBUILDIR)/$(DEVELRELEASENAMETAR) -C $(DISTBUILDIR) $(DEVELRELEASENAME)
	gzip -9 $(DISTBUILDIR)/$(DEVELRELEASENAMETAR)


############################################################
##
## 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 develdist
	mkdir -p $(RELEASEDIR)
	cp -pfr $(DISTBUILDIR)/* $(RELEASEDIR)
	(cd $(RELEASEDIR); rm -f $(NAME); ln -s $(RELEASENAME) $(NAME))
	(cd $(RELEASEDIR); ln -sf $(RELEASENAMETARGZ) $(LATESTNAME).tar.gz)
	(cd $(RELEASEDIR); ln -sf $(RELEASENAME)-1.noarch.rpm $(LATESTNAME).noarch.rpm)
	(cd $(RELEASEDIR); ln -sf $(DEVELRELEASENAMETARGZ) $(DEVELLATESTNAME).tar.gz)
	@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)

############################################################
##
## releaseclean:
##     Clean up temporary directories after building dist/release.
##
releaseclean:
	rm -rf $(DISTBUILDIR) $(RPMTOPDIR)

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


############################################################
##
## releasefinal:
##     Do everything for a final release based on a pre-release.
##     Don't use       
##
releasefinal: release rpmrelease distinstall releaseclean 


############################################################
##
## distinstall:
##     Do everything for a local release.
##	  
distall: distclean tag dist distinstall releaseclean



############################################################
#
# distinstall:
#   Install distribution from $(DISTBUILDIR) into DISTINSTALLDIR
#   Clean out DISTINSTALLDIR first.
#   NB!  Simple install, no attempt to put info files, etc, in
#   special places.
#
distinstall:
	rm -rf $(DISTINSTALLDIR)/$(NAME)
	mkdir -p $(DISTINSTALLDIR)
	(cd $(DISTINSTALLDIR); \
	 $(TAR) -xpzf $(DISTBUILDIR)/$(RELEASENAMETARGZ); \
	 mv $(RELEASENAME) $(NAME))


############################################################
#
# etags
#
etags:
	etags */*.el > TAGS