-
Notifications
You must be signed in to change notification settings - Fork 161
/
Makefile
230 lines (190 loc) · 6.91 KB
/
Makefile
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
## Top Level Makefile
## Before making changes here, please take a look at Makeconf
include ./Makeconf
ESSVERSION := $(shell cat VERSION)
PKGVERSION := $(shell sed -n 's/;; Version: *\(.*\) */\1/p' lisp/ess.el)
ESSDIR := ess-$(ESSVERSION)
ifneq ($(ESSVERSION), $(PKGVERSION))
$(shell sed -i 's/Version: .*/Version: $(ESSVERSION)/' VERSION)
${shell sed -i 's/;; Version: .*/;; Version: $(ESSVERSION)/' lisp/ess.el}
endif
ESSR-VERSION := $(shell sed -n "s/;; ESSR-Version: *\(.*\) */\1/p" lisp/ess.el)
.PHONY: all
all: lisp doc etc autoloads
.PHONY: version
version: VERSION
@echo "********************* VERSIONS **************************"
@echo $(shell $(EMACS) --version | sed -n 1p)
@echo ESS $(ESSVERSION)
@echo ESSR $(ESSR-VERSION)
@sed -i.orig "s/\"VERSION\"/\"$(ESSVERSION)\"/" lisp/ess-custom.el
@echo "*********************************************************"
## "-i.orig": FreeBSD sed -i requires a file extension;
## GNU sed -i does not require, but allows one
.PHONY: lisp
lisp: version
$(MAKE) -C lisp all
.PHONY: doc
doc: version
$(MAKE) -C doc all
.PHONY: etc
etc: version
$(MAKE) -C etc all
.PHONY: test
test: version
$(MAKE) -C test all
test-%: version
$(MAKE) -C test $*
.PHONY: julia
julia:
@cd lisp; $(MAKE) julia-mode.el
.PHONY: autoloads
autoloads:
cd lisp; $(MAKE) ess-autoloads.el
## Rebuild and publish ESSR package:
# 1. Update ESSR-Version in lisp/ess.el
# 2. make essr
.PHONY: essr
essr: VERSION
@echo "**********************************************************"
@echo "** Making ESSRv$(ESSR-VERSION) **"
@sed -i "s/^ *VERSION <- .*/ VERSION <- \"$(ESSR-VERSION)\"/" etc/ESSR/R/.load.R
cd etc/ESSR/; ./BUILDESSR; cd -
@git add etc/ESSR.rds lisp/ess.el etc/ESSR/R/.load.R
git commit -m"ESSR Version $(ESSR-VERSION)"
git tag "ESSRv"$(ESSR-VERSION)
git push
git push origin "ESSRv"$(ESSR-VERSION)
install: all
mkdir -p $(ESSDESTDIR)
$(INSTALL) -R ./* $(ESSDESTDIR)/
uninstall:
rm -rf $(ESSDESTDIR)
## the rest of the targets are for ESS developer's use only :
.PHONY: tarballs sign-tarballs
TARBALLS = ess-$(ESSVERSION).tar ess-$(ESSVERSION).tgz ess-$(ESSVERSION).zip # TODO: ess-plus-$(VERSION).tar
tarballs: $(TARBALLS)
SIGNED_TARBALLS = $(addsuffix .sig, $(TARBALLS))
sign-tarballs: $(SIGNED_TARBALLS)
$(SIGNED_TARBALLS): $(TARBALLS)
@echo "Signing $@"
$(GPG) -ba -o $@ $<
.PHONY: tgz
tgz: ess-$(ESSVERSION).tgz
ess-$(ESSVERSION).tgz: $(ESSDIR)
@echo "** Creating .tgz file **"
test -f $(ESSDIR).tgz && rm -rf $(ESSDIR).tgz || true
$(GNUTAR) hcvofz $(ESSDIR).tgz $(ESSDIR)
.PHONY: zip
zip: ess-$(ESSVERSION).zip
ess-$(ESSVERSION).zip: $(ESSDIR)
@echo "** Creating .zip file **"
test -f $(ESSDIR).zip && rm -rf $(ESSDIR).zip || true
zip -r $(ESSDIR).zip $(ESSDIR)
.PHONY: package
package: ess-$(ESSVERSION).tar
ess-$(ESSVERSION).tar:
@echo "Creating $@"
@rm -rf $(ESSDIR)
@git archive HEAD -o ess-$(ESSVERSION).tar
@mkdir ess-$(ESSVERSION)
@$(GNUTAR) -C ess-$(ESSVERSION) -xf ess-$(ESSVERSION).tar
@cd ess-$(ESSVERSION) && $(EMACS) -Q --script "targets/create-pkg-file.el"
@$(GNUTAR) c -f ess-$(ESSVERSION).tar ess-$(ESSVERSION)
@rm -rf ess-$(ESSVERSION)/
# Create the "release" directory
# run in the foreground so you can accept the certificate
# NB 'all', 'cleanup-dist' must not be targets: otherwise, e.g.
# 'make tarball' re-builds the tarballs always!
$(ESSDIR): RPM.spec autoloads
$(MAKE) all
# remove previous ESSDIR, etc:
$(MAKE) cleanup-dist
@echo "** Exporting Files **"
git clone . $(ESSDIR)-git
mkdir -p $(ESSDIR)
(cd $(ESSDIR)-git; $(GNUTAR) cvf - --exclude=.git --exclude=.svn --no-wildcards .) | (cd $(ESSDIR); $(GNUTAR) xf - )
@echo "** Clean-up docs, Make docs, and Correct Write Permissions **"
CLEANUP="user-* useR-* Why_* README.*"; ED=$(ESSDIR)/doc; \
if [ -d $$ED ] ; then CD=`pwd`; cd $$ED; chmod -R u+w $$CLEANUP; rm -rf $$CLEANUP; \
$(MAKE) all cleanaux ; cd $$CD; fi
# just in case: update from VERSION:
cd lisp; $(INSTALL) ess.el ../$(ESSDIR)/lisp/; cd ..
cd lisp; $(MAKE) julia-mode.el; $(INSTALL) julia-mode.el ../$(ESSDIR)/lisp/; cd ..
$(INSTALL) RPM.spec $(ESSDIR)/
$(INSTALL) lisp/ess-autoloads.el $(ESSDIR)/lisp/
chmod a-w $(ESSDIR)/lisp/*.el
chmod u+w $(ESSDIR)/lisp/ess-site.el $(ESSDIR)/Make* $(ESSDIR)/*/Makefile
touch $(ESSDIR)/etc/.IS.RELEASE
# # Get (the first 12 hexdigits of) the git version into the release tarball:
$(shell git-rev-parse master | cut -c 1-12 ) > $(ESSDIR)/etc/git-ref
dist: VERSION tarballs
@echo "** Making pdf and html documentation"
@cd $(ESSDIR)/doc/ ; $(MAKE) pdf
@cd $(ESSDIR)/doc/ ; $(MAKE) html
grep -E 'defvar ess-(version|revision)' lisp/ess-custom.el \
$(ESSDIR)/lisp/ess-custom.el > $@
.PHONY: cleanup-dist cleanup-rel
cleanup-dist:
@echo "** Cleaning up **"
rm -f $(ESSDIR)/etc/.IS.RELEASE $(ESSDIR)/etc/git-ref
(if [ -d $(ESSDIR) ] ; then \
chmod -R u+w $(ESSDIR) $(ESSDIR)-git && rm -rf $(ESSDIR) $(ESSDIR)-git; fi)
## should only be called manually (if at all):
cleanup-rel:
# @rm -rf $(ESSDIR)*
@rm -f tarballs dist tag homepage upload rel
%.spec: %.spec.in VERSION
sed 's/@@VERSION@@/$(ESSVERSION)/g' $< > $@
## --- RELEASE section ---
ChangeLog: VERSION
@echo "** Adding log-entry to ChangeLog file"
mv ChangeLog ChangeLog.old
(echo `date "+%Y-%m-%d "` \
" ESS Maintainers <[email protected]>" ; \
echo; echo " * Version $(ESSVERSION) released."; echo; \
cat ChangeLog.old ) > ChangeLog
@rm ChangeLog.old
git commit -m 'Version $(ESSVERSION)' ChangeLog
tag:
@echo "** Tagging the release ** 1) pull existing; 2) tag 3) push it"
git fetch --tags
## git pull --tags
@echo "Creating tag (no signing, as that fails for MM)"
git tag -m'release tagging' v$(ESSVERSION)
@echo '** Pushing the v$(ESSVERSION) upstream ...'
git push origin v$(ESSVERSION)
@touch $@
# signing fails for MM (gpg2 / gpg ??) --> use a non-signed tag above
# @echo "Creating tag and signing using $(GPG)"
# git tag -s -m'release tagging' v$(ESSVERSION)
homepage:
@echo "** Updating ESS Webpage **"
[ x$$USER = xmaechler ] || (echo 'must be maechler'; exit 1 )
cd $(ESS_HOMEPAGE); ./update-VERSION $(ESSVERSION)
@touch $@
upload:
[ x$$USER = xmaechler ] || (echo 'must be maechler'; exit 1 )
@echo "** Placing .tgz and .zip files and their .sig's **"
@chmod a+r $(ESSDIR).tgz $(ESSDIR).tgz.sig $(ESSDIR).zip $(ESSDIR).zip.sig
cp -p $(ESSDIR).tgz $(ESSDIR).tgz.sig $(ESSDIR).zip $(ESSDIR).zip.sig $(UPLOAD_DIR)
@echo "** Creating LATEST.IS. file **"
rm -f $(UPLOAD_DIR)/LATEST.IS.*
touch $(UPLOAD_DIR)/LATEST.IS.$(ESSDIR)
touch $@
#==== RELEASE : ====
rel: ChangeLog dist tag homepage upload
@echo "If all is perfect, eventually call 'make cleanup-rel'"
touch $@
## NB: The rpm (SuSE, RH, FC) and debian packages are built *and* signed
## by the down stream maintainers:
.PHONY: buildrpm
buildrpm: dist
rpmbuild -ta --sign $(ESSDIR).tgz
builddeb:
dpkg-buildpackage -uc -us -rfakeroot -tc
clean distclean: cleanup-dist
rm -f ess-$(ESSVERSION).tar
cd etc; $(MAKE) $@
cd lisp; $(MAKE) $@
cd doc; $(MAKE) $@