-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (122 loc) · 4.5 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Makefile is a part of the PYTHIA event generator.
# Copyright (C) 2017 Torbjorn Sjostrand.
# PYTHIA is licenced under the GNU GPL version 2, see COPYING for details.
# Please respect the MCnet Guidelines, see GUIDELINES for details.
# Author: Philip Ilten, September 2014.
#
# This is is the Makefile used to build PYTHIA examples on POSIX systems.
# Example usage is:
# make main01
# For help using the make command please consult the local system documentation,
# i.e. "man make" or "make --help".
################################################################################
# VARIABLES: Definition of the relevant variables from the configuration script.
################################################################################
# Set the shell.
SHELL=/usr/bin/env bash
# Include the configuration.
-include Makefile.inc
# Handle GZIP support.
ifeq ($(GZIP_USE),true)
CXX_COMMON+= -DGZIPSUPPORT -I$(GZIP_INCLUDE)
CXX_COMMON+= -L$(GZIP_LIB) -Wl,-rpath,$(GZIP_LIB) -lz
endif
# Check distribution (use local version first, then installed version).
ifneq ("$(wildcard ../lib/libpythia8.a)","")
PREFIX_LIB=../lib
PREFIX_INCLUDE=../include
endif
CXX_COMMON:=-I$(PREFIX_INCLUDE) $(CXX_COMMON) -Wl,-rpath,$(PREFIX_LIB) -ldl
################################################################################
# RULES: Definition of the rules used to build the PYTHIA examples.
################################################################################
# Rules without physical targets (secondary expansion for specific rules).
.SECONDEXPANSION:
.PHONY: all clean
# All targets (no default behavior).
all:
@echo "Usage: make mainXX"
# The Makefile configuration.
Makefile.inc:
$(error Error: PYTHIA must be configured, please run "./configure"\
in the top PYTHIA directory)
# PYTHIA libraries.
$(PREFIX_LIB)/libpythia8.a :
$(error Error: PYTHIA must be built, please run "make"\
in the top PYTHIA directory)
# Examples without external dependencies.
main% : main%.cc $(PREFIX_LIB)/libpythia8.a
$(CXX) $^ -o $@ $(CXX_COMMON)
# GZIP (required).
main34: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(GZIP_USE),true)
$(CXX) $^ -o $@ $(CXX_COMMON)
else
@echo "Error: $@ requires GZIP"
endif
# HEPMC2.
main41 main42 main43 main85 main86 main87 main88 main89: $$@.cc\
$(PREFIX_LIB)/libpythia8.a
ifeq ($(HEPMC2_USE),true)
$(CXX) $^ -o $@ -I$(HEPMC2_INCLUDE) $(CXX_COMMON)\
-L$(HEPMC2_LIB) -Wl,-rpath,$(HEPMC2_LIB) -lHepMC
else
@echo "Error: $@ requires HEPMC2"
endif
# PROMC.
main46: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(PROMC_USE),true)
$(CXX) $^ -o $@ -I$(PROMC_INCLUDE)/src -I$(PROMC_INCLUDE)/include\
$(CXX_COMMON) -DPROMC=\"$(PROMC_INCLUDE)\" -Wno-long-long\
-L$(PROMC_LIB) -Wl,-rpath,$(PROMC_LIB) -lpromc -lprotoc -lprotobuf\
-lprotobuf-lite -lcbook
else
@echo "Error: $@ requires PROMC"
endif
# EVTGEN (and HEPMC2).
main48: $$@.cc $(PREFIX_LIB)/libpythia8.so
ifeq ($(EVTGEN_USE)$(HEPMC2_USE),truetrue)
$(CXX) $< -o $@ -I$(EVTGEN_INCLUDE) $(CXX_COMMON)\
-DEVTGEN_PYTHIA -DEVTGEN_EXTERNAL -Wl,-rpath,$(HEPMC2_LIB)\
-L$(PREFIX_LIB) -Wl,-rpath,$(PREFIX_LIB) -lpythia8\
-L$(EVTGEN_LIB) -Wl,-rpath,$(EVTGEN_LIB) -lEvtGenExternal -lEvtGen
else
@echo "Error: $@ requires EVTGEN and HEPMC2"
endif
# FASTJET3.
main71 main72: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(FASTJET3_USE),true)
$(CXX) $^ -o $@ -I$(FASTJET3_INCLUDE) $(CXX_COMMON)\
-L$(FASTJET3_LIB) -Wl,-rpath,$(FASTJET3_LIB) -lfastjet
else
@echo "Error: $@ requires FASTJET3"
endif
# FASTJET3 and HEPMC2.
main81 main82 main83 main84: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(FASTJET3_USE)$(HEPMC2_USE),truetrue)
$(CXX) $^ -o $@ -I$(FASTJET3_INCLUDE) -I$(HEPMC2_INCLUDE) $(CXX_COMMON)\
-L$(HEPMC2_LIB) -Wl,-rpath,$(HEPMC2_LIB) -lHepMC\
-L$(FASTJET3_LIB) -Wl,-rpath,$(FASTJET3_LIB) -lfastjet
else
@echo "Error: $@ requires FASTJET3 and HEPMC2"
endif
# ROOT (turn off all warnings for readability).
main91: $$@.cc $(PREFIX_LIB)/libpythia8.a
ifeq ($(ROOT_USE),true)
$(CXX) $^ -o $@ -w -I$(ROOT_INCLUDE) $(CXX_COMMON)\
`$(ROOTBIN)root-config --cflags`\
-Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)root-config --glibs`
else
@echo "Error: $@ requires ROOT"
endif
main92: $$@.cc $(PREFIX_LIB)/libpythia8.a main92.so
ifeq ($(ROOT_USE),true)
$(CXX) $^ -o $@ -w -I$(ROOT_INCLUDE) $(CXX_COMMON)\
`$(ROOTBIN)root-config --cflags` -Wl,-rpath,./\
-Wl,-rpath,$(ROOT_LIB) `$(ROOT_BIN)root-config --glibs`
else
@echo "Error: $@ requires ROOT"
endif
read: read.cxx
$(CXX) $^ -o $@ -w -I$(ROOT_INCLUDE) $(CXX_SHARED) $(CXX_COMMON)\
`$(ROOTBIN)root-config --cflags`