-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
50 lines (39 loc) · 1.47 KB
/
Makefile
File metadata and controls
50 lines (39 loc) · 1.47 KB
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
lang_flags = -std=c++0x -Werror -Wall
#lang_flags = -Werror -Wall
#CXXFLAGS += $(lang_flags) -g -save-temps
CXXFLAGS += $(lang_flags) -g -O3 -pthread
incl_path = -Iinclude -I/opt/opencv/include
CPPFLAGS += -MMD -MP $(incl_path)
#CPPFLAGS += -MMD -MP $(incl_path) -D_GLIBCXX_DEBUG
LIB_SRC = $(wildcard src/*.cpp)
TEST_SRC = $(wildcard test/*.cpp)
#hardcode location of opencv libs into executables...
LDFLAGS = -Wl,-R/opt/opencv/lib -pthread
LDLIBS = -L/opt/opencv/lib -lopencv_core -lopencv_contrib -lopencv_calib3d \
-lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui \
-lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree \
-pthread
all: objrec TAGS #run_tests
.PHONY: all
TAGS: objrec #test/test
ctags -eR --languages=-Java main.cpp include src test ~/src/opencv
objrec: main.cpp src/libobjrec.a
g++ $(LDFLAGS) $(CXXFLAGS) $(CPPFLAGS) -o $@ main.cpp -Lsrc -lobjrec $(LDLIBS)
-include objrec.d
src/libobjrec.a: $(LIB_SRC:%.cpp=%.o)
$(AR) $(ARFLAGS) $@ $^
-include $(LIB_SRC:%.cpp=%.d)
check-syntax:
g++ -o nul -S ${lang_flags} ${incl_path} ${CHK_SOURCES}
test/test: $(TEST_SRC:%.cpp=%.o) src/libobjrec.a
g++ $(LDFLAGS) -o $@ $^ $(shell gtest-config --ldflags --libs) $(LDLIBS)
-include $(TEST_SRC:%.cpp=%.d)
run_tests: test/test
./test/test
.PHONY: run_tests
clean:
rm -f main.o objrec objrec.d TAGS
rm -f $(LIB_SRC:%.cpp=%.o) $(LIB_SRC:%.cpp=%.d) src/libobjrec.a
rm -f $(TEST_SRC:%.cpp=%.o) $(TEST_SRC:%.cpp=%.d) test/test
rm -f *.ii *.s
.PHONY: clean