-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile-old
233 lines (159 loc) · 9.59 KB
/
Makefile-old
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
#WEBSERVER=nmag.soton.ac.uk
WEBSERVER=152.78.138.239
DATE=$(shell date +%Y-%m-%d-T%H-%M-%S)
#on alpha
#LIBSOURCE_FILE=/var/local/www/webroot/nmag/pkgs.tar
#on eta (and we use eta to update the packages)
LIBSOURCE_FILE=/var/local/nmag/pkgs.tar
TAR_SVNEXCLUDE=--anchored --exclude=*.svn --exclude=*/*.svn --exclude=*/*/*.svn --exclude=*/*/*/*.svn --exclude=*/*/*/*/*.svn --exclude=*/*/*/*/*/*.svn --exclude=nmag/nsim/obsolete --exclude=nmag/nsim/interface/nmesh/doc --exclude=nmag/nsim/interface/nmeshlj/doc --exclude=nmag/nsim/devel
# Note: this variable can and will be overridden via "make NSIM_VERSION=0.1 all".
NSIM_VERSION=devel
NSIM_BRANCH=$(patsubst tags/release/devel,trunk,tags/release/$(NSIM_VERSION))
DEBVERSION=$(NSIM_VERSION:devel=0.9999)
SRCDIR=nsim-$(NSIM_VERSION)
INST_SYSTEMDIR=tmp/nmag-$(NSIM_VERSION)
all: html-toplevel r2w-call current-link tarballs debian-package webroot
config:
echo " NSIM_VERSION: $(NSIM_VERSION)"
echo " NSIM_BRANCH: $(NSIM_BRANCH)"
echo " DEBVERSION: $(DEBVERSION)"
echo " SRCDIR: $(SRCDIR)"
echo " INST_SYSTEMDIR: $(INST_SYSTEMDIR)"
# === KNOWN VERSIONS ===
devel: #this checks out the trunk
make NSIM_VERSION=devel config
make -f Makefile NSIM_VERSION=devel all
# Experimental branch to test this version-aware build system:
0.099:
make -f Makefile NSIM_VERSION=0.099 all
# Does not exist yet:
0.1:
make -f Makefile NSIM_VERSION=0.1 all
# === /KNOWN VERSIONS ===
mrproper:
rm -rf tmp/*
rm -rf output/*/download/*.tar.gz
rm -rf webserver-webroot/*
webroot:
mkdir webserver-webroot || /bin/true # ensure it exists
rsync -auv --exclude .svn output/* webserver-webroot/nmag/
rsync -auv --exclude Makefile --exclude .svn debian/web/debian/ webserver-webroot/debian/
cd webserver-webroot/debian; rm -f debian; ln -s . debian
# This introduces the link current -> [current version]:
current-link:
rm -f output/current
# cd output; ln -s devel current
cd output; ln -s 0.1 current
# This builds the "outer" HTML structure which contains general
# explanations on installation, etc. plus links to the individual
# versions:
#The pure r2w-stuff
r2w-call:
echo "NSIM_VERSION is"
echo "$(NSIM_VERSION)"
svn export svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/$(NSIM_BRANCH)/svnversion input/$(NSIM_VERSION)/svnversion
svn export svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/$(NSIM_BRANCH)/interface/nmag/RELEASE input/$(NSIM_VERSION)/release_version.uyu
cd input; r2w
html-toplevel: manuals
cat input/$(NSIM_VERSION)/install/_a_index input/$(NSIM_VERSION)/install/_a_INSTALL > input/$(NSIM_VERSION)/install/install_a.txt
installation-system:
mkdir -p $(INST_SYSTEMDIR)/nmag
svn co svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/dist/src $(INST_SYSTEMDIR)/nmag
cd $(INST_SYSTEMDIR)/nmag/doc/installation_manual; make
clean:
rm -rf tmp/nsim-build/nmag/nsim
rm -rf tmp/nsim-0.1/nmag/nsim
nsim:
cd tmp; mkdir -p nsim-build/nmag
cd tmp/nsim-build/nmag; svn co svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/$(NSIM_BRANCH) nsim
#when we release properly, we add a file 'svnversion' with the
#release number, so that we know it for the future. If we check
#out the trunk, we need to add that file at this
#stage. (Hans July 2008)
if [ $(NSIM_BRANCH) == trunk ]; then cd tmp/nsim-build/nmag/nsim; \
rm -f svnversion; svnversion > svnversion ; fi
#cd tmp/nsim-build/nmag/nsim/config; python configure.py --cflags=-march=i386
cd tmp/nsim-build/nmag/nsim/config; python configure-openmpi.py --cflags=-march=i386
cd tmp/nsim-build/nmag/nsim; make all doc
fetchtrunk:
#This is used for the creation of the tar file
echo "About to do a clean checkout from the repository (trunk) for the distribution."
cd tmp; svn co svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/dist/src/ $(SRCDIR)
mkdir -p tmp/$(SRCDIR)/nmag
cd tmp/$(SRCDIR)/nmag; svn co svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/$(NSIM_BRANCH) nsim
cd tmp/$(SRCDIR)/nmag/nsim; svnversion > ../../../../input/$(NSIM_VERSION)/svnversion
# cd tmp/$(SRCDIR)/nmag/nsim; make interface/nsim/svnversion.py
echo "XXX make svnversion.py NOT DONE. First, this does not work, second, we do not want to build pyfem in the bare source directory. (Why is this necessary at all?)"
tarballs: fetchtrunk installation-system nsim
#create links for nmag manual into toplevel 'doc' dir
mkdir -p output/$(NSIM_VERSION)/download
rm -rf tmp/$(SRCDIR)/nmag/doc/nmag
mkdir -p tmp/$(SRCDIR)/nmag/doc/nmag
ln -s ../nsim/interface/nmag/manual tmp/$(SRCDIR)/nmag/doc
echo " *** REMOVING OLD TARBALLS *** "
rm -f output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)*.tar*
echo " *** CREATING CORE NMAG BUILD ARCHIVE *** "
tar --directory $(INST_SYSTEMDIR) $(TAR_SVNEXCLUDE) -cvf output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-core.tar nmag
echo " *** ADDING NSIM SOURCES ARCHIVE *** "
echo "tarball" >tmp/$(SRCDIR)/nmag/nsim/interface/nmag/DISTMODE
tar --directory tmp/$(SRCDIR) $(TAR_SVNEXCLUDE) --exclude=nmag/nsim/info -rf output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-core.tar nmag/nsim nmag/doc
rm tmp/$(SRCDIR)/nmag/nsim/interface/nmag/DISTMODE
# This should not be necessary, as we built that manual anyway when we made installation-system:
#tar --directory $(INST_SYSTEMDIR) -rf output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-all.tar nmag/INSTALL.pdf nmag/INSTALL.html
echo " *** ADDING MANUAL TO ARCHIVE *** "
tar --directory tmp/nsim-build $(TAR_SVNEXCLUDE) -rf output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-core.tar nmag/nsim/interface/nmag/manual
cp output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-core.tar \
output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-all.tar
echo " *** ADDING PACKAGE SOURCES TO BIG ARCHIVE *** "
tar --directory tmp -Af output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-all.tar $(LIBSOURCE_FILE)
echo " *** ZIPPING TARBALLS *** "
# Gzip final tarballs:
gzip -9 output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-core.tar
gzip -9 output/$(NSIM_VERSION)/download/nmag-$(NSIM_VERSION)-all.tar
manuals: installation-system nsim
#copy to final destination
rsync -auv tmp/nsim-build/nmag/nsim/interface/nmag/manual/* output/$(NSIM_VERSION)/manual
rsync -auv $(INST_SYSTEMDIR)/nmag/INSTALL input/$(NSIM_VERSION)/install/_a_INSTALL
debian-package: nsim manuals fetchtrunk
rsync -av --delete --exclude '*~' --exclude '*.pyc' --exclude '.svn' tmp/nsim-build/nmag/nsim/interface/* debian/packages/nsim/interface/
cp -a tmp/nsim-build/nmag/nsim/bin/n* debian/packages/nsim/bin/
cp -a tmp/nsim-build/nmag/nsim/tests/pytest_main.py debian/packages/nsim/interface
cp debian/adjustments/* debian/packages/nsim/bin/
bin/svnversion-to-debian-changelog.pl $(DEBVERSION)
cp -a tmp/nsim-build/nmag/nsim/pyfem3/pyfem3 debian/packages/nsim/bin/pyfem
cd debian/packages/nsim; debuild -us -uc
cd debian/web; perl -MFile::Find -e 'sub w{shift; m/nsim.*deb/ and unlink};find({no_chdir=>1,wanted=>\&w},".");'
mv debian/packages/nsim_*.{dsc,changes,deb,tar.gz} debian/web/
cd debian/web; make
# NOTE: not adjusted yet:
#web-publish: webroot. Note that this will delete any
#files on the target that are not at the source location
web-publish: web-publish-nmag web-publish-debian
web-publish-nmag:
rsync -avz --exclude '.svn' --delete -e ssh webserver-webroot/nmag/ www-data@$(WEBSERVER):/var/local/www/virtual-hosts/nmag/webroot/nmag/
web-publish-debian:
rsync -avz --exclude '.svn' --delete -e ssh webserver-webroot/debian/ www-data@$(WEBSERVER):/var/local/www/virtual-hosts/nmag/webroot/debian/
#will not delete anything at target location
web-update:
rsync -avz --exclude '.svn' -e ssh webserver-webroot/nmag/ www-data@$(WEBSERVER):/var/local/www/virtual-hosts/nmag/webroot/nmag/
rsync -avz --exclude '.svn' -e ssh webserver-webroot/debian/ www-data@$(WEBSERVER):/var/local/www/virtual-hosts/nmag/webroot/debian/
# Hans insists on having the tarball use a different toplevel directory name.
# We repackage on the webserver:
web-repackage:
ssh www-data@$(WEBSERVER) "cd /var/local/www/virtual-hosts/nmag/webroot/nmag/$(NSIM_VERSION)/download; echo 'OK 1'; tar xzf nmag-$(NSIM_VERSION)-core.tar.gz; echo 'OK 2'; mv nmag nmag-$(NSIM_VERSION); echo 'OK 3'; rm nmag-$(NSIM_VERSION)-core.tar.gz; tar cvzf nmag-$(NSIM_VERSION)-core.tar.gz nmag-$(NSIM_VERSION); echo 'OK 4'; rm -rf nmag-$(NSIM_VERSION); tar xzf nmag-$(NSIM_VERSION)-all.tar.gz; echo 'OK 5'; mv nmag nmag-$(NSIM_VERSION); echo 'OK 6'; rm nmag-$(NSIM_VERSION)-all.tar.gz; echo 'OK 7'; tar cvzf nmag-$(NSIM_VERSION)-all.tar.gz nmag-$(NSIM_VERSION); rm -rf nmag-$(NSIM_VERSION)"
web-repackage-local:
cd webserver-webroot/nmag/$(NSIM_VERSION)/download; echo 'OK 1'; tar xzf nmag-$(NSIM_VERSION)-core.tar.gz; echo 'OK 2'; mv nmag nmag-$(NSIM_VERSION); echo 'OK 3'; rm nmag-$(NSIM_VERSION)-core.tar.gz; tar cvzf nmag-$(NSIM_VERSION)-core.tar.gz nmag-$(NSIM_VERSION); echo 'OK 4'; rm -rf nmag-$(NSIM_VERSION); tar xzf nmag-$(NSIM_VERSION)-all.tar.gz; echo 'OK 5'; mv nmag nmag-$(NSIM_VERSION); echo 'OK 6'; rm nmag-$(NSIM_VERSION)-all.tar.gz; echo 'OK 7'; tar cvzf nmag-$(NSIM_VERSION)-all.tar.gz nmag-$(NSIM_VERSION); rm -rf nmag-$(NSIM_VERSION)
# XXX NOTE: add .PHONY line!
#Hans preferred command to update everything:
#
#first tag a new release version with the tool in svn+ssh://alpha.kk.soton.ac.uk/var/local/svn/nsim/branches/bin/make-nmag-tag.sh
# Then run on eta
#
#time make NSIM_VERSION=0.1 clean all web-repackage-local
#
# to get everything ready and
#time make NSIM_VERSION=0.1 clean all web-repackage-local web-publish
#
# to get it on the server
# compile everything apart from debian packages:
# time make NSIM_VERSION=0.1 html-toplevel r2w-call current-link tarballs webroot web-repackage-local