| 1 | pam-fi | 1.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 | pam-fi | 1.7 | # 3) Since this is a general compiler flag it can also be used, eg., to set the -m32 flag | 
| 30 | pam-fi | 1.1 | OPTIMIZE = -g3 #-DDEBUGPAMCUT | 
| 31 |  |  |  | 
| 32 | pam-fi | 1.7 | # Linker flags | 
| 33 |  |  | # The flags defined here will be directly inserted into the linker invocation. Place here the | 
| 34 |  |  | # -m32 flag, for example. | 
| 35 |  |  | LINKERFLAGS = | 
| 36 | pam-fi | 1.4 |  | 
| 37 | pam-fi | 1.1 | # Library flags | 
| 38 |  |  | # Pamela software is modular, so some libraries may not be available in some istallations. | 
| 39 |  |  | # To avoid linking problems, here you can define flags to exclude those parts of the | 
| 40 |  |  | # PamCut software which make use of unavailable libraries. Remember to place | 
| 41 |  |  | # the code to be excluded between proper preprocessor directives. See the documentation or the cut | 
| 42 |  |  | # TofNucleiZCut for an example. | 
| 43 | pam-fi | 1.6 | # Since PamCut headers may refer to the optional libraries, it's important to define the same | 
| 44 |  |  | # flags when compiling the analysis code. Otherwise, analysis code will include PamCut headers which, | 
| 45 |  |  | # if no exclusion flag is set, will try to include optional software headers. | 
| 46 |  |  | # Conversely, if you use optional libraries remember to tell it to the linker. | 
| 47 | pam-fi | 1.1 |  | 
| 48 | pam-fi | 1.6 | EXCLUSIONFLAGS = -DNO_CALONUCLEI -DNO_TRKNUCLEI -DNO_TOFNUCLEI | 
| 49 | pam-fi | 1.1 |  | 
| 50 |  |  | # Put below the files on which every .cpp  must depend on, ie., those files that, | 
| 51 |  |  | # if modified, will trigger a complete recompilation of the project. | 
| 52 |  |  | COMMONDEPS = makefile | 
| 53 |  |  |  | 
| 54 |  |  | # The file include.mk contains the inclusion of all the sub-makefiles (subdir.mk) | 
| 55 |  |  | # in the project. Includes for new cuts must be added there and not below... | 
| 56 |  |  | -include include.mk | 
| 57 |  |  |  | 
| 58 |  |  | #-------------------------------- Make body --------------------------------# | 
| 59 |  |  | # | 
| 60 |  |  | # Below the make commands are defined. There are no options to set in this section, | 
| 61 |  |  | # so it has to be modified only in case of radical changes to the make procedure. | 
| 62 |  |  |  | 
| 63 |  |  | # Remove command for clean | 
| 64 |  |  | RM := rm -rf | 
| 65 |  |  |  | 
| 66 |  |  | # Additional dependencies from headers of other software (PAMELA, ROOT) | 
| 67 |  |  | ifneq ($(MAKECMDGOALS),clean) | 
| 68 |  |  | ifneq ($(strip $(CPP_DEPS)),) | 
| 69 |  |  | -include $(CPP_DEPS) | 
| 70 |  |  | endif | 
| 71 |  |  | endif | 
| 72 |  |  |  | 
| 73 |  |  | # All Target | 
| 74 | pam-fi | 1.4 | all: libPamCut.so | 
| 75 |  |  | @echo | 
| 76 |  |  | @echo "**** Compiler version and compilation host ****" | 
| 77 |  |  | @$(C++) --version | grep GCC | 
| 78 |  |  | @hostname | 
| 79 |  |  | @echo | 
| 80 |  |  |  | 
| 81 | pam-fi | 1.1 | # Tool invocations | 
| 82 |  |  | libPamCut.so: $(OBJS) $(USER_OBJS) | 
| 83 |  |  | @echo 'Building target: $@' | 
| 84 |  |  | @echo 'Invoking: GCC C++ Linker' | 
| 85 | pam-fi | 1.7 | $(C++) -shared $(LINKERFLAGS) -o"libPamCut.so" $(OBJS) | 
| 86 | pam-fi | 1.1 | @echo 'Finished building target: $@' | 
| 87 |  |  | @echo ' ' | 
| 88 |  |  |  | 
| 89 |  |  | # Other Targets | 
| 90 |  |  | clean: | 
| 91 |  |  | -$(RM) $(CPP_DEPS) $(OBJS) libPamCut.so | 
| 92 |  |  | -@echo ' ' | 
| 93 |  |  |  | 
| 94 | pam-fi | 1.3 | distclean: | 
| 95 |  |  | @rm -f ${PAM_LIB}/libPamCut.so | 
| 96 |  |  | @rm -rf ${PAM_INC}/PamCut | 
| 97 |  |  | @echo Installed files successfully removed. | 
| 98 |  |  |  | 
| 99 |  |  | install: | 
| 100 |  |  | @if [[ "${PAM_INC}" == ""  || "${PAM_LIB}" == "" ]]; then \ | 
| 101 |  |  | echo Pamela environment not set. ; \ | 
| 102 |  |  | else \ | 
| 103 |  |  | rootdir=`pwd`; \ | 
| 104 |  |  | for file in `find -name "*.h"`; do \ | 
| 105 |  |  | dir=`dirname $${file} | sed 's/.\///'`; \ | 
| 106 |  |  | mkdir -p ${PAM_INC}/PamCut/$${dir}; \ | 
| 107 |  |  | cp -u $${file} ${PAM_INC}/PamCut/$${dir}; \ | 
| 108 |  |  | done; \ | 
| 109 |  |  | cp -u libPamCut.so ${PAM_LIB}; \ | 
| 110 |  |  | fi | 
| 111 |  |  | @echo PamCut installed. | 
| 112 |  |  |  | 
| 113 | pam-fi | 1.4 | .PHONY: all clean distclean install | 
| 114 | pam-fi | 1.3 |  |