-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
61 lines (43 loc) · 1.27 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
CXX := g++
AR := ar
CXXFLAGS := -std=c++0x -O3 -w #-DDEBUG
CPPFLAGS := -Iinclude
CPPTESTFLAGS :=
TEST_LIBS := -lgtest -lpthread
SRC := src
OBJ := obj
TEST_SRC := tests
SRCS=$(wildcard $(SRC)/*.cpp)
OBJS=$(SRCS:$(SRC)/%.cpp=$(SRC)/%.o)
TEST_SRCS=$(wildcard $(TEST_SRC)/*.cpp)
TEST_OBJS=$(TEST_SRCS:$(TEST_SRC)/%.cpp=$(TEST_SRC)/%.o)
GI := GI
LIBGI := libgi.a
TESTP := test_run
GRAPH := yeast
INPUT1 := ./input/lcc_$(GRAPH).igraph
INPUT2 := ./input/sfl_lcc_$(GRAPH).igraph
.PHONY: all clean run
all: $(GI)
$(GI): $(SRC)/program.cpp $(LIBGI)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(SRC)/program.cpp -o $(SRC)/program.o
$(CXX) $(CXXFLAGS) $(SRC)/program.o libgi.a -o $@
$(LIBGI): $(OBJS)
$(AR) rc $(LIBGI) $(OBJS)
$(SRC)/%.o: $(SRC)/%.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@
$(TESTP): $(LIBGI) $(TEST_OBJS)
$(CXX) -o $(TESTP) $(TEST_OBJS) $(LIBGI) $(TEST_LIBS)
$(TEST_SRC)/%.o: $(TEST_SRC)/%.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(CPPTESTFLAGS) -c $< -o $@
example: examples/example.cpp $(LIBGI)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c examples/example.cpp -o examples/example.o
$(CXX) $(CXXFLAGS) examples/example.o libgi.a -o $@
clean:
$(RM) -rv $(GI)
$(RM) -rv $(LIBGI) $(OBJS)
$(RM) -rv $(TEST_OBJS) $(TESTP)
run: $(GI)
./$(GI) $(INPUT1) $(INPUT2)
test: $(TESTP)
./$(TESTP)