1 |
# |
2 |
# Steering Makefile to create gpamelaX11 and gpamela executable |
3 |
# First of all define the src files. One for each subdirectory |
4 |
# |
5 |
GPAMELASRCS= gpamela/ffuser.F gpamela/gdraws.F gpamela/gpadigi.F \ |
6 |
gpamela/gpal.F gpamela/gpdat.F \ |
7 |
gpamela/gpffr.F gpamela/gpfil.F gpamela/gpgaus.F \ |
8 |
gpamela/gpgeo.F gpamela/gphbk.F \ |
9 |
gpamela/gphit.F gpamela/gplook.F \ |
10 |
gpamela/gpmapa.F gpamela/gpmat.F gpamela/gpmed.F \ |
11 |
gpamela/gpn2g.F gpamela/gpnhit.F gpamela/gppama.F \ |
12 |
gpamela/gprhit.F gpamela/gprsht.F \ |
13 |
gpamela/gpsed.F gpamela/gpsptm.F \ |
14 |
gpamela/gpudat.F gpamela/gpudig.F gpamela/gpuffr.F \ |
15 |
gpamela/gpufil.F gpamela/gpugeo.F gpamela/gpuhbk.F \ |
16 |
gpamela/gpuhit.F gpamela/gpuini.F \ |
17 |
gpamela/gpukin.F gpamela/gpulas.F \ |
18 |
gpamela/gpumat.F gpamela/gpumed.F gpamela/gpuout.F \ |
19 |
gpamela/gpused.F gpamela/gpustep.F gpamela/gputra.F \ |
20 |
gpamela/gputre.F gpamela/gudigi.F \ |
21 |
gpamela/guhadr.F gpamela/gukine.F gpamela/guout.F \ |
22 |
gpamela/guphad.F gpamela/gustep.F \ |
23 |
gpamela/gutrak.F gpamela/gutrev.F \ |
24 |
gpamela/gviewyz.F gpamela/n2g.F \ |
25 |
gpamela/uginit.F gpamela/uglast.F \ |
26 |
gpamela/gprnhran.F |
27 |
GPCALSRCS = gpcal/gpcalv.F gpcal/gpce.F gpcal/gpdcal.F \ |
28 |
gpcal/gpg10c.F gpcal/gpg10.F gpcal/gpsica.F \ |
29 |
gpcal/gpucal.F gpcal/gpw2.F gpcal/gpw.F |
30 |
GPCASSRCS = gpcas/gpcasv.F gpcas/gpdcas.F gpcas/gpucas.F |
31 |
GPCATSRCS = gpcat/gpcatv.F gpcat/gpdcat.F gpcat/gpucat.F |
32 |
GPFIELDSRCS = gpfield/flin3.F gpfield/gufld.F gpfield/gprbi.F \ |
33 |
gpfield/inter_B.F gpfield/inter_B_inner.F |
34 |
GPGARSRCS = gpgar/gpgacl.F gpgar/gpgapart.F gpgar/gpgarin.F \ |
35 |
gpgar/gpgarsel.F gpgar/gptogar.F gpgar/grinit.F |
36 |
GPHYSSRCSRCS = gphys/gfluct.F |
37 |
GPMAINSRCS = gpmain/gpmain.F |
38 |
GPSPESRCS = gpspe/gpcp.F gpspe/gpdspe.F gpspe/gpfe.F \ |
39 |
gpspe/gpkap.F gpspe/gpmaspe.F gpspe/gproa.F \ |
40 |
gpspe/gpsitr.F gpspe/gpspema.F gpspe/gpspev.F gpspe/gpuspe.F \ |
41 |
gpspe/gprspe.F |
42 |
GPTOFSRCS = gptof/gpdtof.F gptof/gpscin.F gptof/gpscint.F \ |
43 |
gptof/gptofv.F gptof/gputof.F |
44 |
GPTRDSRCS = gptrd/gpdtrd.F gptrd/gptrad.F gptrd/gptrdv.F \ |
45 |
gptrd/gputrd.F gptrd/gpxe.F gptrd/gpxtr.F \ |
46 |
gptrd/npoiss.F gptrd/xescape.F gptrd/xtrinteg.F \ |
47 |
gptrd/xtrinter.F gptrd/xtryield.F |
48 |
GPXINTSRCS = gpxint/gxint.F gpxint/qnext.F |
49 |
GPNDSRCS = gpnd/gpndv.F |
50 |
GPCALORSRC = gpcalor/gpcalor.F |
51 |
# |
52 |
GPSRCS = $(GPAMELASRCS) $(GPCALSRCS) $(GPCASSRCS) $(GPCATSRCS) $(GPFIELDSRCS) $(GPGARSRCS) $(GPHYSSRCS) \ |
53 |
$(GPSPESRCS) $(GPTOFSRCS) $(GPTRDSRCS) $(GPNDSRCS) $(GPCALORSRC) |
54 |
GPOBJS =$(addsuffix .o,$(basename ${GPSRCS}) ) |
55 |
GPDEPENDS =$(GPOBJS:.o=.d) |
56 |
GPMAINOBJS =$(addsuffix .o,$(basename ${GPMAINSRCS}) ) |
57 |
GPMAINDEPENDS =$(GPMAINOBJS:.o=.d) |
58 |
GPXINTOBJS =$(addsuffix .o,$(basename ${GPXINTSRCS}) ) |
59 |
GPXINTDEPENDS =$(GPXINTOBJS:.o=.d) |
60 |
# |
61 |
GEANTINC = gcdes |
62 |
GPINC = gpcdes |
63 |
GPCALORINC = gpcalordes |
64 |
CERNLIB = `cernlib geant,genlib,pawlib,graflib/X11,packlib,mathlib` |
65 |
GPLIBDIR = ./lib |
66 |
GPLIB = ${GPLIBDIR}/libgarfield-7.a |
67 |
# |
68 |
BIN = ./bin |
69 |
AUX = ./aux |
70 |
AUXFILES = ${AUX}/gpfield.rz ${AUX}/GPAMELA.FFR ${AUX}/TRD_ATT.DAT ${AUX}/GARFIELD.GAR \ |
71 |
${AUX}/xe_80_co2_20.gas ${AUX}/measure_n3_290302.rz ${AUX}/measure_n4_110402_corrected.rz \ |
72 |
${AUX}/resxy_new.rz ${AUX}/INPUTSEED.DAT ${AUX}/readseeds.f ${AUX}/writeseeds.f \ |
73 |
${AUX}/chetc.dat.gz ${AUX}/xsneut.dat.gz |
74 |
GARFIELDSRC = ./garfield/src |
75 |
# |
76 |
INTERFLAGS = -DGPAMELA_UNIX -DGPAMELA_TYPE -DGPAMELA_X11 -DGPAMELA_INTER -DGPAMELA_HIGZ \ |
77 |
-DGPAMELA_GARFIELD -DGPAMELA_MANYWIRE -DGPAMELA_LONGLIST -DGPAMELA_BIGMAP |
78 |
BATCHFLAGS = -DGPAMELA_UNIX -DGPAMELA_TYPE -DGPAMELA_GARFIELD -DGPAMELA_MANYWIRE -DGPAMELA_LONGLIST -DGPAMELA_BIGMAP |
79 |
# |
80 |
CC = gcc |
81 |
FC = g77 |
82 |
DEBFLAGS = -g -fdebug-kludge |
83 |
FFLAGS = -fvxt -fno-automatic -Wno-globals -I${GPINC} -I$(GPCALORINC) -I${GEANTINC} ${BATCHFLAGS} |
84 |
LDFLAGS= ${GPLIB} ${CERNLIB} -Xlinker -Map -Xlinker $@.map |
85 |
|
86 |
|
87 |
gpamelax11.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals -I${GPINC} -I${GPCALORINC} -I${GEANTINC} ${INTERFLAGS} |
88 |
gpamelax11.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPXINTSRCS} ${GPXINTOBJS} ${GPXINTDEPENDS} |
89 |
@echo Creating $@ ..... |
90 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPXINTOBJS} ${LDFLAGS} |
91 |
@echo Removing object files ..... |
92 |
@rm -f ${GPOBJS} ${GPXINTOBJS} |
93 |
|
94 |
gpamela.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals -I${GPINC} -I${GPCALORINC} -I${GEANTINC} ${BATCHFLAGS} |
95 |
gpamela.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPMAINSRCS} ${GPMAINOBJS} ${GPMAINDEPENDS} |
96 |
@echo Creating $@ ..... |
97 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPMAINOBJS} ${LDFLAGS} |
98 |
@echo Removing object files ..... |
99 |
@rm -f ${GPOBJS} ${GPMAINOBJS} |
100 |
|
101 |
gpamelax11_deb.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals ${DEBFLAGS} -I${GPINC} -I${GPCALORINC} -I${GEANTINC} ${INTERFLAGS} |
102 |
gpamelax11_deb.exe: LDFLAGS= ${GPLIB} ${CERNLIB} ${DEBFLAGS} |
103 |
gpamelax11_deb.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPXINTSRCS} ${GPXINTOBJS} ${GPXINTDEPENDS} |
104 |
@echo Creating $@ ..... |
105 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPXINTOBJS} ${LDFLAGS} |
106 |
@echo Removing object files ..... |
107 |
@rm -f ${GPOBJS) ${GPXINTOBJS} |
108 |
|
109 |
gpamela_deb.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals ${DEBFLAGS} -I${GPINC} -I${GPCALORINC} -I${GEANTINC} ${BATCHFLAGS} |
110 |
gpamelax_deb.exe: LDFLAGS= ${GPLIB} ${CERNLIB} ${DEBFLAGS} |
111 |
gpamela_deb.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPMAINSRCS} ${GPMAINOBJS} ${GPMAINDEPENDS} |
112 |
@echo Creating $@ ..... |
113 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPMAINOBJS} ${LDFLAGS} |
114 |
@echo Removing object files ..... |
115 |
@rm -f ${GPOBJS) ${GPMAINOBJS} |
116 |
|
117 |
depend: ${GPXINTDEPENDS} ${GPMAINDEPENDS} ${GPDEPENDS} |
118 |
|
119 |
%.d: %.F |
120 |
@echo Creating $@ from $< ; |
121 |
@$(SHELL) -ec '$(FC) -M $(FFLAGS) $< \ |
122 |
| sed '\''s/\($(*F)\)\.o[ :]*/ $(*D)\/\1.o $(*D)\/$(*F)\.d : /g'\'' > $@; \ |
123 |
[ -s $@ ] || rm -f $@' |
124 |
|
125 |
.PHONY: distclean clean createdir install |
126 |
# Move binaries from the local repository to the official repositories |
127 |
install : |
128 |
@test -d "$(GPAMELA_BIN)" && \ |
129 |
(echo "Now moving executable and auxiliary files to $(GPAMELA_BIN)"; \ |
130 |
mv -f $(BIN)/*.exe $(GPAMELA_BIN)/. ; cp ${AUXFILES} $(GPAMELA_BIN)/.; \ |
131 |
echo "Now unzipping the GCALOR cross section data files"; gzip -dv xsneut.dat.gz chetc.dat.gz) |
132 |
|
133 |
${GPLIBDIR}/libgarfield-7.a: |
134 |
@echo Creating libgarfield-7.a it will take few minutes ..... |
135 |
@cd ${GARFIELDSRC}; make -f makefile_linux libgarfield-7.a |
136 |
@test -d "${GPLIBDIR}" || (echo "Creating ${GPLIBDIR}"; mkdir ${GPLIBDIR}) |
137 |
@echo Copyng $(@F) to ${GPLIBDIR} |
138 |
@cp ${GARFIELDSRC}/$(@F) ${GPLIBDIR} |
139 |
|
140 |
# Create binary local repository if non existent |
141 |
createdir : |
142 |
@test -d "${BIN}" || (echo "Creating ${BIN}"; mkdir ${BIN}) |
143 |
|
144 |
distclean: clean |
145 |
@echo Removing garfield sources, objects and libraries |
146 |
@cd ${GARFIELDSRC}; rm -f *.f *.o libgarfield-7.a |
147 |
@rm -f ${GPLIBDIR}/libgarfield-7.a |
148 |
@rm -fr ${GPLIBDIR} |
149 |
@echo Removing executables ..... |
150 |
@rm -fr ${BIN} |
151 |
|
152 |
|
153 |
|
154 |
clean: |
155 |
@echo Removing object files ..... |
156 |
@rm -f ${GPOBJS} ${GPMAINOBJS} ${GPXINTOBJS} |
157 |
@echo Removing dependencies files ..... |
158 |
@rm -f ${GPDEPENDS} ${GPMAINDEPENDS} ${GPXINTDEPENDS} |
159 |
|
160 |
include ${GPDEPENDS} |
161 |
|
162 |
|