hepmc - Blame information for rev 249
Subversion Repositories:
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 7 | garren | 1 | ################################################################################ Makefile for building a HepMC shared library with the gcc compiler |
| 2 | # Matt.Dobbs@CERN.CH 1.2000 | ||
| 3 | # | ||
| 4 | # This makefiles also works to compile the example programs. | ||
| 43 | garren | 5 | # I.E.: syntax for compiling the example_MyPythia.cc example: |
| 6 | # gmake example_MyPythia.exe | ||
| 7 | # or simply gmake all to compile all examples. | ||
| 7 | garren | 8 | # |
| 9 | ################################################################################ Define directory paths | ||
| 43 | garren | 10 | # You may have to change GENSERdir and/or other variables |
| 7 | garren | 11 | # |
| 37 | garren | 12 | HepMCdir = @prefix@ |
| 13 | HepMClib = $(HepMCdir)/lib/libHepMC.a | ||
| 14 | HepMCfiolib = $(HepMCdir)/lib/libHepMCfio.a | ||
| 15 | GENSERdir = @GENSERdir@ | ||
| 43 | garren | 16 | CLHEPdir = @CLHEPdir@ |
| 76 | garren | 17 | Pythia_LIB = -L$(GENSERdir)/lib -lpythia6_403 -lpythia6_403_dumm -lpythia6_403_pdfdumm |
| 37 | garren | 18 | Herwig_LIB = -L$(GENSERdir)/lib -lherwig6_510 -lherwig6_510_dumm -lherwig6_510_pdfdumm |
| 7 | garren | 19 | |
| 20 | ################################################################################ Compiler options | ||
| 21 | # | ||
| 22 | CXX = @CXX@ | ||
| 37 | garren | 23 | INCLUDES = -I$(HepMCdir)/include -I$(CLHEPdir)/include |
| 7 | garren | 24 | CXXFLAGS = @AM_CXXFLAGS@ @CXXFLAGS@ $(INCLUDES) |
| 25 | ifeq "$(CXX)" "g++" | ||
| 26 | F77 = g77 | ||
| 27 | FLAGS = $(DFLG) -fno-second-underscore $(INCDIR) | ||
| 28 | else | ||
| 29 | F77 = f77 | ||
| 30 | FLAGS = $(DFLG) $(INCDIR) | ||
| 31 | endif | ||
| 32 | CLHEP_LIB = -L$(CLHEPdir)/lib -lCLHEP | ||
| 33 | initpydata_OBJ= initpydata.o | ||
| 76 | garren | 34 | pythia_OBJ = initPythia.o initpydata.o |
| 7 | garren | 35 | LINK_LIBS = @AM_LDFLAGS@ |
| 36 | SRCS = example_BuildEventFromScratch.cc \ | ||
| 37 | example_EventSelection.cc \ | ||
| 38 | example_MyHerwig.cc \ | ||
| 39 | example_MyPythia.cc \ | ||
| 40 | example_MyPythiaOnlyToHepMC.cc \ | ||
| 41 | example_MyPythiaWithEventSelection.cc \ | ||
| 35 | garren | 42 | example_PythiaParticle.cc \ |
| 7 | garren | 43 | example_ReadPDGtable.cc \ |
| 44 | example_UsingIterators.cc \ | ||
| 76 | garren | 45 | initPythia.cc \ |
| 7 | garren | 46 | initpydata.f |
| 76 | garren | 47 | HDRS = $(HepMCdir)/include/HepMC/*.h *.h |
| 7 | garren | 48 | EXAMPLES = example_BuildEventFromScratch.exe \ |
| 49 | example_EventSelection.exe \ | ||
| 50 | example_MyHerwig.exe \ | ||
| 51 | example_MyPythia.exe \ | ||
| 67 | garren | 52 | example_MyPythiaRead.exe \ |
| 7 | garren | 53 | example_MyPythiaOnlyToHepMC.exe \ |
| 54 | example_MyPythiaWithEventSelection.exe \ | ||
| 35 | garren | 55 | example_PythiaParticle.exe \ |
| 7 | garren | 56 | example_ReadPDGtable.exe \ |
| 249 | garren | 57 | example_UsingIterators.exe |
| 7 | garren | 58 | |
| 59 | ################################################################################ | ||
| 60 | |||
| 61 | PLATFORM=$(shell uname) | ||
| 62 | ifeq "$(PLATFORM)" "IRIX" | ||
| 63 | IRIX6 = $(findstring 6,$(shell uname -r)) | ||
| 64 | ifeq "$(IRIX6)" "6" | ||
| 65 | PLATFORM=IRIX64 | ||
| 66 | endif | ||
| 67 | endif | ||
| 68 | |||
| 69 | ifeq "$(PLATFORM)" "HP-UX" | ||
| 70 | LINK_LIBS += -lg2c -lftn -lf | ||
| 71 | endif | ||
| 72 | ifeq "$(PLATFORM)" "IRIX" | ||
| 73 | LINK_LIBS += -lg2c -lftn | ||
| 74 | endif | ||
| 75 | ifeq "$(PLATFORM)" "IRIX64" | ||
| 76 | LINK_LIBS += -lg2c -lftn | ||
| 77 | endif | ||
| 78 | ifeq "$(PLATFORM)" "Linux" | ||
| 79 | LINK_LIBS += -lg2c | ||
| 80 | endif | ||
| 81 | ifeq "$(PLATFORM)" "OSF1" | ||
| 82 | LINK_LIBS += -lfor -lUfor | ||
| 83 | endif | ||
| 84 | ifeq "$(PLATFORM)" "SunOS" | ||
| 85 | LINK_LIBS += -lg2c | ||
| 86 | endif | ||
| 87 | |||
| 88 | ################################################################################ HP-UX Options and Fixes | ||
| 89 | # see http://consult.cern.ch/qa/2534 for hint at HP-UX solution | ||
| 90 | # | ||
| 91 | PLATFORM=$(shell uname) | ||
| 92 | ifeq "$(PLATFORM)" "HP-UX" | ||
| 93 | LINK_LIBS = $(LINK_LIBS) -lf | ||
| 94 | endif | ||
| 95 | |||
| 96 | ################################################################################ definition of the compiler options | ||
| 97 | # -I location of directory containing include files | ||
| 98 | # -L location of directory containing libraries | ||
| 99 | # -lname include the library from -L location called libname.a | ||
| 100 | # -lg2c is the library containing info on converting fortran to C | ||
| 101 | # -lf is the library containing the intrinsic for HPUX only. | ||
| 102 | # -shared make a shared library as output | ||
| 103 | # -fPIC produce position independent code | ||
| 104 | # necessary on some platforms (including HPUX) for -shared | ||
| 105 | # -fpic ^^ same(?) | ||
| 106 | # -O optimizes | ||
| 107 | # -g produces output for the debugger | ||
| 108 | # -pg produces output for gprof profiler | ||
| 109 | # note: if you want to see all warnings and ensure ansi standard | ||
| 110 | # compatibility, use: | ||
| 111 | # -pipe -ansi -pedantic -fnonnull-objects \ | ||
| 112 | # -W -Wall -Wwrite-strings -Wpointer-arith -Wnested-externs \ | ||
| 113 | # -Woverloaded-virtual -Wbad-function-cast -fnonnull-objects | ||
| 114 | # The proper order for cernlib libraries is: | ||
| 115 | # -lpawlib -lgraflib -lgrafX11 -lmathlib -lkernlib -lpacklib -ljetset74 | ||
| 116 | # | ||
| 117 | # makefile syntax: | ||
| 118 | # for target thedir/target.suf from source anotherdir/source.suf2 | ||
| 119 | # ${*D} = thedir | ||
| 120 | # ${*F} = target | ||
| 121 | # $* = thedir/target | ||
| 122 | # $@ = thedir/target.suf | ||
| 123 | # $< = anotherdir/source.suf2 | ||
| 124 | # | ||
| 125 | |||
| 126 | ############################################################################### | ||
| 127 | # | ||
| 128 | .SUFFIXES: .o .cxx .f .exe | ||
| 43 | garren | 129 | all: $(EXAMPLES) |
| 7 | garren | 130 | |
| 43 | garren | 131 | example_BuildEventFromScratch.exe: example_BuildEventFromScratch.o |
| 7 | garren | 132 | @echo "Building $@ ..." |
| 133 | $(CXX) $(FLAGS) example_BuildEventFromScratch.o \ | ||
| 9 | garren | 134 | $(HepMClib) \ |
| 43 | garren | 135 | $(CLHEP_LIB) \ |
| 7 | garren | 136 | $(LINK_LIBS) -o $@ |
| 137 | |||
| 43 | garren | 138 | example_EventSelection.exe: example_EventSelection.o |
| 7 | garren | 139 | @echo "Building $@ ..." |
| 140 | $(CXX) $(FLAGS) example_EventSelection.o \ | ||
| 9 | garren | 141 | $(HepMClib) \ |
| 7 | garren | 142 | $(LINK_LIBS) -o $@ |
| 143 | |||
| 43 | garren | 144 | example_MyHerwig.exe: example_MyHerwig.o |
| 7 | garren | 145 | @echo "Building $@ ..." |
| 146 | $(CXX) $(FLAGS) example_MyHerwig.o \ | ||
| 9 | garren | 147 | $(HepMClib) $(HepMCfiolib) \ |
| 7 | garren | 148 | $(Herwig_LIB) $(LINK_LIBS) -o $@ |
| 149 | |||
| 76 | garren | 150 | example_MyPythia.exe: $(initpydata_OBJ) $(pythia_OBJ) example_MyPythia.o |
| 7 | garren | 151 | @echo "Building $@ ..." |
| 76 | garren | 152 | $(CXX) $(FLAGS) $(pythia_OBJ) example_MyPythia.o \ |
| 9 | garren | 153 | $(HepMClib) $(HepMCfiolib) \ |
| 7 | garren | 154 | $(Pythia_LIB) $(LINK_LIBS) -o $@ |
| 155 | |||
| 76 | garren | 156 | example_MyPythiaRead.exe: $(initpydata_OBJ) $(pythia_OBJ) example_MyPythiaRead.o |
| 62 | garren | 157 | @echo "Building $@ ..." |
| 76 | garren | 158 | $(CXX) $(FLAGS) $(pythia_OBJ) example_MyPythiaRead.o \ |
| 62 | garren | 159 | $(HepMClib) $(HepMCfiolib) \ |
| 160 | $(Pythia_LIB) $(LINK_LIBS) -o $@ | ||
| 161 | |||
| 76 | garren | 162 | example_MyPythiaOnlyToHepMC.exe: $(initpydata_OBJ) $(pythia_OBJ) example_MyPythiaOnlyToHepMC.o |
| 7 | garren | 163 | @echo "Building $@ ..." |
| 76 | garren | 164 | $(CXX) $(FLAGS) $(pythia_OBJ) example_MyPythiaOnlyToHepMC.o \ |
| 9 | garren | 165 | $(HepMClib) $(HepMCfiolib) \ |
| 7 | garren | 166 | $(Pythia_LIB) $(LINK_LIBS) -o $@ |
| 167 | |||
| 76 | garren | 168 | example_MyPythiaWithEventSelection.exe: $(initpydata_OBJ) $(pythia_OBJ) example_MyPythiaWithEventSelection.o |
| 7 | garren | 169 | @echo "Building $@ ..." |
| 76 | garren | 170 | $(CXX) $(FLAGS) $(pythia_OBJ) example_MyPythiaWithEventSelection.o \ |
| 9 | garren | 171 | $(HepMClib) $(HepMCfiolib) \ |
| 7 | garren | 172 | $(Pythia_LIB) $(LINK_LIBS) -o $@ |
| 173 | |||
| 76 | garren | 174 | example_PythiaParticle.exe: $(initpydata_OBJ) $(pythia_OBJ) example_PythiaParticle.o |
| 35 | garren | 175 | @echo "Building $@ ..." |
| 76 | garren | 176 | $(CXX) $(FLAGS) $(pythia_OBJ) example_PythiaParticle.o \ |
| 35 | garren | 177 | $(HepMClib) $(HepMCfiolib) \ |
| 178 | $(Pythia_LIB) \ | ||
| 43 | garren | 179 | $(LINK_LIBS) -o $@ |
| 35 | garren | 180 | |
| 43 | garren | 181 | example_ReadPDGtable.exe: example_ReadPDGtable.o |
| 7 | garren | 182 | @echo "Building $@ ..." |
| 183 | $(CXX) $(FLAGS) example_ReadPDGtable.o \ | ||
| 9 | garren | 184 | $(HepMClib) \ |
| 7 | garren | 185 | $(LINK_LIBS) -o $@ |
| 186 | |||
| 43 | garren | 187 | example_UsingIterators.exe: example_UsingIterators.o |
| 7 | garren | 188 | @echo "Building $@ ..." |
| 189 | $(CXX) $(FLAGS) example_UsingIterators.o \ | ||
| 9 | garren | 190 | $(HepMClib) \ |
| 7 | garren | 191 | $(LINK_LIBS) -o $@ |
| 192 | |||
| 193 | ############################################################################### | ||
| 194 | # instructions for building a .o file from a .cxx file | ||
| 195 | # | ||
| 196 | .cc.o: $(HDRS) $< | ||
| 197 | @echo "Compiling $< with $(CXX) ..." | ||
| 198 | @$(CXX) $(CXXFLAGS) -c $< -o $@ | ||
| 199 | |||
| 200 | ############################################################################### | ||
| 201 | # instructions for building a .o file from a .f file | ||
| 202 | # | ||
| 203 | .f.o: $< | ||
| 204 | @echo "Compiling $< with $(F77) ..." | ||
| 205 | @$(F77) $(FLAGS) -c $< -o $@ | ||
| 206 | |||
| 207 | ############################################################################### | ||
| 208 | # gmake clean removes all garbage from HepMC directories. | ||
| 209 | # | ||
| 210 | clean: | ||
| 211 | rm -f *.o | ||
| 212 | |||
| 213 | ############################################################################### | ||
| 214 | # gmake distclean removes all compiled libraries, executables, +garbage | ||
| 215 | # to prepare the package for distribution | ||
| 216 | distclean: | ||
| 217 | $(MAKE) clean --no-print-directory | ||
| 218 | rm -f *.exe | ||
| 219 | rm -f *.dat | ||
| 220 |
