forked from bianchini/Code
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
127 lines (96 loc) · 3.46 KB
/
Makefile
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
INC_DIR_CMSSW = /mnt/t3nfs01/data01/shome/bianchi/TTH-76X-heppy/CMSSW/src/
INC_DIR = ./
CXX =g++
LD =g++
CXXFLAGS =-O2 -ggdb -std=gnu++0x -Wall
LDFLAGS =-lz -lm
SOFLAGS =-fPIC -shared
SHELL =bash
###
SrcSuf = cpp
HeadSuf = h
ObjSuf = o
DepSuf = d
DllSuf = so
StatSuf = a
## Packages =controller testDataTypeServer testDataTypeClient testDataType testXMLLib testUInt
## Objects =Daemon EventBuilder Handler Logger Profiler Configurator ControlManager ConnectionManager Utility HwManager AsyncUtils BoardConfig
CppTestFiles=$(wildcard test/*.$(SrcSuf))
Packages=$(patsubst test/%.$(SrcSuf),%,$(CppTestFiles) )
CppSrcFiles=$(wildcard src/*.$(SrcSuf))
Objects=$(patsubst src/%.$(SrcSuf),%,$(CppSrcFiles))
LibName =Code
### ----- OPTIONS ABOVE ----- ####
#InfoLine = \033[01\;31m compiling $(1) \033[00m
InfoLine = compiling $(1)
BASEDIR=$(shell pwd)
BINDIR=$(BASEDIR)/bin
LIBDIR=$(BASEDIR)/libs
SRCDIR = $(BASEDIR)/src
HDIR = $(BASEDIR)/interface
MEM = -lopenloops -lbar -lcoli -lpphttxcallme2born -lppttxbbxcallme2born -lppttxjcallme2born -lMathMore -lLHAPDF -lTreePlayer -lRooFit -lRooFitCore -lHtml -lMinuit
### Main Target, first
.PHONY: all
all: info $(Packages) | $(BINDIR)
CXXFLAGS +=`root-config --cflags`
LDFLAGS +=`root-config --libs`
CXXFLAGS += $(MEM)
BINOBJ =$(patsubst %,$(BINDIR)/%.$(ObjSuf),$(Objects) )
SRCFILES=$(patsubst %,$(SRCDIR)/%.$(SrcSuf),$(Objects) )
HFILES =$(patsubst %,$(HDIR)/%.$(HeadSuf),$(Objects) )
StatLib =$(BINDIR)/Code.$(StatSuf)
SoLib =$(BINDIR)/Code.$(DllSuf)
.PRECIOUS:*.ObjSuf *.DepSuf *.DllSuf
Deps=$(patsubst %,$(BINDIR)/%.$(DepSuf),$(Objects) $(Packages) )
############### EXPLICIT RULES ###############
$(BINDIR):
mkdir -p $(BINDIR)
info:
@echo "--------------------------"
@echo "Compile on $(shell hostname)"
@echo "Packages are: $(Packages)"
@echo "Objects are: $(Objects)"
@echo "--------------------------"
@echo "DEBUG:"
$(StatLib): $(BINOBJ)
ar rcs $@ $(BINOBJ)
.PHONY: soLib
soLib: $(SoLib)
$(SoLib): $(StatLib)
$(LD) $(LDFLAGS) $(SOFLAGS) -o $@ $^
.PHONY: $(Packages)
$(Packages): % : $(BINDIR)/% | $(BINDIR)
@echo $(call InfoLine , $@ )
#$(BINDIR)/$(Packages): $(BINDIR)/% : $(BASEDIR)/test/%.$(SrcSuf) $(StatLib) | $(BINDIR)
$(addprefix $(BINDIR)/,$(Packages)): $(BINDIR)/% : $(BASEDIR)/test/%.$(SrcSuf) $(StatLib) | $(BINDIR)
@echo $(call InfoLine , $@ )
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $< $(StatLib) -I$(INC_DIR) -I$(HDIR) -I$(INC_DIR_CMSSW) -L$(LIBDIR) -L$(ROOTSYS)/lib
#make this function of $(Packages)
#.PHONY: controller
#controller: bin/controller
#bin/controller: test/controller.cpp $(BINOBJ) $(StatLib)
# $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(BINOBJ) $<
.PHONY: clean
clean:
-rm -v bin/*.$(ObjSuf)
-rm -v bin/*.$(DllSuf)
-rm -v bin/*.$(StatSuf)
############### IMPLICIT RULES ###############
#.o
%.$(ObjSuf): $(BINDIR)/%.$(ObjSuf)
#.o
$(BINDIR)/%.$(ObjSuf): $(SRCDIR)/%.$(SrcSuf) $(HDIR)/%.$(HeadSuf)
@echo $(call InfoLine , $@ )
$(CXX) $(CXXFLAGS) $(LDFLAGS) -c -o $@ $(SRCDIR)/$*.$(SrcSuf) -I$(INC_DIR) -I$(HDIR) -I$(INC_DIR_CMSSW) -L$(LIBDIR) -L$(ROOTSYS)/lib
#.d
$(BINDIR)/%.$(DepSuf): $(SRCDIR)/%.$(SrcSuf) $(HDIR)/%.$(HeadSuf)
@echo $(call InfoLine , $@ )
$(CXX) $(CXXFLAGS) $(LDFLAGS) -M -o $@ $(SRCDIR)/$*.$(SrcSuf) -I$(INC_DIR) -I$(HDIR) -I$(INC_DIR_CMSSW) -L$(LIBDIR) -L$(ROOTSYS)/lib
sed -i'' "s|^.*:|& Makefile $(BINDIR)/&|g" $@
#-include $(Deps)
# %.d: %.c
# $(SHELL) -ec '$(CC) -M \
# $(CPPFLAGS) $< | \
# sed '\''s/$*.o/& $@/g'\'' \
# > $@'
#