-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
executable file
·57 lines (37 loc) · 1.11 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
ifndef CXXFLAGS
CXXFLAGS = -O3 -Wno-format
endif
CXXFLAGS += -MMD -ISNAPLib -msse
LDFLAGS += -pthread
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
LIBS += -lrt -lz
endif
ifeq ($(UNAME), Darwin)
LIBS += -lz
endif
CXX = g++
LIB_SRC = $(wildcard SNAPLib/*.cpp)
LIB_OBJ = $(patsubst %.cpp, %.o, $(LIB_SRC))
SNAP_SRC = $(wildcard apps/snap/*.cpp)
TEST_SRC = $(wildcard tests/*.cpp)
ROC_SRC = $(wildcard apps/ComputeROC/*.cpp)
SNAP_OBJ = $(patsubst %.cpp, %.o, $(SNAP_SRC))
TEST_OBJ = $(patsubst %.cpp, %.o, $(TEST_SRC))
ROC_OBJ = $(patsubst %.cpp, %.o, $(ROC_SRC))
ALL_OBJ = $(LIB_OBJ) $(SNAP_OBJ) $(TEST_OBJ)
DEPS = $(pathsubst %.o, %.d, $(ALL_OBJ))
EXES = snapr unit_tests
default: $(EXES)
-include $(pathsubst %.o, %.d, $(ALL_OBJ))
$(OBJS): %.o : %.cpp
$(CXX) -o $@ $(CXXFLAGS) -c $<
snapr: $(LIB_OBJ) $(SNAP_OBJ)
$(CXX) -o $@ $(CXXFLAGS) -Itests $(LDFLAGS) $^ $(LIBS)
roc: $(LIB_OBJ) $(ROC_OBJ)
$(CXX) -o $@ $(CXXFLAGS) -Itests $(LDFLAGS) $^ $(LIBS)
unit_tests: $(LIB_OBJ) $(TEST_OBJ)
$(CXX) -o $@ $(CXXFLAGS) -Itests $(LDFLAGS) $^ $(LIBS)
clean:
rm -f $(ALL_OBJ) $(DEPS) $(EXES)
.phony: clean default