-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeFile.bak
45 lines (38 loc) · 1.44 KB
/
MakeFile.bak
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
# MAINSOURCE代表含有main入口函数的cpp文件,因为含有测试代码,
# 所以要为多个目标编译,这里把Makefile写的通用了一点,
# 以后加东西Makefile不用做多少改动
MAINSOURCE := Main.cpp base/tests/LoggingTest.cpp tests/HTTPClient.cpp
# MAINOBJS := $(patsubst %.cpp,%.o,$(MAINSOURCE))
SOURCE := $(wildcard *.cpp base/*.cpp tests/*.cpp)
override SOURCE := $(filter-out $(MAINSOURCE),$(SOURCE))
OBJS := $(patsubst %.cpp,%.o,$(SOURCE))
TARGET := WebServer
CC := g++
LIBS := -lpthread -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_imgcodecs
INCLUDE:= -I./usr/local/lib
CFLAGS := -std=c++11 -g -Wall -O3 -D_PTHREADS
CXXFLAGS:= $(CFLAGS)
# Test object
SUBTARGET1 := LoggingTest
SUBTARGET2 := HTTPClient
.PHONY : objs clean veryclean rebuild all tests debug
all : $(TARGET) $(SUBTARGET1) $(SUBTARGET2)
objs : $(OBJS)
rebuild: veryclean all
tests : $(SUBTARGET1) $(SUBTARGET2)
clean :
find . -name '*.o' | xargs rm -f
veryclean :
find . -name '*.o' | xargs rm -f
find . -name $(TARGET) | xargs rm -f
find . -name $(SUBTARGET1) | xargs rm -f
find . -name $(SUBTARGET2) | xargs rm -f
debug:
@echo $(SOURCE)
$(TARGET) : $(OBJS) Main.o
$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
# $@代表目标,这里是$(TARGET)
$(SUBTARGET1) : $(OBJS) base/tests/LoggingTest.o
$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)
$(SUBTARGET2) : $(OBJS) tests/HTTPClient.o
$(CC) $(CXXFLAGS) -o $@ $^ $(LDFLAGS) $(LIBS)