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 |
GPCALSRCS = gpcal/gpcalv.F gpcal/gpce.F gpcal/gpdcal.F \ |
27 |
gpcal/gpg10c.F gpcal/gpg10.F gpcal/gpsica.F \ |
28 |
gpcal/gpucal.F gpcal/gpw2.F gpcal/gpw.F |
29 |
GPCASSRCS = gpcas/gpcasv.F gpcas/gpdcas.F gpcas/gpucas.F |
30 |
GPCATSRCS = gpcat/gpcatv.F gpcat/gpdcat.F gpcat/gpucat.F |
31 |
GPFIELDSRCS = gpfield/flin3.F gpfield/gufld.F |
32 |
GPGARSRCS = gpgar/gpgacl.F gpgar/gpgapart.F gpgar/gpgarin.F \ |
33 |
gpgar/gpgarsel.F gpgar/gptogar.F gpgar/grinit.F |
34 |
GPHYSSRCSRCS = gphys/gfluct.F |
35 |
GPMAINSRCS = gpmain/gpmain.F |
36 |
GPSPESRCS = gpspe/gpcp.F gpspe/gpdspe.F gpspe/gpfe.F \ |
37 |
gpspe/gpkap.F gpspe/gpmaspe.F gpspe/gproa.F \ |
38 |
gpspe/gpsitr.F gpspe/gpspema.F gpspe/gpspev.F gpspe/gpuspe.F |
39 |
GPTOFSRCS = gptof/gpdtof.F gptof/gpscin.F gptof/gpscint.F \ |
40 |
gptof/gptofv.F gptof/gputof.F |
41 |
GPTRDSRCS = gptrd/gpdtrd.F gptrd/gptrad.F gptrd/gptrdv.F \ |
42 |
gptrd/gputrd.F gptrd/gpxe.F gptrd/gpxtr.F \ |
43 |
gptrd/npoiss.F gptrd/xescape.F gptrd/xtrinteg.F \ |
44 |
gptrd/xtrinter.F gptrd/xtryield.F |
45 |
GPXINTSRCS = gpxint/gxint.F gpxint/qnext.F |
46 |
# |
47 |
GPSRCS = $(GPAMELASRCS) $(GPCALSRCS) $(GPCASSRCS) $(GPCATSRCS) $(GPFIELDSRCS) $(GPGARSRCS) $(GPHYSSRCS) \ |
48 |
$(GPSPESRCS) $(GPTOFSRCS) $(GPTRDSRCS) |
49 |
GPOBJS =$(addsuffix .o,$(basename ${GPSRCS}) ) |
50 |
GPDEPENDS =$(GPOBJS:.o=.d) |
51 |
GPMAINOBJS =$(addsuffix .o,$(basename ${GPMAINSRCS}) ) |
52 |
GPMAINDEPENDS =$(GPMAINOBJS:.o=.d) |
53 |
GPXINTOBJS =$(addsuffix .o,$(basename ${GPXINTSRCS}) ) |
54 |
GPXINTDEPENDS =$(GPXINTOBJS:.o=.d) |
55 |
# |
56 |
GEANTINC = gcdes |
57 |
GPINC = gpcdes |
58 |
CERNLIB = `cernlib geant,genlib,pawlib,graflib/X11,packlib,mathlib` |
59 |
GPLIBDIR = ./lib |
60 |
GPLIB = ${GPLIBDIR}/libgarfield-7.a |
61 |
# |
62 |
BIN = ./bin |
63 |
AUX = ./aux |
64 |
AUXFILES = ${AUX}/gpfield.rz ${AUX}/GPAMELA.FFR ${AUX}/TRD_ATT.DAT ${AUX}/GARFIELD.GAR \ |
65 |
$(AUX)/xe_80_co2_20.gas |
66 |
GARFIELDSRC = ./garfield/src |
67 |
# |
68 |
INTERFLAGS = -DGPAMELA_UNIX -DGPAMELA_TYPE -DGPAMELA_X11 -DGPAMELA_INTER -DGPAMELA_HIGZ \ |
69 |
-DGPAMELA_GARFIELD -DGPAMELA_MANYWIRE -DGPAMELA_LONGLIST -DGPAMELA_BIGMAP |
70 |
BATCHFLAGS = -DGPAMELA_UNIX -DGPAMELA_TYPE -DGPAMELA_GARFIELD -DGPAMELA_MANYWIRE -DGPAMELA_LONGLIST -DGPAMELA_BIGMAP |
71 |
# |
72 |
CC = gcc |
73 |
FC = g77 |
74 |
DEBFLAGS = -g -fdebug-kludge |
75 |
FFLAGS = -fvxt -fno-automatic -Wno-globals -I${GPINC} -I${GEANTINC} ${BATCHFLAGS} |
76 |
LDFLAGS= ${GPLIB} ${CERNLIB} |
77 |
|
78 |
|
79 |
gpamelax11.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals -I${GPINC} -I${GEANTINC} ${INTERFLAGS} |
80 |
gpamelax11.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPXINTSRCS} ${GPXINTOBJS} ${GPXINTDEPENDS} |
81 |
@echo Creating $@ ..... |
82 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPXINTOBJS} ${LDFLAGS} |
83 |
@echo Removing object files ..... |
84 |
@rm -f ${GPOBJS} ${GPXINTOBJS} |
85 |
|
86 |
gpamela.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals -I${GPINC} -I${GEANTINC} ${BATCHFLAGS} |
87 |
gpamela.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPMAINSRCS} ${GPMAINOBJS} ${GPMAINDEPENDS} |
88 |
@echo Creating $@ ..... |
89 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPMAINOBJS} ${LDFLAGS} |
90 |
@echo Removing object files ..... |
91 |
@rm -f ${GPOBJS} ${GPMAINOBJS} |
92 |
|
93 |
gpamelax11_deb.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals ${DEBFLAGS} -I${GPINC} -I${GEANTINC} ${INTERFLAGS} |
94 |
gpamelax11_deb.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPXINTSRCS} ${GPXINTOBJS} ${GPXINTDEPENDS} |
95 |
@echo Creating $@ ..... |
96 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPXINTOBJS} ${LDFLAGS} |
97 |
@echo Removing object files ..... |
98 |
@rm -f ${GPOBJS) ${GPXINTOBJS} |
99 |
|
100 |
gpamela_deb.exe: FFLAGS = -fvxt -fno-automatic -Wno-globals ${DEBFLAGS} -I${GPINC} -I${GEANTINC} ${BATCHFLAGS} |
101 |
gpamela_deb.exe: createdir ${GPLIBDIR}/libgarfield-7.a ${GPSRCS} ${GPOBJS} ${GPDEPENDS} ${GPMAINSRCS} ${GPMAINOBJS} ${GPMAINDEPENDS} |
102 |
@echo Creating $@ ..... |
103 |
$(FC) -o ${BIN}/$@ ${GPOBJS} ${GPMAINOBJS} ${LDFLAGS} |
104 |
@echo Removing object files ..... |
105 |
@rm -f ${GPOBJS) ${GPMAINOBJS} |
106 |
|
107 |
depend: ${GPXINTDEPENDS} ${GPMAINDEPENDS} ${GPDEPENDS} |
108 |
|
109 |
%.d: %.F |
110 |
@echo Creating $@ from $< ; |
111 |
@$(SHELL) -ec '$(FC) -M $(FFLAGS) $< \ |
112 |
| sed '\''s/\($(*F)\)\.o[ :]*/ $(*D)\/\1.o $(*D)\/$(*F)\.d : /g'\'' > $@; \ |
113 |
[ -s $@ ] || rm -f $@' |
114 |
|
115 |
.PHONY: distclean clean createdir install |
116 |
# Move binaries from the local repository to the official repositories |
117 |
install : |
118 |
@test -d "$(GPAMELA_BIN)" && \ |
119 |
(echo "Now moving executable and auxiliary files to $(GPAMELA_BIN)"; \ |
120 |
mv -f $(BIN)/*.exe $(GPAMELA_BIN)/. ; cp -f ${AUXFILES} $(GPAMELA_BIN)/. ) |
121 |
|
122 |
${GPLIBDIR}/libgarfield-7.a: |
123 |
@echo Creating libgarfield-7.a it will take few minutes ..... |
124 |
@cd ${GARFIELDSRC}; make -f makefile_linux libgarfield-7.a |
125 |
@test -d "${GPLIBDIR}" || (echo "Creating ${GPLIBDIR}"; mkdir ${GPLIBDIR}) |
126 |
@echo Copyng $(@F) to ${GPLIBDIR} |
127 |
@cp ${GARFIELDSRC}/$(@F) ${GPLIBDIR} |
128 |
|
129 |
# Create binary local repository if non existent |
130 |
createdir : |
131 |
@test -d "${BIN}" || (echo "Creating ${BIN}"; mkdir ${BIN}) |
132 |
|
133 |
distclean: clean |
134 |
@echo Removing garfield sources, objects and libraries |
135 |
@cd ${GARFIELDSRC}; rm -f *.f *.o libgarfield-7.a |
136 |
@rm -f ${GPLIBDIR}/libgarfield-7.a |
137 |
@rm -fr ${GPLIBDIR} |
138 |
@echo Removing executables ..... |
139 |
@rm -fr ${BIN} |
140 |
|
141 |
|
142 |
|
143 |
clean: |
144 |
@echo Removing object files ..... |
145 |
@rm -f ${GPOBJS} ${GPMAINOBJS} ${GPXINTOBJS} |
146 |
@echo Removing dependencies files ..... |
147 |
@rm -f ${GPDEPENDS} ${GPMAINDEPENDS} ${GPXINTDEPENDS} |
148 |
|
149 |
include ${GPDEPENDS} |
150 |
|
151 |
|