1 |
# |
2 |
# ************ PamCut makefile ************ |
3 |
# |
4 |
# Author: Nicola Mori |
5 |
# |
6 |
# This makefile will produce a cut library libPamCut.so. In the "Build options" |
7 |
# section the various compilation options can be set; they will propagate to the |
8 |
# whole project. |
9 |
# |
10 |
|
11 |
|
12 |
# ------------------------------- Build options ----------------------------# |
13 |
# |
14 |
# Normally you will not have the necessity to modify what lies below, if you |
15 |
# correctly specified the names for the submakefiles in include.mk. Modify |
16 |
# the options below to set optimization flags, compiler name and so on. |
17 |
# |
18 |
|
19 |
# C++ compiler and linker |
20 |
C++ = g++ |
21 |
|
22 |
# Optimization flags. |
23 |
# 1) Use -O, -O1, -O2, -O3 to optimize for speed or -g, -g1, -g2, -g3 |
24 |
# for debugging (slower execution). |
25 |
# 2) Uncomment -DDEBUGPAMCUT to enable debug sections in the .cpp code (these sections must be included between |
26 |
# "#ifdef DEBUGPAMCUT" and "#endif"). Note that if you |
27 |
# use debug instructions also in the .h code (headers) you will also have to add -DDEBUGPAMCUT |
28 |
# to the compiler options for the main analysis program. |
29 |
OPTIMIZE = -g3 #-DDEBUGPAMCUT |
30 |
|
31 |
|
32 |
# Library flags |
33 |
# Pamela software is modular, so some libraries may not be available in some istallations. |
34 |
# To avoid linking problems, here you can define flags to exclude those parts of the |
35 |
# PamCut software which make use of unavailable libraries. Remember to place |
36 |
# the code to be excluded between proper preprocessor directives. See the documentation or the cut |
37 |
# TofNucleiZCut for an example. |
38 |
# Since PamCut headers may refer to the optional libraries, it's important to define the same |
39 |
# flags when compiling the analysis code. Otherwise, analysis code will include PamCut headers which, |
40 |
# if no exclusion flag is set, will try to include optional software headers. |
41 |
# Conversely, if you use optional libraries remember to tell it to the linker. |
42 |
|
43 |
EXCLUSIONFLAGS = -DNO_CALONUCLEI -DNO_TRKNUCLEI -DNO_TOFNUCLEI |
44 |
|
45 |
# Put below the files on which every .cpp must depend on, ie., those files that, |
46 |
# if modified, will trigger a complete recompilation of the project. |
47 |
COMMONDEPS = makefile |
48 |
|
49 |
# The file include.mk contains the inclusion of all the sub-makefiles (subdir.mk) |
50 |
# in the project. Includes for new cuts must be added there and not below... |
51 |
-include include.mk |
52 |
|
53 |
#-------------------------------- Make body --------------------------------# |
54 |
# |
55 |
# Below the make commands are defined. There are no options to set in this section, |
56 |
# so it has to be modified only in case of radical changes to the make procedure. |
57 |
|
58 |
# Remove command for clean |
59 |
RM := rm -rf |
60 |
|
61 |
# Additional dependencies from headers of other software (PAMELA, ROOT) |
62 |
ifneq ($(MAKECMDGOALS),clean) |
63 |
ifneq ($(strip $(CPP_DEPS)),) |
64 |
-include $(CPP_DEPS) |
65 |
endif |
66 |
endif |
67 |
|
68 |
# All Target |
69 |
all: libPamCut.so |
70 |
@echo |
71 |
@echo "**** Compiler version and compilation host ****" |
72 |
@$(C++) --version | grep GCC |
73 |
@hostname |
74 |
@echo |
75 |
|
76 |
# Tool invocations |
77 |
libPamCut.so: $(OBJS) $(USER_OBJS) |
78 |
@echo 'Building target: $@' |
79 |
@echo 'Invoking: GCC C++ Linker' |
80 |
$(C++) -shared -o"libPamCut.so" $(OBJS) |
81 |
@echo 'Finished building target: $@' |
82 |
@echo ' ' |
83 |
|
84 |
# Other Targets |
85 |
clean: |
86 |
-$(RM) $(CPP_DEPS) $(OBJS) libPamCut.so |
87 |
-@echo ' ' |
88 |
|
89 |
distclean: |
90 |
@rm -f ${PAM_LIB}/libPamCut.so |
91 |
@rm -rf ${PAM_INC}/PamCut |
92 |
@echo Installed files successfully removed. |
93 |
|
94 |
install: |
95 |
@if [[ "${PAM_INC}" == "" || "${PAM_LIB}" == "" ]]; then \ |
96 |
echo Pamela environment not set. ; \ |
97 |
else \ |
98 |
rootdir=`pwd`; \ |
99 |
for file in `find -name "*.h"`; do \ |
100 |
dir=`dirname $${file} | sed 's/.\///'`; \ |
101 |
mkdir -p ${PAM_INC}/PamCut/$${dir}; \ |
102 |
cp -u $${file} ${PAM_INC}/PamCut/$${dir}; \ |
103 |
done; \ |
104 |
cp -u libPamCut.so ${PAM_LIB}; \ |
105 |
fi |
106 |
@echo PamCut installed. |
107 |
|
108 |
.PHONY: all clean distclean install |
109 |
|