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