-
Notifications
You must be signed in to change notification settings - Fork 39
/
Makefile_local
186 lines (146 loc) · 4.48 KB
/
Makefile_local
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
# |
# o---------------------------------------------------------------------o
# |
# | MAD makefile - personal post-makefile stuff
# |
# o---------------------------------------------------------------------o
# |
# | Methodical Accelerator Design
# |
# | Copyright (c) 2011+ CERN, mad@cern.ch
# |
# | For more information, see http://cern.ch/mad
# |
# o---------------------------------------------------------------------o
# |
# | $Id$
# |
# useful macros
ismacsrv = $(and $(call eq,$(OSTYPE),Darwin),\
$(or $(call eq,$(PWD),/Users/mad/madX),\
$(call eq,$(PWD),/Users/ldeniau/Projects/madx/madx-src)),yes)
islxplus = $(and $(call eq,$(OSTYPE),Linux),\
$(findstring lxplus,$(HOSTNAME)),\
$(wildcard /afs/cern.ch/eng/lhc/optics),yes)
###################################
# Build & Install
.PHONY: madx-release
ifeq ($(ismacsrv),yes)
madx-release: madx-info madx-src madx-usrguide madx-install madx-mktag
else ifeq ($(islxplus),yes)
madx-release: madx-install madx-reports madx-activate
endif
#
# madx info file
#
.PHONY: madx-info
madx-info:
$E "*** Building $@"
$_ echo "release $(VERSION)" > madx-info.txt ; \
echo "`date '+date %Y.%m.%d %H:%M:%S'`" >> madx-info.txt ; \
echo "svn `svn update`" >> madx-info.txt ; \
echo `grep svn madx-info.txt`
#
# madx src tarball
#
.PHONY: madx-src
madx-src:
$E "*** Building $@"
$_ svn export http://svn.cern.ch/guest/madx/trunk/madX madx-$(VERSION) && \
tar cvz --exclude madx-$(VERSION)/examples -f madx-src.tgz madx-$(VERSION) && \
rm -rf madx-$(VERSION)
#
# madx latex user's guide
#
.PHONY: madx-usrguide
madx-usrguide:
$E "*** Building $@"
$_ cd doc/latexuguide ; ./makelatexdoc && cd - && \
cp doc/latexuguide/uguide.pdf madxuguide.pdf
#
# madx installation (Darwin and Linux only)
#
.PHONY: madx-install
FILES = $(wildcard madx-linux*-gnu numdiff-linux*-gnu \
madx-macosx*-gnu numdiff-macosx*-gnu \
madx-win*-gnu.exe numdiff-win*-gnu.exe \
madx-src.tgz madxuguide.pdf madx-info.txt)
madx-install:
$E "*** Installing madx"
ifeq ($(ismacsrv),yes)
$_ rm -rf $(VERSION) && \
mkdir $(VERSION) $(VERSION)/reports && \
cp -L $(FILES) $(VERSION)
else ifeq ($(islxplus),yes)
$_ rm -rf $(VERSION) && \
mkdir $(VERSION) $(VERSION)/reports && \
cp -L $(FILES) $(VERSION) && \
scp -o PubkeyAuthentication=no -r \
mad@macserv15865:madX/$(VERSION) mad@lxplus.cern.ch:madx/releases && \
scp -o PubkeyAuthentication=no -r $(VERSION) mad@lxplus.cern.ch:madx/releases
endif
#
# madx backup reports
#
.PHONY: madx-reports
madx-reports:
$E "*** Recording reports"
$_ scp -o PubkeyAuthentication=no \
tests/reports/`date "+%Y-%m-%d"`_build-test-*.out \
mad@lxplus.cern.ch:madx/releases/$(VERSION)/reports
#
# madx backup trunk
#
.PHONY: madx-mktag
madx-mktag:
$E "*** Tagging madx"
$_ svn copy https://svn.cern.ch/reps/madx/trunk/ \
https://svn.cern.ch/reps/madx/tags/$(VERSION) -m "madx release tag $(VERSION)"
#
# madx activation
#
.PHONY: madx-activate
madx-activate:
$E "*** Activating madx"
$_ pushd /afs/cern.ch/project/mad/madx/releases && \
ls -l . $(VERSION) && rm -i last-dev ; ln -s $(VERSION) last-dev && \
ls -l . last-dev && popd
#
# libptc installation (Linux only)
#
.PHONY: libptc-install
libptc-install:
$E "*** Installing libptc"
$_ scp -o PubkeyAuthentication=no \
libptc-* mad@lxplus.cern.ch:madx/releases/$(VERSION)
#
# numdiff installation (Linux only)
#
.PHONY: numdiff-install
numdiff-install:
$E "*** Installing numdiff"
$_ scp -o PubkeyAuthentication=no \
numdiff-* mad@lxplus.cern.ch:madx/releases/$(VERSION)
#
# count number of builds
#
# ifeq ($(MAKE_RESTARTS),)
# ifneq ($(filter $(BUILDGOALS),$(MAKECMDGOALS)),)
# ifneq ($(OSTYPE),Windows)
# MY_CFIL := $(HOME)/.madx-build-cnt
# MY_CTST := $(wildcard $(MY_CFIL))
# MY_CVAL := $(if $(MY_CTST),$(shell $(CAT) $(MY_CFIL)),0)
# MY_CVAL := $(if $(MY_CVAL),$(MY_CVAL),0)
# MY_CINC := $(shell expr $(MY_CVAL) + 1 > $(MY_CFIL))
# $(info *** Local build number #$(shell $(CAT) $(MY_CFIL)))
# else # Windows
# MY_CFIL := $(HOME)$/.madx-build-cnt
# MY_CTST := $(wildcard $(call s1bs,$(MY_CFIL)))
# MY_CVAL := $(if $(MY_CTST),$(shell $(CAT) "$(MY_CFIL)"),0)
# MY_CVAL := $(if $(MY_CVAL),$(MY_CVAL),0)
# MY_CINC := $(shell expr $(MY_CVAL) + 1 > "$(MY_CFIL)")
# $(info *** Local build number #$(shell $(CAT) "$(MY_CFIL)"))
# endif
# endif
# endif
# end of makefile