forked from davidrmiller/biosim4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (60 loc) · 1.45 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
ifneq ($(BUILD),debug)
BUILD = release
endif
CXX = c++
LD = c++
CXXFLAGS += \
-Wall \
-pedantic \
-std=c++17 \
-fexceptions \
-fopenmp \
$(shell pkg-config --cflags opencv4)
LDFLAGS += \
-lopencv_core \
-lopencv_video \
-lopencv_videoio \
-lgomp \
-lpthread \
-fopenmp
ifeq ($(BUILD),debug)
OUT_DIR = bin/Debug/
OBJ_DIR = obj/Debug/src
CXXFLAGS += -g
else
OUT_DIR = bin/Release/
OBJ_DIR = obj/Release/src
CXXFLAGS += -O3
LDFLAGS += -O3 -s
endif
SOURCE := $(wildcard src/*.cpp src/*.h)
CXXSOURCE := $(filter %.cpp, $(SOURCE))
HEADERS := $(filter %.h, $(SOURCE))
OBJS := $(subst src/,$(OBJ_DIR)/, $(CXXSOURCE:.cpp=.o))
all: debug release
before_debug:
test -d bin/Debug || mkdir -p bin/Debug
test -d obj/Debug/src || mkdir -p obj/Debug/src
before_release:
test -d bin/Release || mkdir -p bin/Release
test -d obj/Release/src || mkdir -p obj/Release/src
.PHONY : release debug
debug: before_debug
@$(MAKE) --no-print-directory bin/Debug/biosim4 BUILD=$@
release: before_release
@$(MAKE) --no-print-directory bin/Release/biosim4 BUILD=$@
$(OUT_DIR)biosim4: $(OBJS)
$(LD) -o $@ $^ $(LDFLAGS)
$(OBJS): $(HEADERS)
$(OBJ_DIR)%.o : src%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
clean: clean_debug clean_release
clean_debug:
$(RM) -f obj/Debug/src/*
$(RM) -f bin/Debug/biosim4
clean_release:
$(RM) -f obj/Release/src/*
$(RM) -f bin/Release/biosim4
distclean: clean
$(RM) -f logs/* images/*
.PHONY: all clean distclean