[1] | 1 | ###################################################################### |
---|
| 2 | # Makefile for building Pythia's ROOT examples. |
---|
| 3 | # Axel Naumann, 2011-03-03 |
---|
| 4 | ###################################################################### |
---|
| 5 | |
---|
| 6 | # Need this to get SHAREDSUFFIX (e.g. dylib or so) |
---|
| 7 | -include ../config.mk |
---|
| 8 | |
---|
| 9 | # A few variables used in this Makefile: |
---|
| 10 | EX := hist tree |
---|
| 11 | EXE := $(addsuffix .exe,$(EX)) |
---|
| 12 | PYTHIA8 ?= $(PWD)/.. |
---|
| 13 | STATICLIB := $(PYTHIA8)/lib/archive/libpythia8.a |
---|
| 14 | SHAREDLIB := $(PYTHIA8)/lib/libpythia8.$(SHAREDSUFFIX) |
---|
| 15 | DICTCXXFLAGS := -I$(PYTHIA8)/include |
---|
| 16 | ROOTCXXFLAGS := $(DICTCXXFLAGS) $(shell root-config --cflags) |
---|
| 17 | |
---|
| 18 | # Libraries to include if GZIP support is enabled |
---|
| 19 | ifeq (x$(ENABLEGZIP),xyes) |
---|
| 20 | LIBGZIP=-L$(BOOSTLIBLOCATION) -lboost_iostreams -L$(ZLIBLOCATION) -lz |
---|
| 21 | endif |
---|
| 22 | |
---|
| 23 | # LDFLAGS1 for static library, LDFLAGS2 for shared library |
---|
| 24 | LDFLAGS1 := $(shell root-config --ldflags --glibs) \ |
---|
| 25 | -L$(PYTHIA8)/lib/archive -lpythia8 -llhapdfdummy $(LIBGZIP) |
---|
| 26 | LDFLAGS2 := $(shell root-config --ldflags --glibs) \ |
---|
| 27 | -L$(PYTHIA8)/lib -lpythia8 -llhapdfdummy $(LIBGZIP) |
---|
| 28 | |
---|
| 29 | # Default target; make examples (but not shared dictionary) |
---|
| 30 | all: $(EX) |
---|
| 31 | |
---|
| 32 | # Rule to build hist example. Needs static PYTHIA 8 library |
---|
| 33 | hist: $(STATICLIB) hist.cc |
---|
| 34 | $(CXX) $(ROOTCXXFLAGS) $@.cc -o $@.exe $(LDFLAGS1) |
---|
| 35 | |
---|
| 36 | # Rule to build tree example. Needs dictionary to be built and |
---|
| 37 | # static PYTHIA 8 library |
---|
| 38 | tree: $(STATICLIB) tree.cc |
---|
| 39 | rootcint -f treeDict.cc -c $(DICTCXXFLAGS) pythiaROOT.h pythiaLinkdef.h |
---|
| 40 | $(CXX) $(ROOTCXXFLAGS) treeDict.cc $@.cc -o $@.exe $(LDFLAGS1) |
---|
| 41 | |
---|
| 42 | # Rule to build full dictionary |
---|
| 43 | dict: $(SHAREDLIB) |
---|
| 44 | rootcint -f pythiaDict.cc -c $(DICTCXXFLAGS) \ |
---|
| 45 | -DPYTHIA8_COMPLETE_ROOT_DICTIONARY \ |
---|
| 46 | pythiaROOT.h pythiaLinkdef.h |
---|
| 47 | $(CXX) -shared -o pythiaDict.$(SHAREDSUFFIX) pythiaDict.cc \ |
---|
| 48 | -DPYTHIA8_COMPLETE_ROOT_DICTIONARY \ |
---|
| 49 | $(ROOTCXXFLAGS) $(LDFLAGS2) |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | # Error messages if PYTHIA libraries don't exist |
---|
| 53 | $(STATICLIB): |
---|
| 54 | @echo "Error: PYTHIA 8 archive library must be built" |
---|
| 55 | @false |
---|
| 56 | $(SHAREDLIB): |
---|
| 57 | @echo "Error: PYTHIA 8 shared library must be built" |
---|
| 58 | @false |
---|
| 59 | |
---|
| 60 | # Clean up |
---|
| 61 | clean: |
---|
| 62 | rm -f $(EXE) hist.root pythiaDict.* \ |
---|
| 63 | treeDict.cc treeDict.h pytree.root |
---|
| 64 | |
---|