makefile 4.23 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 54 55
	-$(RM) $(UTILITIESOBJS) $(UTILITIESCPP_DEPS) 
	-$(RM) $(UTILITIES)/UtilitiesCint.* libUtilities.so
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
56 57 58
	-$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS) 
	-$(RM) $(ACULDATA)/AculDataCint.* libAculData.so
	-@echo ' '
59 60 61
	-$(RM) $(ACULCALIBOBJS) $(ACULCALIBCPP_DEPS) 
	-$(RM) $(ACULCALIB)/AculCalibCint.* libAculCalib.so
	-@echo ' '
62 63 64
	-$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS)
	-$(RM) $(TELOSS)/TELossCint.* libTELoss.so
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
65 66 67 68
	-$(RM) htmldoc
	-@echo ' '

# Those *Cint* files below need special treating:
69 70 71 72 73
$(UTILITIES)/UtilitiesCint.cpp:
	-@echo 'Pre-building UtilitiesCint.cpp and UtilitiesCint.h files'
	-rootcint -f $(UTILITIES)/UtilitiesCint.cpp -c -p $(UTILITIES_HEADERS)
	-@echo ' '

Kostyleva D.A's avatar
Kostyleva D.A committed
74 75 76 77
$(ACULDATA)/AculDataCint.cpp:
	-@echo 'Pre-building AculDataCint.cpp and AculDataCint.h files'
	-rootcint -f $(ACULDATA)/AculDataCint.cpp -c -p $(ACULDATA_HEADERS)
	-@echo ' '
78
	
79 80 81 82 83
$(ACULCALIB)/AculCalibCint.cpp:
	-@echo 'Pre-building AculCalibCint.cpp and AculCalibCint.h files'
	-rootcint -f $(ACULCALIB)/AculCalibCint.cpp -c -p $(ACULCALIB_HEADERS)
	-@echo ' '
	
84 85 86 87
$(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
	-@echo ' '	
Kostyleva D.A's avatar
Kostyleva D.A committed
88 89

#*.so files
90 91 92 93 94 95 96
libUtilities.so: $(UTILITIESOBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: $(CC) Linker'
	$(CC) -L $(ROOTLIBS) -shared -o"libUtilities.so" $(UTILITIESOBJS) $(UTILITIESLIBS)
	@echo 'Finished building target: $@'
	@echo ' '

97
libAculData.so: libTELoss.so $(ACULDATAOBJS)
Kostyleva D.A's avatar
Kostyleva D.A committed
98 99
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
100
	$(CC) -L . -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS)
Kostyleva D.A's avatar
Kostyleva D.A committed
101 102
	@echo 'Finished building target: $@'
	@echo ' '
103 104 105 106 107 108 109
	
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
110

111 112 113 114 115 116
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
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
	
.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"$@" "$<"
#	$(CC) -I$(ROOTINCS) -O2 -Wall -mmmx -msse -msse2 -msse3 -mfpmath=sse,387 -march=nocona -mtune=nocona -c -fmessage-length=0 -fPIC -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 ' '