forked from zoranzhao/DeepThings
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (57 loc) · 1.59 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
72
73
74
OPENMP=0
NNPACK=1
ARM_NEON=1
DEBUG=0
VPATH=./src
DISTRIOT=./distriot
DARKNET=./darknet-nnpack
OBJDIR=./obj/
EXEC=deepthings
DARKNETLIB=libdarknet.a
DISTRIOTLIB=libdistriot.a
CC=gcc
LDFLAGS= -lm -pthread
CFLAGS=-Wall -fPIC
COMMON=-I$(DISTRIOT)/include/ -I$(DISTRIOT)/src/ -I$(DARKNET)/include/ -I$(DARKNET)/src/ -Iinclude/ -Isrc/
LDLIB=-L$(DISTRIOT) -l:$(DISTRIOTLIB) -L$(DARKNET) -l:$(DARKNETLIB)
ifeq ($(OPENMP), 1)
CFLAGS+= -fopenmp
endif
ifeq ($(DEBUG), 1)
OPTS+=-O0 -g
else
OPTS+=-Ofast
endif
ifeq ($(NNPACK), 1)
COMMON+= -DNNPACK
CFLAGS+= -DNNPACK
LDFLAGS+= -lnnpack -lpthreadpool
endif
ifeq ($(ARM_NEON), 1)
COMMON+= -DARM_NEON
CFLAGS+= -DARM_NEON -mfpu=neon-vfpv4 -funsafe-math-optimizations -ftree-vectorize
endif
CFLAGS+=$(OPTS)
OBJS = top.o ftp.o inference_engine_helper.o frame_partitioner.o adjacent_reuse_data_serialization.o self_reuse_data_serialization.o deepthings_edge.o deepthings_gateway.o cmd_line_parser.o
EXECOBJ = $(addprefix $(OBJDIR), $(OBJS))
DEPS = $(wildcard */*.h) Makefile
all: obj $(EXEC)
$(EXEC): $(EXECOBJ) $(DARKNETLIB) $(DISTRIOTLIB)
$(CC) $(COMMON) $(CFLAGS) $(EXECOBJ) -o $@ $(LDLIB) $(LDFLAGS)
$(DARKNETLIB):
$(MAKE) -C $(DARKNET) NNPACK=$(NNPACK) ARM_NEON=$(ARM_NEON) DEBUG=$(DEBUG) OPENMP=$(OPENMP) all
$(DISTRIOTLIB):
$(MAKE) -C $(DISTRIOT) DEBUG=$(DEBUG) all
$(OBJDIR)%.o: %.c $(DEPS)
$(CC) $(COMMON) $(CFLAGS) -c $< -o $@
obj:
mkdir -p obj
test:
./deepthings ${ARGS}
.PHONY: clean clean_all
clean_all:
make -C $(DISTRIOT) clean
make -C $(DARKNET) clean
rm -rf $(EXEC) $(EXECOBJ) *.log $(OBJDIR) *.png
clean:
rm -rf $(EXEC) $(EXECOBJ) *.log $(OBJDIR) *.png