-
Notifications
You must be signed in to change notification settings - Fork 11
/
makefile
71 lines (49 loc) · 1.35 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
INC_DIR = ./include
SRC_DIR = ./src
OBJ_DIR = ./obj
LIB_DIR = ./lib
BIN_DIR = ./bin
UTILS_SRC = $(wildcard ${SRC_DIR}/utils/*.cpp)
UTILS_OBJ = $(patsubst %.cpp,${OBJ_DIR}/%.o,$(notdir ${UTILS_SRC}))
HDRNET_SRC = $(wildcard ${SRC_DIR}/hdrnet/*.cpp)
HDRNET_OBJ = $(patsubst %.cpp,${OBJ_DIR}/%.o,$(notdir ${HDRNET_SRC}))
CNN_SRC = $(wildcard ${SRC_DIR}/cnn/*.cpp)
CNN_OBJ = $(patsubst %.cpp,${OBJ_DIR}/%.o,$(notdir ${CNN_SRC}))
SO_NAME = hdrnet_api
SO_FILE = $(LIB_DIR)/lib$(SO_NAME).so
TARGET = main
BIN_TARGET = ${BIN_DIR}/${TARGET}
BIN_FILE = $(BIN_DIR)/${TARGET}.cpp
CC = g++
CFLAGS = -std=c++11 -O3 -Wall -fPIC -I${INC_DIR} -DMODEL_DIR=$(MODEL_DIR) -DDEBUG
# build main
${BIN_TARGET}: $(SO_FILE)
$(CC) $(CFLAGS) $(BIN_FILE) -L $(LIB_DIR) -l$(SO_NAME) -o $@ -ldl
# so file
$(SO_FILE): $(UTILS_OBJ) $(HDRNET_OBJ) $(CNN_OBJ)
mkdir -p $(LIB_DIR)
ld -shared $^ -o $@
# build
${OBJ_DIR}/%.o:${SRC_DIR}/hdrnet/%.cpp
mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) -c $^ -o $@
${OBJ_DIR}/%.o:${SRC_DIR}/utils/%.cpp
mkdir -p $(OBJ_DIR)
$(CC) $(CFLAGS) -c $^ -o $@
ndk-dll:
ndk-build -C ndk/dll/jni -B
ndk-main:
ndk-build -C ndk/main/jni -B
.PHONY:clean
clean:
-rm -rf $(OBJ_DIR)
-rm -rf $(LIB_DIR)
-rm $(BIN_TARGET)
-rm *.rgb
-rm *.rgb.jpg
-rm *.so
-rm script/*.pyc
-rm -rf ndk/dll/libs
-rm -rf ndk/dll/obj
-rm -rf ndk/main/libs
-rm -rf ndk/main/obj