-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathMakefile
70 lines (54 loc) · 1.57 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
#****************************************
# Makefile for timer-sense-light project.
# Author: Darran Zhang @ codelast.com
#****************************************
# DEBUG can be set to YES to include debugging info, or NO otherwise
DEBUG = NO
CC = gcc
CXX = g++
BASIC_FLAG = -Wall
ifeq (YES, ${DEBUG})
FLAG = ${BASIC_FLAG} -g -DDEBUG
else
FLAG = ${BASIC_FLAG}
endif
BASIC_INCLUDE_PATH = -I./include
CXXFLAGS = ${FLAG} \
${BASIC_INCLUDE_PATH} \
${BASIC_INCLUDE_PATH}/3rd \
${BASIC_INCLUDE_PATH}/test
CFLAGS = ${CXXFLAGS}
LDFLAGS = -lpthread -lconfig++ -lglog -lwiringPi
C_SOURCE_FILE = ./src/3rd/mongoose.c
CXX_SOURCE_FILE = ./src/timer_sense_light.cpp \
./src/config_loader.cpp \
./src/util.cpp
C_OBJECT = ./src/3rd/mongoose.o
# compile the main executable program
timer_sense_light:
$(CC) $(C_SOURCE_FILE) -c -o ${C_OBJECT} $(CFLAGS)
$(CXX) ${C_OBJECT} $(CXX_SOURCE_FILE) -o $@ $(CXXFLAGS) ${LDFLAGS}
# deploy the project to a directory
install:
rm -rf deploy
mkdir -p deploy/conf
mkdir -p deploy/script
cp -f script/* deploy/script
mv -f timer_sense_light deploy
cp -f conf/* deploy/conf
cp -rf web-root deploy
# unit test dependency source
UT_CXX_SOURCE_FILE = ./src/test/gtest_main.cc \
./src/config_loader.cpp \
./src/util.cpp
# compile the unit test runner
ut_runner:
$(CXX) $(UT_CXX_SOURCE_FILE) -o $@ $(CXXFLAGS) ${LDFLAGS} -lgtest
# compile & run the unit test
test: ut_runner
./ut_runner
.PHONY: test
.PHONY: clean
clean:
rm -f timer_sense_light ut_runner *.o ./src/*.o ./src/3rd/*.o
rm -rf ./deploy