aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile.devel
blob: ce3a2891767b7cffa6ef93d2d066caccf4d43f35 (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
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
##
## 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)
##			     NB: ChangeLog.gz is kept in repo.
##    make tags		  - update TAGS file for Elisp sources
##    make autoloads	  - update autoloads
##
##    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.phtml and doc.phtml 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 FULLVERSION=2.0.1
##
## NB: if this release is made from an old branch, beware that html
## files (news!)  etc, will all be downgraded.  To fix, make a
## development release immediately afterwards.
##
## $Id$
## 
###########################################################################

# Names and real mail addresses of developers
# Arguments for rcs2log for ChangeLog target

DEVELOPERS=\
 -u "da		David Aspinall	da@dcs.ed.ac.uk" \
 -u "markus	Markus Wenzel	wenzelm@informatik.tu-muenchen.de" \
 -u "pier	Pierre Courtieu	courtieu@lri.fr" \
 -u "crr	Christophe Raffalli	Christophe.Raffalli@univ-savoie.fr" \
 -u "pxc	Paul Callaghan	P.C.Callaghan@durham.ac.uk" \
 -u "patrl	Patrick Loiseleur	Patrick.Loiseleur@lri.fr" \
 -u "tms	Thomas Kleymann	tms@dcs.ed.ac.uk" \
 -u "djs	Dilip Sequiera	djs@dcs.ed.ac.uk" \
 -u "hhg	Healfdene Goguen	hhg@dcs.ed.ac.uk"



# PRERELEASE_PREFIX is used to match PRERELEASE_TAG in sed
# line in tag target below, which edits $(DOWNLOADHTML)
PRERELEASE_PREFIX=3\.2pre
PRERELEASE_TAG=3.2pre$(shell date "+%y%m%d")
PREREL_TAG_FILE=prereltag.txt

DOWNLOADHTML=develdownload.phtml
DOWNLOADINFOHTML=devel.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)

# Date stamp used in file if we're making a full release.
DATEMSG=$(shell if [ $(PRERELEASE_TAG) = $(VERSION) ]; then echo; else date "+ on %a %e %b %Y"; fi)


NAME = ProofGeneral
LATESTNAME = $(NAME)-latest
DEVELLATESTNAME = $(NAME)-devel-latest

VERSIONVARIABLE=proof-general-version
VERSIONFILE=proof-site.el

# Full version number defaults to ordinary version number.
FULLVERSION=$(VERSION)

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

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

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

# How to make the release "live".  (Could be "true" to do nothing).
# GOLIVE="scp -r $RELEASEDIR tweed:/home/proofgen/www"
GOLIVE=true

CVSNAME = ProofGeneral

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

# Emacs for batch compiling
BATCHEMACS=xemacs -batch -q -no-site-file

# GNU version of tar, please
TAR=tar
# zip utility
ZIP=zip

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

