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