################################################################################ # Makefile building all dynamic libraries: # libCalib.so # # OBJS - files type *.o (subdir.mk) # LIBS - list of the loaded libraries (objects.mk) # RM - command "rm -rf" # CPP_DEPS - files type *.d (subdir.mk) # .PHONY - # .SECONDARY - # # Vratislav Chudoba ################################################################################ RM := rm -rf CC := g++ F90 := gfortran #global paths ROOTINCS = $(shell root-config --incdir) ROOTLIBS = $(shell root-config --libdir) ROOTCFLAGS = $(shell root-config --cflags) PWD = $(shell pwd) #INSTALLFOLDER = $(HOME)/AculLib UTILITIES = $(PWD)/Utilities ACULDATA = $(PWD)/AculData ACULCALIB = $(PWD)/AculCalib TELOSS = $(PWD)/TELoss -include $(UTILITIES)/Utilities.mk -include $(ACULDATA)/AculData.mk -include $(ACULCALIB)/AculCalib.mk -include $(TELOSS)/TELoss.mk all: libUtilities.so \ libAculData.so \ libAculCalib.so \ libTELoss.so #ROOT html documentation, it will be done as a program which will be alsa compiled by this makefile, program will be as a last condition after all of the libraries htmldoc: libAculData.so libAculCalib.so libTELoss.so -$(RM) htmldoc root -l -q htmldoc.cxx clean_htmldoc: -$(RM) htmldoc -@echo ' ' clean: -$(RM) $(UTILITIESOBJS) $(UTILITIESCPP_DEPS) -$(RM) $(UTILITIES)/UtilitiesDict.* libUtilities.so $(UTILITIES)/*.pcm -@echo ' ' -$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS) -$(RM) $(ACULDATA)/AculDataDict.* *.pcm $(ACULDATA)/*.pcm -$(RM) libAculData.so -@echo ' ' -$(RM) $(ACULCALIBOBJS) $(ACULCALIBCPP_DEPS) -$(RM) $(ACULCALIB)/AculCalibDict.* libAculCalib.so $(ACULCALIB)/*.pcm -@echo ' ' -$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS) -$(RM) $(TELOSS)/TELossDict.* *.pcm $(TELOSS)/*.pcm $(TELOSS)/*.pcm -$(RM) libTELoss.so -@echo ' ' -$(RM) htmldoc -@echo ' ' # Those *Dictionary* files below need special treating: $(UTILITIES)/UtilitiesDict.cpp: -@echo 'Pre-building UtilitiesDict.cpp and UtilitiesDict.h files' -rootcling -f $(UTILITIES)/UtilitiesDict.cpp -p $(UTILITIES_HEADERS) -@echo 'Creating: link to UtilitiesDict_rdict.pcm' -ln -s $(UTILITIES)/UtilitiesDict_rdict.pcm . -@echo ' ' $(ACULDATA)/AculDataDict.cpp: -@echo 'Pre-building AculDataDict.cpp and AculDataCint.h files' -rootcling -f $(ACULDATA)/AculDataDict.cpp -p $(ACULDATA_HEADERS) -@echo 'Creating: link to AculDataDict_rdict.pcm' -ln -s $(ACULDATA)/AculDataDict_rdict.pcm . -@echo ' ' $(ACULCALIB)/AculCalibDict.cpp: -@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files' -rootcling -f $(ACULCALIB)/AculCalibDict.cpp -p $(ACULCALIB_HEADERS) -@echo 'Creating: link to AculCalibDict_rdict.pcm' -ln -s $(ACULDATA)/AculCalibDict_rdict.pcm . -@echo ' ' $(TELOSS)/TELossDict.cpp: -@echo 'Pre-building TELossDict.cpp and TELossDict_rdict.pcm files' @echo -rootcling -f $@ -c $(CXXFLAGS) -p $(TELOSS_HEADERS) -@echo 'Creating: link to TELossDict_rdict.pcm' -ln -s $(TELOSS)/TELossDict_rdict.pcm . -@echo ' ' #*.so files libUtilities.so: $(UTILITIESOBJS) @echo 'Building target: $@' @echo 'Invoking: $(CC) Linker' $(CC) -L $(ROOTLIBS) -shared -o"libUtilities.so" $(UTILITIESOBJS) $(UTILITIESLIBS) @echo 'Finished building target: $@' @echo ' ' libAculData.so: libTELoss.so $(ACULDATAOBJS) @echo 'Building target: $@' @echo 'Invoking: GCC C++ Linker' $(CC) -L . -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS) @echo 'Finished building target: $@' @echo ' ' libAculCalib.so: libTELoss.so $(ACULCALIBOBJS) @echo 'Building target: $@' @echo 'Invoking: GCC C++ Linker' $(CC) -L . -L $(ROOTLIBS) -shared -o"libAculCalib.so" $(ACULCALIBOBJS) $(ACULCALIBLIBS) @echo 'Finished building target: $@' @echo ' ' libTELoss.so: $(TELOSSOBJS) @echo 'Building target: $@' @echo 'Invoking: GCC C++ Linker' $(CC) -L . -L $(ROOTLIBS) -shared -o"libTELoss.so" $(TELOSSOBJS) $(TELOSSLIBS) @echo 'Finished building target: $@' @echo ' ' .PHONY: all clean #.SECONDARY: AculData_pre-build TELoss_pre-build Detectors_pre-build libAculData.so libTELoss.so libDetectors.so # Each subdirectory must supply rules for building sources it contributes %.o: %.cpp @echo 'Building file: $@' @echo 'Invoking: $(CC) Compiler' $(CC) -I$(ROOTINCS) -O0 -g3 -Wall -c -fmessage-length=0 -fPIC $(ROOTCFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" @echo 'Finished building: $@' @echo ' ' # fortran object files $(TELOSS)/ELOSS.o: @echo 'Building file: $@' @echo 'Invoking: gfortran' $(F90) -c -fPIC -o"$(TELOSS)/ELOSS.o" $(TELOSS)/ELOSS.f90 @echo 'Finished building target: $@' @echo ' '