# Files not to include the distribution area or tarball 
NONDISTFILES=.cvsignore */.cvsignore html etc Makefile.devel Makefile.xemacs doc/notes.txt doc/ProofGeneral.dvi doc/ProofGeneralPortrait.eps* images/*.xcf images/notes.txt images/gimp images/Makefile plastic/ 

# Files not to include in the ordinary distribution tarball, but left
# in the server's copy of the distribution.
# NB: these are *patterns* to exclude rather than files!
# I would rather have files themselves to exclude, but 
# seems to be no way.
IGNOREDFILES=ProofGeneral*/Makefile.devel ProofGeneral*/todo ProofGeneral*/ChangeLog.gz ProofGeneral*/doc/ProofGeneral.dvi ProofGeneral*/doc/ProofGeneral.ps.gz ProofGeneral*/doc/ProofGeneral.pdf ProofGeneral/*/todo

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

# Temporary RPM topdir for building packages as non-root user.
RPMTOPDIR=/tmp/$(NAME)-rpm
# rpm 3.0 has changed rc file beyond recognition.
# now wants a macro file included and stuck in ~/.rpmmacros.
# Alternative is to use --define from command line.
# RPMRC=$(RPMTOPDIR)/rpmrc
# RPM=rpm --rcfile $(RPMRC)
RPM=rpm --define '_topdir $(RPMTOPDIR)'

RELEASENAMETAR = $(RELEASENAME).tar
RELEASENAMETARGZ = $(RELEASENAMETAR).gz
RELEASENAMEZIP = $(RELEASENAME).zip
# 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 = 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 isar plastic demoisa hol98 af2 twelf
SUBDIRS=$(ELISP_DIRS) etc doc html images

PWD=$(shell pwd)

BYTECOMP = $(BATCHEMACS) -eval '(setq load-path (append (list "$(PWD)/generic" "$(PWD)/lego" "$(PWD)/coq" "$(PWD)/isa" "$(PWD)/isar") 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

%.gz:	%
	gzip -f $*

FORCE:

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


############################################################
#
# Make tags file
#
tags:	$(EL)
	etags $(EL) doc/ProofGeneral.texi > TAGS



############################################################
#
# Re-Build ChangeLog.  CVSROOT must be set correctly.
# Correct dependency would be to check repository for changes!
#
ChangeLog:	FORCE
	rm -f ChangeLog
	rcs2log -h "dcs.ed.ac.uk" $(DEVELOPERS) > ChangeLog



############################################################
#
# Clean up intermediate files 
#
clean:	
	(cd doc; $(MAKE) clean)
	(cd images; $(MAKE) clean)
	rm -f doc/ProofGeneralPortrait.eps.gz
	rm -f html/ProofGeneral



############################################################
#
# Clean up intermediate files, all generated files 
#  and Emacs backups, CVS temps
#
distclean:	clean
	find . \( -name '*~' -o -name '#*#' -o -name '\.\#*' \) -print | xargs rm -f
	(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)


############################################################
#
# autoloads in generic/
#
autoloads: $(EL)
	$(BATCHEMACS) -eval '(setq autoload-package-name "proof" generated-autoload-file "$(PWD)/generic/proof-autoloads.el")' -f batch-update-autoloads  generic/



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

distdocs: FORCE
	(cd doc; ln -s ../html/ProofGeneralPortrait.eps.gz .; $(MAKE) dist)

############################################################
#
# 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) and $(DOWNLOADINFOHTML)
##         if VERSION matches PRERELEASE_TAG.
##
tag:		
	@echo "*************************************************"
	@echo " Tagging sources... (rerun if CVS source dirty)"
	@echo "*************************************************"
# Update the sources, this is almost always what we want to do.
	if [ -z "$(NOCVS)" ] && [ -n "`cvs -n -q update`" ]; then cvs update -d; exit 1; fi
# Tag proof-site.el and ProofGeneral.spec
	(cd generic; mv $(VERSIONFILE) $(VERSIONFILE).old; sed -e 's/defconst $(VERSIONVARIABLE) \".*\"/defconst $(VERSIONVARIABLE) \"Proof General Version $(FULLVERSION). Released by da$(DATEMSG).\"/g' $(VERSIONFILE).old > $(VERSIONFILE); rm $(VERSIONFILE).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-$(PRERELEASE_PREFIX)......|ProofGeneral-$(PRERELEASE_TAG)|g' $(DOWNLOADHTML).old > $(DOWNLOADHTML); rm $(DOWNLOADHTML).old); \
	  (cd html; mv $(DOWNLOADINFOHTML) $(DOWNLOADINFOHTML).old; sed -e 's|ProofGeneral-$(PRERELEASE_PREFIX)......|ProofGeneral-$(PRERELEASE_TAG)|g' $(DOWNLOADINFOHTML).old > $(DOWNLOADINFOHTML); rm $(DOWNLOADINFOHTML).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)
	(cd etc; mv ProofGeneral.spec ProofGeneral.spec.old; sed -e 's/ProofGeneral-.*.zip/$(RELEASENAMEZIP)/g' ProofGeneral.spec.old > ProofGeneral.spec; rm ProofGeneral.spec.old)
	if [ -z "$(NOCVS)" ]; then cvs commit -m"Set version tag for new release." generic/$(VERSIONFILE) html/$(DOWNLOADHTML) html/$(DOWNLOADINFOHTML) etc/ProofGeneral.spec; fi
	if [ -z "$(NOCVS)" ]; then cvs tag "$(CVS_RELEASENAME)"; fi

############################################################
##
## 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 "*************************************************"
	if [ -z "$(NOCVS)" ]; then \
           (cd $(DISTBUILDIR); cvs export -kv -r "$(CVS_RELEASENAME)" -d $(RELEASENAME) $(CVSNAME)); \
	else \
	   mkdir -p $(DISTBUILDIR)/$(RELEASENAME); \
	   cp -pr . $(DISTBUILDIR)/$(RELEASENAME); \
	fi
	@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 "*************************************************"
	for f in $(IGNOREDFILES); do echo $$f >> ignoredfiles; done
	(cd $(DISTBUILDIR); ln -s $(RELEASENAME) $(NAME))
	$(TAR) -cvf $(DISTBUILDIR)/$(RELEASENAMETAR) -C $(DISTBUILDIR) $(RELEASENAME) $(NAME) -X ignoredfiles
	rm -f ignoredfiles
	gzip -9 $(DISTBUILDIR)/$(RELEASENAMETAR)
	@echo "*************************************************"
	@echo " Making zip file..."
	@echo "*************************************************"
	(cd $(DISTBUILDIR); for f in $(IGNOREDFILES); do echo $$f >> ignoredfiles; done)
	(cd $(DISTBUILDIR); $(ZIP) -r $(RELEASENAMEZIP) $(RELEASENAME) -x@ignoredfiles)
	rm -f ignoredfiles
	@echo "*************************************************"
	@echo " Finished making dist."
	@echo "*************************************************"

############################################################
##
## develdist: make a distribution for developers from 
##	  raw CVS sources, updating the ChangeLog.
##	    
develdist:
	@echo "*************************************************"
	@echo " Making developer distribution..."
	@echo "*************************************************"
	mkdir -p $(DISTBUILDIR)
	if [ -z "$(NOCVS)" ]; then \
           (make devel.ChangeLog.gz; cvs commit -m"Updated." ChangeLog.gz; cd $(DISTBUILDIR); cvs export -kv -r "$(CVS_RELEASENAME)" -d $(DEVELRELEASENAME) $(CVSNAME)) \
	else \
	   mkdir -p $(DISTBUILDIR)/$(DEVELRELEASENAME); \
	   cp -pr . $(DISTBUILDIR)/$(DEVELRELEASENAME); \
	fi
	$(TAR) -cvf $(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 $(RELEASENAMEZIP) $(LATESTNAME).zip)
	(cd $(RELEASEDIR); ln -sf $(RELEASENAME)-1.noarch.rpm $(LATESTNAME).noarch.rpm)
	(cd $(RELEASEDIR); ln -sf $(RELEASENAME)-1.src.rpm $(LATESTNAME).src.rpm)
	(cd $(RELEASEDIR); ln -sf $(DEVELRELEASENAMETARGZ) $(DEVELLATESTNAME).tar.gz)
	(cd $(RELEASEDIR); echo $(PRERELEASE_TAG) > $(PREREL_TAG_FILE))
	@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
	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)

############################################################
##
## fakereleaseall:
##     Do everything, but don't access CVS.  Just for
##     testing on non-live system, really.
##	  
## 
fakereleaseall: 
	$(MAKE) -f Makefile.devel release rpmrelease  releaseclean golive NOCVS="no" 

############################################################
##
## releaseall:
##     Do everything!
##	  
##  For now, don't do distinstall any more: this only works 
##   for the DCS Sun machines.
## 
releaseall: release rpmrelease  releaseclean golive

############################################################
##
## golive:
##     Execute golive command.
##	  
golive:
	$(GOLIVE)

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

############################################################
#
# links:
#   
#   Make some handy links for developers.
#
links:
	ln -sf ../html/ProofGeneralPortrait.eps.gz doc
	ln -sf ../../ProofGeneral html