makefile 2.99 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 28
################################################################################
# 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

ACULDATA = $(PWD)/AculData
29
TELOSS = $(PWD)/TELoss
Kostyleva D.A's avatar
Kostyleva D.A committed
30 31

-include $(ACULDATA)/AculData.mk
32
-include $(TELOSS)/TELoss.mk
Kostyleva D.A's avatar
Kostyleva D.A committed
33 34

all: libAculData.so \
35
	libTELoss.so
Kostyleva D.A's avatar
Kostyleva D.A committed
36 37 38 39 40 41 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
htmldoc: libAculData.so
	-$(RM) htmldoc
	root -l -q html.cxx	

clean:
	-$(RM) $(ACULDATAOBJS) $(ACULDATACPP_DEPS) 
44 45
	-$(RM) $(ACULDATA)/AculDataDict.* *.pcm $(ACULDATA)/*.pcm
	 -$(RM) libAculData.so
Kostyleva D.A's avatar
Kostyleva D.A committed
46
	-@echo ' '
47
	-$(RM) $(TELOSSOBJS) $(TELOSSCPP_DEPS)
48 49
	-$(RM) $(TELOSS)/TELossDict.* *.pcm $(TELOSS)/*.pcm
	-$(RM) libTELoss.so
50
	-@echo ' '
Kostyleva D.A's avatar
Kostyleva D.A committed
51 52 53
	-$(RM) htmldoc
	-@echo ' '

54 55 56 57 58 59
# Those *Dictionary* files below need special treating:
$(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
60
	-@echo ' '
61
	
62 63 64 65 66 67
$(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 .
68
	-@echo ' '	
Kostyleva D.A's avatar
Kostyleva D.A committed
69 70

#*.so files
71
libAculData.so: libTELoss.so $(ACULDATAOBJS)
Kostyleva D.A's avatar
Kostyleva D.A committed
72 73
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
74
	$(CC) -L . -L $(ROOTLIBS) -shared -o"libAculData.so" $(ACULDATAOBJS) $(ACULDATALIBS)
Kostyleva D.A's avatar
Kostyleva D.A committed
75 76 77
	@echo 'Finished building target: $@'
	@echo ' '

78 79 80 81 82 83
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
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
	
.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 ' '