1 |
#--------------------------------------------------------------------------- |
2 |
# |
3 |
# Makefile for a Linux System: |
4 |
# use GNU FORTRAN compiler g77 |
5 |
# Makefile done for tracker dara |
6 |
# |
7 |
#--------------------------------------------------------------------------- |
8 |
# |
9 |
# FC Fortran compiler for standard rules |
10 |
# FFLAGS Fortran flags for standard rules |
11 |
# CC C Compiler for standard rules |
12 |
# CFLAGS C compiler flags for standard rules |
13 |
# |
14 |
# Compiler: g77 |
15 |
# Flags:-g (enable debug) |
16 |
# -Wall (turn on all warnings) |
17 |
# -fno-automatic (force compiler to use static variables) |
18 |
# -fvxt (use VAXish extensions) |
19 |
# |
20 |
|
21 |
# Fortran flags |
22 |
FC=g77 |
23 |
FFLAGS=-fvxt -fno-automatic -Wall -Wno-globals -fbounds-check# -O2 |
24 |
# puo' essere tolto con cautela: |
25 |
# impedisce di far vedere gli warning di HBNAME |
26 |
|
27 |
# C flags |
28 |
CC=gcc |
29 |
CFLAGS=-Wall -O2 |
30 |
CFLADJ=-c |
31 |
|
32 |
# used libraries |
33 |
#LIBS=-L/cern/pro/lib -lkernlib -lpacklib -lgraflib -lmathlib -lnsl |
34 |
LIBS= `cernlib kernlib packlib graflib mathlib` |
35 |
|
36 |
#--------------------------------------------------------------------------- |
37 |
|
38 |
LIBDIR=./lib |
39 |
SRCDIR=./source |
40 |
PARDIR=$(SRCDIR)/parameters |
41 |
BINDIR=./bin |
42 |
AUXDIR=$(BINDIR)/bin-aux |
43 |
|
44 |
BINDIR2003=./bin-2003 |
45 |
AUXDIR2003=$(BINDIR2003)/bin-aux |
46 |
|
47 |
usage: |
48 |
@echo =========================== |
49 |
@echo USAGE: |
50 |
@echo |
51 |
@echo For external users: |
52 |
@echo |
53 |
@echo "make all" |
54 |
@echo "make install" |
55 |
@echo |
56 |
@echo |
57 |
@echo Other labels for internal users: |
58 |
@echo |
59 |
@echo "level0.exe" |
60 |
@echo "level1.exe" |
61 |
@echo "level2.exe" |
62 |
@echo "level2-2003.exe" |
63 |
@echo "all (==> level0.exe level1.exe level2.exe lib)" |
64 |
@echo "level2-both (==> level2.exe level2-2003.exe)" |
65 |
@echo "level2-efficiency.exe" |
66 |
@echo "level2-calibration.exe" |
67 |
@echo |
68 |
@echo "install" |
69 |
@echo |
70 |
@echo "lib" |
71 |
@echo |
72 |
@echo "clean0" |
73 |
@echo "clean1" |
74 |
@echo "clean2" |
75 |
@echo "clean2003" |
76 |
@echo "cleanl" |
77 |
@echo "clean (==> clean0 clean1 clean2 cleanl)" |
78 |
@echo "cleant" |
79 |
@echo |
80 |
|
81 |
|
82 |
all: level0.exe level1.exe level2.exe lib |
83 |
|
84 |
|
85 |
FOBJ0= \ |
86 |
source/readraw/readraw_subroutines.o \ |
87 |
source/readraw/trkunpack.o |
88 |
|
89 |
COBJ0= \ |
90 |
source/readraw/findstart.o \ |
91 |
source/readraw/hunpacker.o \ |
92 |
source/readraw/skipbyte.o \ |
93 |
source/readraw/dunpacker.o \ |
94 |
source/readraw/readtrailer.o \ |
95 |
source/readraw/readped.o \ |
96 |
source/readraw/readsig.o \ |
97 |
source/readraw/readbad.o \ |
98 |
source/readraw/find_cpu_header.o \ |
99 |
source/readraw/trkalarmpkt.o \ |
100 |
source/readraw/runheaderpkt.o \ |
101 |
source/readraw/get_bytes.o \ |
102 |
source/readraw/crc.o |
103 |
|
104 |
COMMON0= \ |
105 |
source/common/commontracker.f \ |
106 |
source/common/common_readraw.f \ |
107 |
source/common/level0.f \ |
108 |
source/common/calib.f |
109 |
|
110 |
OBJTOF= \ |
111 |
source/tof/tofunpack.for \ |
112 |
source/tof/graytobin.for \ |
113 |
source/tof/tofcrc.cpp |
114 |
|
115 |
OBJTRI= \ |
116 |
source/trigger/triggerunpack.for \ |
117 |
source/trigger/trigcrc.cpp |
118 |
|
119 |
TOFCOM=source/tof/common_tof.f |
120 |
|
121 |
|
122 |
level0.exe: bindir source/readraw/readraw.f $(FOBJ0) $(COBJ0) $(OBJTOF) $(COMMON0) $(TOFCOM) |
123 |
@echo Creating $(BINDIR)/$@ ..... |
124 |
$(FC) $(FFLAGS) -o bin/level0.exe source/readraw/readraw.f $(FOBJ0) $(COBJ0) $(OBJTOF) $(OBJTRI) $(LIBS) |
125 |
@echo $@ DONE! |
126 |
@echo =========================================================================================== |
127 |
|
128 |
FOBJ1= \ |
129 |
source/reduction/fillpedsig.o \ |
130 |
source/reduction/filladc.o \ |
131 |
source/reduction/cncomp.o \ |
132 |
source/reduction/cnoise.o \ |
133 |
source/reduction/cutcn.o \ |
134 |
source/common/access_level0.o \ |
135 |
source/common/functions.o |
136 |
|
137 |
COMMON1= \ |
138 |
source/common/commontracker.f \ |
139 |
source/common/level0.f \ |
140 |
source/common/level1.f \ |
141 |
source/common/common_reduction.f \ |
142 |
source/common/calib.f |
143 |
|
144 |
|
145 |
level1.exe: bindir source/reduction/reduction.f $(FOBJ1) $(COMMON1) |
146 |
@echo Creating $(BINDIR)/$@ ..... |
147 |
$(FC) $(FFLAGS) -o bin/level1.exe source/reduction/reduction.f $(FOBJ1) $(LIBS) |
148 |
@echo $@ DONE! |
149 |
@echo =========================================================================================== |
150 |
|
151 |
FOBJ2=\ |
152 |
source/common/functions.f \ |
153 |
source/analysis/mini_2.f\ |
154 |
source/common/readalignparam.f \ |
155 |
source/common/functions_pfa.f \ |
156 |
source/reduction/fillpedsig.f\ |
157 |
source/analysis/tricircle.f \ |
158 |
source/analysis/BdL.f |
159 |
|
160 |
FOBJTRK=\ |
161 |
source/analysis/grkuta.f \ |
162 |
source/magnet/inter_B.f \ |
163 |
source/magnet/read_B.f |
164 |
|
165 |
|
166 |
COMMON2=\ |
167 |
source/common/commontracker.f \ |
168 |
source/common/calib.f \ |
169 |
source/common/level1.f \ |
170 |
source/common/common_mech.f \ |
171 |
source/common/common_level2debug.f \ |
172 |
source/common/common_momanhough.f \ |
173 |
source/common/momanhough_init.f \ |
174 |
source/common/common_xyzPAM.f \ |
175 |
source/common/common_align.f \ |
176 |
source/common/common_resxy.f \ |
177 |
source/common/level2.f \ |
178 |
source/common/common_mini_2.f |
179 |
|
180 |
COMMONTRK=\ |
181 |
source/common/common_B_inner.f \ |
182 |
|
183 |
|
184 |
|
185 |
level2-both: level2.exe level2-2003.exe |
186 |
|
187 |
level2.exe: auxdir source/analysis/momanhough.F $(FOBJ2) $(FOBJTRK) $(COMMON2) $(COMMONTRK) source/common/access_level1.f |
188 |
@echo Creating $(BINDIR)/$@ ..... |
189 |
cpp -x f77-cpp-input source/analysis/momanhough.F source/analysis/momanhough.f |
190 |
$(FC) $(FFLAGS) -o bin/level2.exe source/analysis/momanhough.f $(FOBJ2) $(FOBJTRK) source/common/access_level1.f $(LIBS) |
191 |
@rm -f source/analysis/momanhough.f |
192 |
@echo Moving auxiliary files in $(AUXDIR) ..... |
193 |
@cp source/parameters/align_param/*.dat $(AUXDIR)/. |
194 |
@cp source/parameters/eta_param/*.dat $(AUXDIR)/. |
195 |
@cp source/parameters/charge_param/*.dat $(AUXDIR)/. |
196 |
@cp source/parameters/field_meas/*.rz $(AUXDIR)/. |
197 |
@cp source/parameters/mip_param/*.dat $(AUXDIR)/. |
198 |
# @cp source/parameters/mech_pos.dat $(AUXDIR)/. |
199 |
@echo $@ DONE! |
200 |
@echo =========================================================================================== |
201 |
|
202 |
|
203 |
level2-2003.exe: auxdir2003 source/analysis/momanhough.F $(FOBJ2) $(FOBJTRK) $(COMMON2) $(COMMONTRK) source/common/access_level1_2003.f |
204 |
@echo Creating $(BINDIR2003)/$@ ..... |
205 |
cp -f source/common/level1.f source/common/level1.f-cpu |
206 |
cp -f source/common/level1-2003.f source/common/level1.f |
207 |
cpp -x f77-cpp-input -DTEST2003 source/analysis/momanhough.F source/analysis/momanhough.f |
208 |
$(FC) $(FFLAGS) -o $(BINDIR2003)/level2-2003.exe source/analysis/momanhough.f $(FOBJ2) $(FOBJTRK) source/common/access_level1_2003.f $(LIBS) |
209 |
@rm -f source/analysis/momanhough.f |
210 |
cp -f source/common/level1.f-cpu source/common/level1.f |
211 |
@echo Moving auxiliary files in $(AUXDIR2003) ..... |
212 |
@cp source/parameters/align_param-2003/*.dat $(AUXDIR2003)/. |
213 |
@cp source/parameters/eta_param-2003/*.dat $(AUXDIR2003)/. |
214 |
@cp source/parameters/charge_param-2003/*.dat $(AUXDIR2003)/. |
215 |
@cp source/parameters/field_meas/*.rz $(AUXDIR2003)/. |
216 |
@cp source/parameters/mip_param/*.dat $(AUXDIR)/. |
217 |
# @cp source/parameters/mech_pos.dat $(AUXDIR)/. |
218 |
# @cp source/common/level2.f utilities/template/trk_level2.inc |
219 |
@echo $@ DONE! |
220 |
# cp bin/level2-2003.exe $(TRK_BIN)/. |
221 |
@echo ================================================ |
222 |
|
223 |
level2-efficiency.exe: auxdir source/analysis/momanhough-efficiency.F $(FOBJ2) $(FOBJTRK) $(COMMON2) $(COMMONTRK) source/common/access_level1.f |
224 |
@echo Creating $(BINDIR)/$@ ..... |
225 |
cpp -x f77-cpp-input source/analysis/momanhough-efficiency.F source/analysis/momanhough-efficiency.f |
226 |
$(FC) $(FFLAGS) -o bin/level2-efficiency.exe source/analysis/momanhough-efficiency.f $(FOBJ2) $(FOBJTRK) source/common/access_level1.f $(LIBS) |
227 |
@rm -f source/analysis/momanhough-efficiency.f |
228 |
@echo Moving auxiliary files in $(AUXDIR) ..... |
229 |
@cp source/parameters/align_param/*.dat $(AUXDIR)/. |
230 |
@cp source/parameters/eta_param/*.dat $(AUXDIR)/. |
231 |
@cp source/parameters/charge_param/*.dat $(AUXDIR)/. |
232 |
@cp source/parameters/field_meas/*.rz $(AUXDIR)/. |
233 |
@cp source/parameters/mip_param/*.dat $(AUXDIR)/. |
234 |
# @cp source/parameters/mech_pos.dat $(AUXDIR)/. |
235 |
@echo $@ DONE! |
236 |
@echo =========================================================================================== |
237 |
|
238 |
level2-calibration.exe: auxdir source/analysis/momanhough-calibration.F $(FOBJ2) $(FOBJTRK) $(COMMON2) $(COMMONTRK) source/common/access_level1.f source/common/common_calibration.f |
239 |
@echo Creating $(BINDIR)/$@ ..... |
240 |
cpp -x f77-cpp-input source/analysis/momanhough-calibration.F source/analysis/momanhough-calibration.f |
241 |
$(FC) $(FFLAGS) -o bin/level2-calibration.exe source/analysis/momanhough-calibration.f $(FOBJ2) $(FOBJTRK) source/common/access_level1.f $(LIBS) |
242 |
@rm -f source/analysis/momanhough-calibration.f |
243 |
@echo Moving auxiliary files in $(AUXDIR) ..... |
244 |
@cp source/parameters/align_param/*.dat $(AUXDIR)/. |
245 |
@cp source/parameters/eta_param/*.dat $(AUXDIR)/. |
246 |
@cp source/parameters/charge_param/*.dat $(AUXDIR)/. |
247 |
@cp source/parameters/field_meas/*.rz $(AUXDIR)/. |
248 |
# @cp source/parameters/mech_pos.dat $(AUXDIR)/. |
249 |
@cp source/parameters/mip_param/*.dat $(AUXDIR)/. |
250 |
@cp source/parameters/data-card.dat $(AUXDIR)/. |
251 |
@echo $@ DONE! |
252 |
@echo =========================================================================================== |
253 |
|
254 |
|
255 |
|
256 |
TESTDIR=./run-test |
257 |
UTILDIR=./utilities |
258 |
|
259 |
install: |
260 |
@test -d "$(TRK_BIN)" && (echo "Now moving executable and auxiliary files to the working directory$(TRK_BIN)" ; \ |
261 |
cp $(BINDIR)/*.exe $(TRK_BIN)/.; \ |
262 |
cp -r $(AUXDIR) $(TRK_BIN)/. ) || (echo "*** NB Tracker working directory not defined !!") |
263 |
@echo "Installing test directory and utilities..." |
264 |
@cp $(BINDIR)/*.exe $(TESTDIR)/. |
265 |
@cp -r $(AUXDIR) $(TESTDIR)/. |
266 |
# @echo "Tar archive with tracker utilities:" |
267 |
# @tar -xvzf track.tar.gz -C $(UTILDIR)/trk-viewer/ |
268 |
|
269 |
|
270 |
|
271 |
|
272 |
lib: libdir source/subroutines/track.f $(FOBJTRK) $(COMMONTRK) |
273 |
@echo Creating ./$@ ..... |
274 |
g77 $(FFLAGS) -static -c source/subroutines/track.f -o source/subroutines/track.o |
275 |
g77 $(FFLAGS) -static -c source/analysis/grkuta.f -o source/subroutines/grkuta.o |
276 |
g77 $(FFLAGS) -static -c source/magnet/inter_B.f -o source/subroutines/inter_B.o |
277 |
g77 $(FFLAGS) -static -c source/magnet/read_B.f -o source/subroutines/read_B.o |
278 |
gcc -Wall,-soname,libtrk.so -shared -o lib/libtrk.so source/subroutines/*.o #$(LIBS) |
279 |
ar rcs lib/libtrk.a source/subroutines/*.o |
280 |
ranlib lib/libtrk.a |
281 |
@cp -r $(AUXDIR) utilities/template/. |
282 |
@echo Creating tar file with track utilities... |
283 |
@test -d track/ || mkdir track |
284 |
@cp source/subroutines/track.f source/analysis/grkuta.f source/magnet/*.f $(AUXDIR)/*.rz track/ |
285 |
ls track/ |
286 |
tar -cvzf track.tar.gz track/* |
287 |
@rm -fr track |
288 |
@echo $@ DONE! |
289 |
#--------------------------------------------------------------------------- |
290 |
|
291 |
|
292 |
bindir: |
293 |
@test -d "${BINDIR}" || (echo "Creating ${BINDIR}"; mkdir ${BINDIR}) |
294 |
auxdir: bindir |
295 |
@test -d "${AUXDIR}" || (echo "Creating ${AUXDIR}"; mkdir ${AUXDIR}) |
296 |
bindir2003: |
297 |
@test -d "${BINDIR2003}" || (echo "Creating ${BINDIR2003}"; mkdir ${BINDIR2003}) |
298 |
auxdir2003: bindir2003 |
299 |
@test -d "${AUXDIR2003}" || (echo "Creating ${AUXDIR2003}"; mkdir ${AUXDIR2003}) |
300 |
libdir: |
301 |
@test -d "${LIBDIR}" || (echo "Creating ${LIBDIR}"; mkdir ${LIBDIR}) |
302 |
|
303 |
|
304 |
|
305 |
|
306 |
.PHONY : clean |
307 |
clean: clean0 clean1 clean2 cleanl |
308 |
rm -fr $(BINDIR) |
309 |
|
310 |
cleant: |
311 |
rm -f run-test/*~ |
312 |
rm -f run-test/raw-data |
313 |
rm -f run-test/*.exe |
314 |
rm -fr run-test/bin-aux |
315 |
rm -f *~ |
316 |
|
317 |
clean0: |
318 |
rm -f source/readraw/*.o |
319 |
rm -f source/tof/*.o |
320 |
rm -f source/trigger/*.o |
321 |
rm -f source/tof/*~ |
322 |
rm -f source/trigger/*~ |
323 |
rm -f source/readraw/*~ |
324 |
rm -f source/common/*~ |
325 |
rm -f $(BINDIR)/level0.exe |
326 |
rm -f run-test/level0.exe |
327 |
clean1: |
328 |
rm -f source/reduction/*.o |
329 |
rm -f source/reduction/*~ |
330 |
rm -f source/common/*~ |
331 |
rm -f $(BINDIR)/level1.exe |
332 |
rm -f run-test/level1.exe |
333 |
clean2: |
334 |
rm -f source/analysis/*.o |
335 |
rm -f source/magnet/*.o |
336 |
rm -f source/analysis/*~ |
337 |
rm -f source/magnet/*~ |
338 |
rm -f source/common/*~ |
339 |
rm -f $(BINDIR)/level2*.exe |
340 |
rm -f run-test/level2.exe |
341 |
|
342 |
clean2003: |
343 |
rm -f source/analysis/*.o |
344 |
rm -f source/magnet/*.o |
345 |
rm -f source/analysis/*~ |
346 |
rm -f source/magnet/*~ |
347 |
rm -f source/common/*~ |
348 |
rm -f $(BINDIR2003)/level2*.exe |
349 |
rm -fr $(BINDIR2003)/bin-aux |
350 |
rm -f run-test/level2.exe |
351 |
|
352 |
cleanl: |
353 |
rm -f source/subroutines/*~ |
354 |
rm -f source/subroutines/*.o |
355 |
rm -fr ./lib |
356 |
# rm -f lib/*.so |
357 |
# rm -f lib/*.a |