-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
218 lines (157 loc) · 5.85 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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# Makefile for PLUTO 5.30
#
######################
#Directories and Names
######################
SRC = src
INSTALL = lib
DEPENDFILE := .depend
OPTIMIZE = -g
#OPTIMIZE = -O3
###########################
#Compiler flags and options
###########################
CXX = g++
CXXFLAGS = $(OPTIMIZE) -rdynamic -c -Wall -fno-exceptions -fPIC -DROOTVER=$(ROOTVER) \
-I$(shell root-config --incdir) -I\. -I$(SRC) $(PLUGIN:%=-I%)
ARFLAGS = r
LD = g++
SOFLAGS = $(OPTIMIZE) -rdynamic -shared -Wl,-soname,$@
###########################
#include basics and plugins
###########################
include Makefile.plugins
#check for additional user plugins:
PLUGIN := $(STD_PLUGIN)
ifeq ($(origin PLUTO_PLUGINS), environment)
PLUGIN := $(PLUTO_PLUGINS)
endif
ifeq ($(origin PLUTO_USER_PLUGINS), environment)
PLUGIN := $(PLUGIN) $(PLUTO_USER_PLUGINS)
endif
include Makefile.base
include $(PLUGIN:%=%/Makefile)
ROOTVERSION := $(shell root-config --version)
ROOTLINEARVERSION := $(subst /,,$(subst .,,$(ROOTVERSION)))
ROOTVER := $(word 1,$(subst /, ,$(subst ., ,$(ROOTVERSION))))
ROOTSUBVER := $(word 2,$(subst /, ,$(subst ., ,$(ROOTVERSION))))
ROOTSUBSUBVER := $(word 3,$(subst /, ,$(subst ., ,$(ROOTVERSION))))
PLUTOVERSION = $(shell sed 's/^[^"]*"//' Version.h | sed 's/".*//')
ifdef PYTHIA6
CXXFLAGS += -DUSE_PYTHIA6
endif
# Linker:
# Root libs
RLIBS = $(shell root-config --glibs) -lProof -lTreePlayer -lEG \
-lm -ldl
ifdef PYTHIA6
RLIBS += -lEGPythia6 -L$(PYTHIA6) -lPythia6
endif
SNAMES = $(sort $(BASE_CLASSES))
#ANAMES = PHADES PTrackH PTrack
ANAMES =
HDRS = $(addsuffix .h, $(addprefix $(SRC)/, $(SNAMES) ) )
#
PHDRS = $(addsuffix .h, $(PLUGIN_CLASSES) )
PSRC = $(addsuffix .cc, $(PLUGIN_CLASSES) )
SOBJS = $(addsuffix .o, $(SNAMES) ) \
$(addsuffix .o, $(PLUGIN_CLASSES) )
TSOBJS = $(addsuffix .o, $(addprefix $(INSTALL)/, $(SNAMES) ) )
PSOBJS = $(addsuffix .o, $(addprefix $(INSTALL)/, $(PLUGIN_CLASSES_NAMES) ) )
PRULES1 = $(join $(addsuffix : , $(PSOBJS) ) , $(PSRC))
PRULES = $(join $(addsuffix + , $(PRULES1) ) , $(PHDRS))
#PLUGIN_COLLECTION = $(filter %Plugin, $(PLUGIN_CLASSES_NAMES))
# Output files:
LIBA = libPluto.a
LIBSO = libPluto.so
# Root:
ROOTCINT = rootcint
# Default action:
all : $(INSTALL) $(LIBSO) $(LIBA)
@echo Libraries done.
config :
echo Pluto-Version: $(PLUTOVERSION)
@echo Makefiles:
@echo $(MAKEFILE_LIST)
@echo \*\*\* Plugin classes to be compiled in:
@echo $(PLUGIN_CLASSES_NAMES)
@echo \*\*\* Plugin classes with fullpath:
@echo $(PLUGIN_CLASSES)
@echo \*\*\* Plugin target objects:
@echo $(PSOBJS)
@echo \*\*\* Plugin header files:
@echo $(PHDRS)
@echo \*\*\* Plugin source files:
@echo $(PSRC)
@echo \*\*\* Plugin rules:
@echo $(PRULES)
@echo $(MAKEFILE_LIST)
depend :
rm -f $(DEPENDFILE)
make $(DEPENDFILE)
$(DEPENDFILE) : $(PLUGIN:%=%/Makefile) Plugins.h
@echo $(PRULES) | sed 's/+/\ /g' | sed 's/\.h/\.h\n/g' > $(DEPENDFILE)
Plugins.cc : $(PLUGIN:%=%/Makefile)
@echo $(addprefix \#include \", $(addsuffix \"+ , $(PLUGIN_COLLECTION)))| sed 's/+/\n/g' > Plugins.cc
Plugins.h : $(PLUGIN:%=%/Makefile)
@echo > Plugins.h
@echo $(addprefix \#include \", $(addsuffix \"+, $(PHDRS))) | sed 's/+/\n/g' > Plugins.h
# @echo $(addprefix \#include \", $(addsuffix \"+, $(PHDRS))) > Plugins.h
$(INSTALL)/PDistributionManager.o : $(PLUGIN:%=%/Makefile) Plugins.h Plugins.cc
# Static library:
$(LIBA) : $(TSOBJS) $(INSTALL)/PlutoCint.o
@rm -f $@
@$(AR) $(ARFLAGS) $@ $^
# Shared library:
$(LIBSO) : $(TSOBJS) $(PSOBJS) $(INSTALL)/PlutoCint.o
@echo Linking libPluto.so
@$(LD) $(SOFLAGS) -o $@ $^
$(INSTALL) :
@mkdir $(INSTALL)
# Rules for PlutoCint:
$(INSTALL)/PlutoCint.o : $(INSTALL)/PlutoCint.cc
@echo Compiling dictionary
@$(CXX) $(CXXFLAGS) $< -o $@
$(INSTALL)/PlutoCint.cc : $(HDRS) $(PHDRS) PlutoLinkdef.h
@echo Creating dictionary
@echo $(addprefix "#pragma link C++ class ", $(addsuffix ";", $(PLUGIN_CLASSES_NAMES))) | sed 's/;/;\n/g' > PluginLinkdef.h
@$(ROOTCINT) -f $@ -c -I\. -I$(SRC) $(PLUGIN:%=-I%) $^
# Static pattern rule for object file dependency on sources:
$(TSOBJS): $(INSTALL)/%.o : $(SRC)/%.cc $(SRC)/%.h
@echo Compiling Base Class $*
@echo char *date_string = "(char*)"\"$$(date +"%e %B %Y")\"\; > Compiled.h
@$(CXX) $(CXXFLAGS) $< -o $@
#$(PSOBJS): $(INSTALL)/%.o : $(shell grep $* $(PLUGIN:%=%/config))
$(PSOBJS): $(INSTALL)/%.o : $(DEPENDFILE)
@echo Compiling Plugin $*
@$(CXX) $(CXXFLAGS) $(filter %$*.cc, $(PSRC)) -o $@
Pluto: $(LIBSO) pluto.cc
@$(CXX) $(CXXFLAGS) pluto.cc -o pluto.o
@$(LD) -g pluto.o -L. -L$(ROOTSYS)/lib $(RLIBS) -lPluto -o Pluto
docs: macros/makeClassDocs.C Pluto.so
@echo Generating the documentation...
@root -q -l makeClassDocs.C
tar:
tar cvf pluto.tar src/*.cc src/*.h Makefile PlutoLinkdef.h README AUTHORS REFERENCES macros/*.C; gzip pluto.tar
# cleanup:
clean:
rm -f $(INSTALL)/*.o
rm -f $(INSTALL)/*Cint.*
rm -f $(INSTALL)/$(LIBSO) $(INSTALL)/$(LIBA)
rm -f Plugins.h Plugins.cc
pluginclean:
rm -f $(PSOBJS)
fairroot:
rm -fr $(SIMPATH)/generators/Pluto.$(PLUTOVERSION)*
rm -fr $(SIMPATH)/generators/pluto
mkdir -p $(SIMPATH)/generators/pluto
cp -r src $(SIMPATH)/generators/pluto
cp -r plugins/ $(SIMPATH)/generators/pluto
cp $(PHDRS) $(SIMPATH)/generators/pluto/src
cp -r macros $(SIMPATH)/generators/pluto
cp plugins/fairroot/PFairGenerator.h $(SIMPATH)/generators/pluto/src
cp Makefile Makefile.base Makefile.plugins Makefile.fairsoft newline.awk PlutoLinkdef.h README AUTHORS REFERENCES Version.h $(SIMPATH)/generators/pluto/
cd $(SIMPATH)/generators/; tar cvf pluto.tar pluto/* --exclude-vcs; gzip pluto.tar; mv pluto.tar.gz Pluto.$(PLUTOVERSION).tar.gz
rm -fr $(SIMPATH)/generators/pluto
rm -fr $(SIMPATH)/generators/libPluto.*
sinclude $(DEPENDFILE)