| 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 | 
EXCLUSIONFLAGS = -DNO_TOFNUCLEI -DNO_CALONUCLEI -DNO_TRKNUCLEI | 
| 39 | 
 | 
| 40 | 
 | 
| 41 | 
 | 
| 42 | 
# Put below the files on which every .cpp  must depend on, ie., those files that, | 
| 43 | 
# if modified, will trigger a complete recompilation of the project.  | 
| 44 | 
COMMONDEPS = makefile | 
| 45 | 
 | 
| 46 | 
# The file include.mk contains the inclusion of all the sub-makefiles (subdir.mk) | 
| 47 | 
# in the project. Includes for new cuts must be added there and not below...  | 
| 48 | 
-include include.mk | 
| 49 | 
 | 
| 50 | 
#-------------------------------- Make body --------------------------------# | 
| 51 | 
# | 
| 52 | 
# Below the make commands are defined. There are no options to set in this section, | 
| 53 | 
# so it has to be modified only in case of radical changes to the make procedure. | 
| 54 | 
 | 
| 55 | 
# Remove command for clean | 
| 56 | 
RM := rm -rf | 
| 57 | 
 | 
| 58 | 
# Additional dependencies from headers of other software (PAMELA, ROOT) | 
| 59 | 
ifneq ($(MAKECMDGOALS),clean) | 
| 60 | 
ifneq ($(strip $(CPP_DEPS)),) | 
| 61 | 
-include $(CPP_DEPS) | 
| 62 | 
endif | 
| 63 | 
endif | 
| 64 | 
 | 
| 65 | 
# All Target | 
| 66 | 
all: libPamCut.so | 
| 67 | 
        @echo | 
| 68 | 
        @echo "**** Compiler version and compilation host ****" | 
| 69 | 
        @$(C++) --version | grep GCC | 
| 70 | 
        @hostname | 
| 71 | 
        @echo | 
| 72 | 
         | 
| 73 | 
# Tool invocations | 
| 74 | 
libPamCut.so: $(OBJS) $(USER_OBJS) | 
| 75 | 
        @echo 'Building target: $@' | 
| 76 | 
        @echo 'Invoking: GCC C++ Linker' | 
| 77 | 
        $(C++) -shared -o"libPamCut.so" $(OBJS) | 
| 78 | 
        @echo 'Finished building target: $@' | 
| 79 | 
        @echo ' ' | 
| 80 | 
 | 
| 81 | 
# Other Targets | 
| 82 | 
clean: | 
| 83 | 
        -$(RM) $(CPP_DEPS) $(OBJS) libPamCut.so | 
| 84 | 
        -@echo ' ' | 
| 85 | 
 | 
| 86 | 
distclean: | 
| 87 | 
        @rm -f ${PAM_LIB}/libPamCut.so | 
| 88 | 
        @rm -rf ${PAM_INC}/PamCut | 
| 89 | 
        @echo Installed files successfully removed.  | 
| 90 | 
         | 
| 91 | 
install: | 
| 92 | 
        @if [[ "${PAM_INC}" == ""  || "${PAM_LIB}" == "" ]]; then \ | 
| 93 | 
            echo Pamela environment not set. ; \ | 
| 94 | 
        else \ | 
| 95 | 
          rootdir=`pwd`; \ | 
| 96 | 
          for file in `find -name "*.h"`; do \ | 
| 97 | 
                dir=`dirname $${file} | sed 's/.\///'`; \ | 
| 98 | 
                mkdir -p ${PAM_INC}/PamCut/$${dir}; \ | 
| 99 | 
            cp -u $${file} ${PAM_INC}/PamCut/$${dir}; \ | 
| 100 | 
          done; \ | 
| 101 | 
          cp -u libPamCut.so ${PAM_LIB}; \ | 
| 102 | 
        fi | 
| 103 | 
        @echo PamCut installed. | 
| 104 | 
 | 
| 105 | 
.PHONY: all clean distclean install | 
| 106 | 
 |