-
-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathMakefile.tflite
49 lines (41 loc) · 1.15 KB
/
Makefile.tflite
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
SRCS = \
c_api.cc \
c_api_experimental.cc
OBJS = $(subst .cc,.o,$(subst .cxx,.o,$(subst .cpp,.o,$(SRCS))))
TENSORFLOW_ROOT = $(shell go env GOPATH)/src/github.com/tensorflow/tensorflow
CXXFLAGS := -fPIC -DTF_COMPILE_LIBRARY -I$(TENSORFLOW_ROOT) \
-I$(TENSORFLOW_ROOT)/tensorflow/lite/tools/make/downloads/flatbuffers/include \
-I$(TENSORFLOW_ROOT)/tensorflow/lite/tools/make/downloads/absl
TARGET = libtensorflowlite_c
ifeq ($(OS),Windows_NT)
OS_ARCH = windows_x86_64
TARGET_SHARED := $(TARGET).dll
else
ifeq ($(shell uname -s),Darwin)
CXXFLAGS := -std=c++11 $(CXXFLAGS)
OS_ARCH = osx_$(shell uname -m)
else
ifeq ($(shell uname -m),x86_64)
OS_ARCH = linux_x86_64
else
ifeq ($(shell uname -m),armv6l)
OS_ARCH = linux_armv6l
else
OS_ARCH = rpi_armv7l
endif
endif
endif
TARGET_SHARED := $(TARGET).so
endif
LDFLAGS += -L$(TENSORFLOW_ROOT)/tensorflow/lite/tools/make/gen/$(OS_ARCH)/lib
LIBS = -ltensorflow-lite
.SUFFIXES: .cpp .cxx .o
all : $(TARGET_SHARED)
$(TARGET_SHARED) : $(OBJS)
g++ -shared -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
.cxx.o :
g++ -std=c++14 -c $(CXXFLAGS) -I. $< -o $@
.cpp.o :
g++ -std=c++14 -c $(CXXFLAGS) -I. $< -o $@
clean :
rm -f *.o $(TARGET_SHARED)