examples/Makefile
1 include make.inc
2 
3 ifneq ($(PHOTOSLOCATION), )
4 include $(PHOTOSLOCATION)/make.inc
5 endif
6 
7 ROOTLIB := $(shell root-config --glibs)
8 ROOTINC := $(shell root-config --cflags)
9 ROOTLIBPATH := $(shell root-config --libdir)
10 TAUOLA_LIBS = -L$(TAUOLALOCATION)/lib -lTauolaCxxInterface -lTauolaFortran -lTauolaHepMC
11 MC_TESTER_LIBS = -L$(MCTESTERLOCATION)/lib -lHEPEvent -lHepMCEvent -lMCTester
12 
13 # Keep in mind Makefile and examples are not prepared to automatically adapt
14 # to different pythia versions: 8.170 (or lower), 8.180-8.185, 8.2
15 # At present they are adapted to v8.2
16 #PYTHIA_LIBS = -L$(PYTHIALOCATION)/lib/archive -lpythia8 -llhapdfdummy -lhepmcinterface
17 #PYTHIA_LIBS = -L$(PYTHIALOCATION)/lib/archive -lpythia8 -llhapdfdummy -lpythia8tohepmc
18 PYTHIA_LIBS = -L$(PYTHIALOCATION)/lib -lpythia8 -ldl
19 
20 PHOTOS_LIBS_FOR_HEPMC = -L$(PHOTOSLOCATION)/lib -lPhotospp -lPhotosppHepMC $(HEPMC_LIBS)
21 PHOTOS_LIBS_FOR_HEPMC3 = -L$(PHOTOSLOCATION)/lib -lPhotospp -lPhotosppHepMC3 $(HEPMC3_LIBS)
22 PHOTOS_LIBS_FOR_HEPEVT = -L$(PHOTOSLOCATION)/lib -lPhotospp -lPhotosppHEPEVT -lstdc++
23 HEPMC_LIBS =
24 HEPMC3_LIBS =
25 
26 ifneq ($(HEPMCLOCATION), )
27  override HEPMC_LIBS += -L$(HEPMCLOCATION)/lib -lHepMC
28 endif
29 
30 ifneq ($(HEPMC3LOCATION), )
31  override HEPMC3_LIBS += -L$(HEPMC3LOCATION)/lib -lHepMC3
32 endif
33 
34 all:
35  @make photos_hepevt_example.exe
36 ifneq ($(HEPMC3LOCATION), )
37  @make photos_hepmc3_standalone_example.exe
38 endif
39 ifneq ($(HEPMCLOCATION), )
40  @make photos_standalone_example.exe
41 ifneq ($(PYTHIALOCATION), )
42  @make single_photos_gun_example.exe
43  @make photosLCG_pythia_example.exe
44 ifneq ($(MCTESTERLOCATION), )
45  @make photos_pythia_example.exe
46 ifneq ($(TAUOLALOCATION), )
47  @make tauola_photos_pythia_example.exe
48 endif
49 endif
50 endif
51 endif
52  @echo "##################################################################"
53  @echo " Examples compiled successfully. Available examples:"
54  @if test -e photos_hepevt_example.exe; then \
55  echo " ./photos_hepevt_example.exe"; fi
56  @if test -e photos_standalone_example.exe; then \
57  echo " ./photos_standalone_example.exe"; fi
58  @if test -e photos_hepmc3_standalone_example.exe; then \
59  echo " ./photos_hepmc3_standalone_example.exe"; fi
60  @if test -e single_photos_gun_example.exe; then \
61  echo " ./single_photos_gun_example.exe"; fi
62  @if test -e photosLCG_pythia_example.exe; then \
63  echo " ./photosLCG_pythia_example.exe"; fi
64  @if test -e photos_pythia_example.exe; then \
65  echo " ./photos_pythia_example.exe"; fi
66  @if test -e tauola_photos_pythia_example.exe; then \
67  echo " ./tauola_photos_pythia_example.exe"; fi
68  @echo "##################################################################"
69 
70 # Universal example (all paths presents)
71 %.o: %.cxx
72  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -I$(TAUOLALOCATION)/include -I$(PYTHIALOCATION)/include \
73  -I$(MCTESTERLOCATION)/include -I$(HEPMCLOCATION)/include $(ROOTINC) -c $<
74 
75 # Universal example (all paths presents) - linking procedure
76 %.exe: %.o
77  $(CC) -o $@ $(LDFLAGS) $< $(ROOTLIB) \
78  $(TAUOLA_LIBS) $(PYTHIA_LIBS) $(MC_TESTER_LIBS) $(HEPMC_LIBS) $(PHOTOS_LIBS_FOR_HEPMC) \
79  -Wl,-rpath,$(PREFIX)/lib \
80  -Wl,-rpath,$(PHOTOSLOCATION)/lib \
81  -Wl,-rpath,$(ROOTLIBPATH) \
82  -Wl,-rpath,$(TAUOLALOCATION)/lib \
83  -Wl,-rpath,$(HEPMCLOCATION)/lib \
84  -Wl,-rpath,$(PYTHIALOCATION)/lib \
85  -Wl,-rpath,$(MCTESTERLOCATION)/lib
86 
87 # Version for pythia example - HepMC, Pythia8 and MC-Tester required
88 photos_pythia_example.exe: photos_pythia_example.cxx
89  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -I$(PYTHIALOCATION)/include \
90  -I$(MCTESTERLOCATION)/include -I$(HEPMCLOCATION)/include $(ROOTINC) -c $<
91  $(CC) -o $@ $(LDFLAGS) $(<:.cxx=.o) $(ROOTLIB) \
92  $(PYTHIA_LIBS) $(MC_TESTER_LIBS) $(HEPMC_LIBS) $(PHOTOS_LIBS_FOR_HEPMC) \
93  -Wl,-rpath,$(PREFIX)/lib \
94  -Wl,-rpath,$(PHOTOSLOCATION)/lib \
95  -Wl,-rpath,$(ROOTLIBPATH) \
96  -Wl,-rpath,$(HEPMCLOCATION)/lib \
97  -Wl,-rpath,$(PYTHIALOCATION)/lib \
98  -Wl,-rpath,$(MCTESTERLOCATION)/lib
99 
100 # Version for photos gun example - HepMC and Pythia8 required
101 single_photos_gun_example.exe: single_photos_gun_example.cxx
102  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -I$(PYTHIALOCATION)/include \
103  -I$(HEPMCLOCATION)/include -c $<
104  $(CC) -o $@ $(LDFLAGS) $(<:.cxx=.o) $(HEPMC_LIBS) $(PYTHIA_LIBS) $(PHOTOS_LIBS_FOR_HEPMC) \
105  -Wl,-rpath,$(PREFIX)/lib \
106  -Wl,-rpath,$(PHOTOSLOCATION)/lib \
107  -Wl,-rpath,$(HEPMCLOCATION)/lib \
108  -Wl,-rpath,$(PYTHIALOCATION)/lib
109 
110 # Version for photos LCG example - HepMC and Pythia8 required
111 photosLCG_pythia_example.exe: photosLCG_pythia_example.cxx
112  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -I$(PYTHIALOCATION)/include \
113  -I$(HEPMCLOCATION)/include -c $<
114  $(CC) -o $@ $(LDFLAGS) $(<:.cxx=.o) $(HEPMC_LIBS) $(PYTHIA_LIBS) $(PHOTOS_LIBS_FOR_HEPMC) \
115  -Wl,-rpath,$(PREFIX)/lib \
116  -Wl,-rpath,$(PHOTOSLOCATION)/lib \
117  -Wl,-rpath,$(HEPMCLOCATION)/lib \
118  -Wl,-rpath,$(PYTHIALOCATION)/lib
119 
120 # Version for photos standalone example - only HepMC required
121 photos_standalone_example.exe: photos_standalone_example.cxx
122  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -I$(HEPMCLOCATION)/include -c $<
123  $(CC) -o $@ $(LDFLAGS) $(<:.cxx=.o) $(HEPMC_LIBS) $(PHOTOS_LIBS_FOR_HEPMC) \
124  -Wl,-rpath,$(PREFIX)/lib \
125  -Wl,-rpath,$(PHOTOSLOCATION)/lib \
126  -Wl,-rpath,$(HEPMCLOCATION)/lib
127 
128 # Version for photos HepMC3 standalone example - only HepMC3 required
129 photos_hepmc3_standalone_example.exe: photos_hepmc3_standalone_example.cxx
130  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -I$(HEPMC3LOCATION)/include -c $<
131  $(CC) -o $@ $(LDFLAGS) $(<:.cxx=.o) $(HEPMC3_LIBS) $(PHOTOS_LIBS_FOR_HEPMC3) \
132  -Wl,-rpath,$(PREFIX)/lib \
133  -Wl,-rpath,$(PHOTOSLOCATION)/lib \
134  -Wl,-rpath,$(HEPMC3LOCATION)/lib
135 
136 # Version for photos HEPEVT example - no other libraries are required
137 photos_hepevt_example.exe: photos_hepevt_example.f photos_hepevt_example_interface.cxx
138  $(F77) $(FFLAGS) -c $<
139  $(CC) $(CFLAGS) -I$(PHOTOSLOCATION)/include -c photos_hepevt_example_interface.cxx
140  $(F77) -o $@ $(LDFLAGS) $(<:.f=.o) photos_hepevt_example_interface.o $(HEPMC_LIBS) $(PHOTOS_LIBS_FOR_HEPEVT) \
141  -Wl,-rpath,$(PREFIX)/lib \
142  -Wl,-rpath,$(PHOTOSLOCATION)/lib
143 
144 clean:
145  rm -f *.o *.a *~ *.exe
146 
147 Clean: clean
148  rm -rf config.log config.status autom4te.cache configure.paths.sh
149  rm -f make.inc
150 
151 make.inc:
152  @echo ""
153  @echo "Please execute ./configure first!"
154  @echo ""
155  @false
156 
157 $(PHOTOSLOCATION)/make.inc:
158  @echo ""
159  @echo "Please compile the interface first!"
160  @echo ""
161  @false