-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
71 lines (53 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
61
62
63
64
65
66
67
68
69
70
71
#
# $File: Makefile
# $Date: Thu Jun 27 02:56:32 2013 +0800
#
# A single output portable Makefile for
# simple c++ project
OBJ_DIR = obj
BIN_DIR = bin
TARGET = o_O
BIN_TARGET = $(BIN_DIR)/$(TARGET)
INCLUDE_DIR = -I src/include
DEFINES = -D__DEBUG_BUILD
CXXFLAGS += -O3
#CXXFLAGS += -g -O0
#CXXFLAGS += -pg
CXXFLAGS += #$(DEFINES)
CXXFLAGS += -std=c++11
CXXFLAGS += -Wall -Wextra
CXXFLAGS += $(INCLUDE_DIR)
CXXFLAGS += $(shell pkg-config --libs --cflags opencv)
CXXFLAGS += -pthread
#CXXFLAGS += -lpthread
CXXFLAGS += -fopenmp
LDFLAGS =
CXX = g++ -msse2
CXXSOURCES = $(shell find src/ -name "*.cc")
OBJS = $(addprefix $(OBJ_DIR)/,$(CXXSOURCES:.cc=.o))
DEPFILES = $(OBJS:.o=.d)
.PHONY: all clean run rebuild gdb
all: $(BIN_TARGET)
$(OBJ_DIR)/%.o: %.cc
@echo "[cc] $< ..."
@$(CXX) -c $< $(CXXFLAGS) -o $@
$(OBJ_DIR)/%.d: %.cc
@mkdir -pv $(dir $@)
@echo "[dep] $< ..."
@$(CXX) $(INCLUDE_DIR) $(CXXFLAGS) -MM -MT "$(OBJ_DIR)/$(<:.cc=.o) $(OBJ_DIR)/$(<:.cc=.d)" "$<" > "$@"
sinclude $(DEPFILES)
$(BIN_TARGET): $(OBJS)
@echo "[link] $< ..."
@mkdir -p $(BIN_DIR)
@$(CXX) $(OBJS) -o $@ $(LDFLAGS) $(CXXFLAGS)
clean:
rm -rf $(OBJ_DIR) $(BIN_DIR)
run: $(BIN_TARGET)
./$(BIN_TARGET)
rebuild:
+@make clean
+@make
gdb: $(BIN_TARGET)
gdb ./$(BIN_TARGET)
show:
geeqie output.png