-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
executable file
·110 lines (93 loc) · 2.87 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
# Variables
CC := g++ -g -std=c++11
DEF := -DMAKE_SW_VERSION=\"kpixSw_3.10\"
BIN := $(PWD)/bin
OBJ := $(PWD)/.obj
XMLC := xml2-config
CFLAGS := -Wall `$(XMLC) --cflags` -I$(PWD)/generic -I$(PWD)/kpix -I$(PWD)/offline -I$(PWD)/deviceLib -fPIC
LFLAGS := `$(XMLC) --libs` -pthread -lrt -lbz2
SYSLIB := /usr/local/lib/kpix1
SYSINC := /usr/local/include/kpix1
# Generic Sources
GEN_DIR := $(PWD)/generic
GEN_SRC := $(wildcard $(GEN_DIR)/*.cpp)
GEN_HDR := $(wildcard $(GEN_DIR)/*.h)
GEN_OBJ := $(patsubst $(GEN_DIR)/%.cpp,$(OBJ)/%.o,$(GEN_SRC))
# Device Lib Sources
#DEV_DIR := $(PWD)/deviceLib
#DEV_SRC := $(wildcard $(DEV_DIR)/*.cpp)
#DEV_HDR := $(wildcard $(DEV_DIR)/*.h)
#DEV_OBJ := $(patsubst $(DEV_DIR)/%.cpp,$(OBJ)/%.o,$(DEV_SRC))
# Kpix Sources
KPX_DIR := $(PWD)/kpix
KPX_SRC := $(wildcard $(KPX_DIR)/*.cpp)
KPX_HDR := $(wildcard $(KPX_DIR)/*.h)
KPX_OBJ := $(patsubst $(KPX_DIR)/%.cpp,$(OBJ)/%.o,$(KPX_SRC))
# Util Sources
UTL_DIR := $(PWD)/util
UTL_SRC := $(wildcard $(UTL_DIR)/*.cpp)
UTL_BIN := $(patsubst $(UTL_DIR)/%.cpp,$(BIN)/%,$(UTL_SRC))
# Default
min: dir $(GEN_OBJ) $(KPX_OBJ) $(UTL_BIN) gui libkpix.so
# working point: kpix onlineGui can only work with old qwt libs which were already replaced by and updated in the current database.
# can be fixed by mannually debugging everywhere... (todo: mengqing @Nov27)
all: dir $(GEN_OBJ) $(KPX_OBJ) $(UTL_BIN) gui online pylibs libkpix.so
norm: dir $(GEN_OBJ) $(KPX_OBJ) $(UTL_BIN) gui online pylibs
share: dir $(GEN_OBJ) $(KPX_OBJ) $(UTL_BIN) libkpix.so
install:
test -d $(SYSLIB) || mkdir $(SYSLIB)
cp libkpix.so $(SYSLIB)
test -d $(SYSINC) || mkdir $(SYSINC)
cp ./generic/*.h ./kpix/*.h $(SYSINC)
# Object directory
dir:
test -d $(OBJ) || mkdir $(OBJ)
test -d $(BIN) || mkdir $(BIN)
# Clean
clean:
# rm -rf $(OBJ)
rm -r ./.obj
# rm -f $(BIN)/*
rm ./bin/*
cd cntrlGui; qmake; make clean
# cd root; make clean
cd python; make clean
#ifneq ($(QWTDIR),)
cd onlineGui; qmake; make clean
#endif
# Compile Common Sources
$(OBJ)/%.o: $(GEN_DIR)/%.cpp $(GEN_DIR)/%.h
$(CC) -c $(CFLAGS) $(DEF) -o $@ $<
# Compile Generic Sources
#$(OBJ)/%.o: $(DEV_DIR)/%.cpp $(DEV_DIR)/%.h
# $(CC) -c $(CFLAGS) $(DEF) -o $@ $<
# Compile Tracker Sources
$(OBJ)/%.o: $(KPX_DIR)/%.cpp $(KPX_DIR)/%.h
$(CC) -c $(CFLAGS) $(DEF) -o $@ $<
# Comile utilities
#$(BIN)/%: $(UTL_DIR)/%.cpp $(GEN_OBJ) $(DEV_OBJ) $(KPX_OBJ)
$(BIN)/%: $(UTL_DIR)/%.cpp $(GEN_OBJ) $(KPX_OBJ)
$(CC) $(CFLAGS) $(DEF) $(OBJ)/* -o $@ $< $(LFLAGS)
# Compile all c-level code to a shared lib for EUDAQ: wmq@15-Jun-2017
libkpix.so: $(GEN_OBJ) $(KPX_OBJ)
$(CC) -shared -fPIC $(CFLAGS) $(DEF) $(OBJ)/* -o $@ $(LFLAGS)
# root
# ana:
# #ifneq ($(ROOTSYS),)
# cd root; make
# #endif
# python libs
pylibs:
ifneq ($(PYTHONPATH),)
cd python; make
endif
# Compile gui
gui:
cd cntrlGui; qmake
cd cntrlGui; make
# online gui
online:
#ifneq ($(QWTDIR),)
cd onlineGui; qmake
cd onlineGui; make
#endif