-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (48 loc) · 1.56 KB
/
Makefile
File metadata and controls
63 lines (48 loc) · 1.56 KB
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
SHELL=/bin/bash
SRC_DIR = src
OBJ_DIR = bld
EXE_DIR = exe
CXX = cc
OBJ = o
EXE = exe
CMP = g++
FLAGS = `root-config --cflags`
INCS = -I`root-config --incdir` #already included with root-config --cflags
LIBS = `root-config --evelibs` -lTMVA -lTMVAGui -lRooFitCore -lRooFitMore -lRooFit
SRCS = $(shell find $(SRC_DIR) -name *.$(CXX))
TRG_SRCS = $(shell grep --include=\*.$(CXX) -ilR "$(SRC_DIR)" -e "int main")
TRG_OBJS = $(patsubst $(SRC_DIR)/%.$(CXX),$(OBJ_DIR)/%.$(OBJ),$(TRG_SRCS))
TRG_EXES = $(patsubst $(SRC_DIR)/%.$(CXX),$(EXE_DIR)/%.$(EXE),$(TRG_SRCS))
ALL_OBJS = $(patsubst $(SRC_DIR)/%.$(CXX),$(OBJ_DIR)/%.$(OBJ),$(SRCS))
OFF_OBJS = $(filter-out $(TRG_OBJS),$(ALL_OBJS))
all: $(TRG_EXES)
$(TRG_EXES) : $(ALL_OBJS)
mkdir -p $(dir $@)
$(CMP) $(FLAGS) $(INCS) -o $@ $(patsubst $(EXE_DIR)/%.$(EXE),$(OBJ_DIR)/%.$(OBJ),$@) $(OFF_OBJS) $(LIBS)
$(OBJ_DIR)/%.$(OBJ): $(SRC_DIR)/%.$(CXX)
mkdir -p $(dir $@)
$(CMP) $(FLAGS) $(INCS) -c $< -o $@
.PHONY: clean
clean:
rm -rf $(OBJ_DIR)
rm -rf $(EXE_DIR)
.PHONY: srcs
srcs:
# list the path to each source relative to the root project directory
@echo $(SRCS)
.PHONY: all_objs
all_objs:
# list the path to each object relative to the root project directory
@echo $(ALL_OBJS)
.PHONY: trg_objs
trg_objs:
# list the path to each object corresponding to a program, relative to the root project directory
@echo $(TRG_OBJS)
.PHONY: off_objs
off_objs:
# list the path to each object not corresponding to a program, relative to the root project directory
@echo $(OFF_OBJS)
.PHONY: trgs
trgs:
# list all target programs to make
@echo $(TRGS)