makefile 3.32 KB
Newer Older
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
################################################################################
# Makefile building all dynamic libraries:
#
#
#	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++

#global paths
ROOTINCS = $(shell root-config --incdir)
ROOTLIBS = $(shell root-config --libdir)
ROOTCFLAGS = $(shell root-config --cflags)
PWD = $(shell pwd)

DATA = $(PWD)/dataClasses
26
CONVERTDRS4 = $(PWD)/convertDRS4
27
CONVERTTEKTRONIX = $(PWD)/convertTektronix
28
CONVERTRAWTOANALYZED = $(PWD)/convertRawToAnalyzed
29 30 31

-include $(DATA)/Data.mk

32 33
all: libData.so \
	read_binary_DRS4 \
34 35
	convertTektronix \
	convertRawToAnalyzed
36 37 38 39 40 41 42 43 44 45 46 47

#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) $(DATAOBJS) $(DATACPP_DEPS) 
	-$(RM) $(DATA)/DataCint.* libData.so
	-@echo ' '
	-$(RM) htmldoc
	-@echo ' '
48 49
	-$(RM) $(CONVERTDRS4)/read_binary_DRS4
	-@echo ' '
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

# Those *Cint* files below need special treating:
$(DATA)/DataCint.cpp:
	-@echo 'Pre-building DataCint.cpp and DataCint.h files'
	-rootcint -f $(DATA)/DataCint.cpp -c -p $(DATA_HEADERS)
	-@echo ' '

#*.so files
libData.so: $(DATAOBJS)
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
	$(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS)
	@echo 'Finished building target: $@'
	@echo ' '

65
read_binary_DRS4: $(CONVERTDRS4)/read_binary.cpp libData.so
66 67 68
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
#	$(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS)
69
	$(CC) -o $(CONVERTDRS4)/read_binary_DRS4 $(CONVERTDRS4)/read_binary.cpp -lm `root-config --cflags --libs` -L $(PWD) -lData -Wl,-rpath,$(PWD)
70 71 72 73 74 75 76 77
	@echo 'Finished building target: $@'
	@echo ' '

convertTektronix: $(CONVERTTEKTRONIX)/read1.cpp libData.so
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
#	$(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS)
	$(CC) -o $(CONVERTTEKTRONIX)/convertTektronix $(CONVERTTEKTRONIX)/read1.cpp -lm `root-config --cflags --libs` -L $(PWD) -lData -Wl,-rpath,$(PWD)
78 79
	@echo 'Finished building target: $@'
	@echo ' '
80
	
81
convertRawToAnalyzed: $(CONVERTRAWTOANALYZED)/analyse.cpp libData.so
82 83 84
	@echo 'Building target: $@'
	@echo 'Invoking: GCC C++ Linker'
#	$(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS)
85
	$(CC) -o $(CONVERTRAWTOANALYZED)/convertRawToAnalyzed $(CONVERTRAWTOANALYZED)/analyse.cpp -lm `root-config --cflags --libs` -L $(PWD) -lData -Wl,-rpath,$(PWD)
86 87 88
	@echo 'Finished building target: $@'
	@echo ' '
	
89 90 91 92 93 94 95 96 97 98
.PHONY: all clean

# 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 ' '