makefile 4.52 KB
Newer Older
Kostyleva D.A's avatar
Kostyleva D.A committed
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
################################################################################
# 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

28
UTILITIES = $(PWD)/Utilities
Kostyleva D.A's avatar
Kostyleva D.A committed
29
ACULDATA = $(PWD)/AculData
30
ACULCALIB = $(PWD)/AculCalib
31
TELOSS = $(PWD)/TELoss
Kostyleva D.A's avatar
Kostyleva D.A committed
32

33
-include $(UTILITIES)/Utilities.mk
Kostyleva D.A's avatar
Kostyleva D.A committed
34
-include $(ACULDATA)/AculData.mk
35
-include $(ACULCALIB)/AculCalib.mk
36
-include $(TELOSS)/TELoss.mk
Kostyleva D.A's avatar
Kostyleva D.A committed
37

38 39
all: libUtilities.so \
	libAculData.so \
40
	libAculCalib.so \
41
	libTELoss.so
Kostyleva D.A's avatar
Kostyleva D.A committed
42 43

#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
44
htmldoc: libAculData.so libAculCalib.so libTELoss.so
Kostyleva D.A's avatar
Kostyleva D.A committed
45
	-$(RM) htmldoc
46 47 48 49 50
	root -l -q htmldoc.cxx	

clean_htmldoc:
	-$(RM) htmldoc
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
51 52

clean:
53
	-$(RM) $(UTILITIESOBJS) $(UTILITIESCPP_DEPS) 
Vratislav Chudoba's avatar
Vratislav Chudoba committed
54
	-$(RM) $(UTILITIES)/UtilitiesDict.* libUtilities.so $(UTILITIES)/*.pcm
55
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
56
	-$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS) 
57 58
	-$(RM) $(ACULDATA)/AculDataDict.* *.pcm $(ACULDATA)/*.pcm
	 -$(RM) libAculData.so
Kostyleva D.A's avatar
Kostyleva D.A committed
59
	-@echo ' '
60
	-$(RM) $(ACULCALIBOBJS) $(ACULCALIBCPP_DEPS) 
Vratislav Chudoba's avatar
Vratislav Chudoba committed
61
	-$(RM) $(ACULCALIB)/AculCalibDict.* libAculCalib.so $(ACULCALIB)/*.pcm
62
	-@echo ' '
63
	-$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS)
Vratislav Chudoba's avatar
Vratislav Chudoba committed
64
	-$(RM) $(TELOSS)/TELossDict.* *.pcm $(TELOSS)/*.pcm $(TELOSS)/*.pcm
65
	-$(RM) libTELoss.so
66
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
67 68 69
	-$(RM) htmldoc
	-@echo ' '

70
# Those *Dictionary* files below need special treating:
71 72 73 74 75
$(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 .
76 77
	-@echo ' '

78 79 80 81 82
$(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 .
Kostyleva D.A's avatar
Kostyleva D.A committed
83
	-@echo ' '
84 85 86 87 88

$(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'
89
	-ln -s $(ACULCALIB)/AculCalibDict_rdict.pcm .
90
	-@echo ' '
91
	
92 93 94 95 96 97
$(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 .
98
	-@echo ' '	
Kostyleva D.A's avatar
Kostyleva D.A committed
99 100

#*.so files
101 102 103 104 105 106 107
libUtilities.so: $(UTILITIESOBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: $(CC) Linker'
	$(CC) -L $(ROOTLIBS) -shared -o"libUtilities.so" $(UTILITIESOBJS) $(UTILITIESLIBS)
	@echo 'Finished building target: $@'
	@echo ' '

108
libAculData.so: libTELoss.so $(ACULDATAOBJS)
Kostyleva D.A's avatar
Kostyleva D.A committed
109 110
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
111
	$(CC) -L . -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS)
Kostyleva D.A's avatar
Kostyleva D.A committed
112 113
	@echo 'Finished building target: $@'
	@echo ' '
114 115 116 117 118 119 120
	
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 ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
121

122 123 124 125 126 127
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 ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
	
.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 ' '