-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
executable file
·56 lines (36 loc) · 1.34 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
BUILD_DIR = build
SRC_DIR = src
BIN_DIR = bin
CFLAGS = -Winline -O2 -std=c++0x -g
#CFLAGS = -Winline -DDEBUG_MESSAGE -O0 -std=c++0x -g
SOURCES_TMP += Isolates4.cpp
SOURCES_TMP += GraphTools.cpp
SOURCES_TMP += PhasedLocalSearch.cpp
SOURCES_TMP += CliquePhasedLocalSearch.cpp
SOURCES_TMP += IndependentSetPhasedLocalSearch.cpp
SOURCES_TMP += Tools.cpp
SOURCES=$(addprefix $(SOURCES_DIR)/, $(SOURCES_TMP))
OBJECTS_TMP=$(SOURCES_TMP:.cpp=.o)
OBJECTS=$(addprefix $(BUILD_DIR)/, $(OBJECTS_TMP))
DEPFILES_TMP:=$(SOURCES_TMP:.cpp=.d)
DEPFILES=$(addprefix $(BUILD_DIR)/, $(DEPFILES_TMP))
EXEC_NAMES = pls
EXECS = $(addprefix $(BIN_DIR)/, $(EXEC_NAMES))
#set CXX to generic g++ if not set.
CXX ?= g++
VPATH = src
.PHONY : all
all: $(EXECS)
.PHONY : clean
clean:
rm -rf $(EXECS) $(BUILD_DIR) $(BIN_DIR)
$(BIN_DIR)/pls: main.cpp ${OBJECTS} makefile | ${BIN_DIR}
$(CXX) $(CFLAGS) -D GIT_COMMIT=`git log --format="%H" -n 1` -D GIT_STATUS="`git status -s -uno`" ${DEFINE} ${OBJECTS} $(SRC_DIR)/main.cpp -o $@
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp $(SRC_DIR)/%.h $(BUILD_DIR)/%.d makefile | $(BUILD_DIR)
$(CXX) $(CFLAGS) ${DEFINE} -c $< -o $@
$(BUILD_DIR)/%.d: $(SRC_DIR)/%.cpp makefile | $(BUILD_DIR)
$(CXX) $(CFLAGS) -MM -MT '$(patsubst $(SRC_DIR)/%.cpp,$(BUILD_DIR)/%.o,$<)' $< -MF $@
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
$(BIN_DIR):
mkdir -p $(BIN_DIR)