makefile 5.29 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) 
54
	-$(RM) $(UTILITIES)/UtilitiesDict.* libUtilities.so
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) 
61
	-$(RM) $(ACULCALIB)/AculCalibDict.* libAculCalib.so
62
	-@echo ' '
63
	-$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS)
64 65
	-$(RM) $(TELOSS)/TELossDict.* *.pcm $(TELOSS)/*.pcm
	-$(RM) libTELoss.so
66
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
67 68 69
	-$(RM) htmldoc
	-@echo ' '

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

79 80 81 82 83
$(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
84
	-@echo ' '
85 86 87 88 89 90

$(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 .
91
	-@echo ' '
92
	
93 94 95 96 97 98
$(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 .
99
	-@echo ' '	
Kostyleva D.A's avatar
Kostyleva D.A committed
100

101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122
# =======
# Those *Cint* files below need special treating:
# $(UTILITIES)/UtilitiesDict.cpp:
# 	-@echo 'Pre-building UtilitiesDict.cpp and UtilitiesDict.h files'
# 	-rootcint -f $(UTILITIES)/UtilitiesDict.cpp -c -p $(UTILITIES_HEADERS)
# 	-@echo ' '

# $(ACULDATA)/AculDataCint.cpp:
# 	-@echo 'Pre-building AculDataCint.cpp and AculDataCint.h files'
# 	-rootcint -f $(ACULDATA)/AculDataCint.cpp -c -p $(ACULDATA_HEADERS)
# 	-@echo ' '
	
# $(ACULCALIB)/AculCalibDict.cpp:
# 	-@echo 'Pre-building AculCalibDict.cpp and AculCalibDict.h files'
# 	-rootcint -f $(ACULCALIB)/AculCalibDict.cpp -c -p $(ACULCALIB_HEADERS)
# 	-@echo ' '
	
# $(TELOSS)/TELossCint.cpp:
# 	-@echo 'Pre-building TELossCint.cpp and TELossCint.h files'
# 	-rootcint -f $(TELOSS)/TELossCint.cpp -c -p $(TELOSS)/TELoss.h $(TELOSS)/linkdef.h
# >>>>>>> newArch

Kostyleva D.A's avatar
Kostyleva D.A committed
123
#*.so files
124 125 126 127 128 129 130
libUtilities.so: $(UTILITIESOBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: $(CC) Linker'
	$(CC) -L $(ROOTLIBS) -shared -o"libUtilities.so" $(UTILITIESOBJS) $(UTILITIESLIBS)
	@echo 'Finished building target: $@'
	@echo ' '

131
libAculData.so: libTELoss.so $(ACULDATAOBJS)
Kostyleva D.A's avatar
Kostyleva D.A committed
132 133
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
134
	$(CC) -L . -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS)
Kostyleva D.A's avatar
Kostyleva D.A committed
135 136
	@echo 'Finished building target: $@'
	@echo ' '
137 138 139 140 141 142 143
	
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
144

145 146 147 148 149 150
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
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
	
.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 ' '