onnxruntime-tvm/nnvm/Makefile

107 строки
2.4 KiB
Makefile
Исходник Обычный вид История

ROOTDIR = $(CURDIR)
ifndef config
ifneq ("$(wildcard ./config.mk)", "")
config = config.mk
else
config = make/config.mk
endif
endif
include $(config)
2016-07-05 21:23:49 +03:00
export LDFLAGS = -pthread -lm
2017-01-27 01:22:17 +03:00
export CFLAGS = -std=c++11 -Wall -O2 -Iinclude -fPIC
CFLAGS += -Itvm/include -Itvm/dlpack/include -Itvm/HalideIR/src -Itvm/topi/include
2016-06-23 07:00:50 +03:00
ifdef DMLC_CORE_PATH
CFLAGS += -I$(DMLC_CORE_PATH)/include
else
CFLAGS += -I$(ROOTDIR)/dmlc-core/include
endif
ifdef DMLC_CORE_PATH
CFLAGS += -I$(DMLC_CORE_PATH)/include
else
CFLAGS += -I$(ROOTDIR)/dmlc-core/include
endif
ifneq ($(ADD_CFLAGS), NONE)
CFLAGS += $(ADD_CFLAGS)
endif
ifneq ($(ADD_LDFLAGS), NONE)
LDFLAGS += $(ADD_LDFLAGS)
endif
# plugin
PLUGIN_OBJ =
include $(NNVM_PLUGINS)
2016-06-23 07:00:50 +03:00
# specify tensor path
.PHONY: clean all test lint cpplint pylint doc cython cython3 cyclean
2016-06-23 07:00:50 +03:00
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S), Darwin)
SHARED_LIBRARY_SUFFIX := dylib
WHOLE_ARCH= -all_load
NO_WHOLE_ARCH= -noall_load
LDFLAGS += -undefined dynamic_lookup
else
SHARED_LIBRARY_SUFFIX := so
WHOLE_ARCH= --whole-archive
NO_WHOLE_ARCH= --no-whole-archive
endif
all: lib/libnnvm.a lib/libnnvm_compiler.$(SHARED_LIBRARY_SUFFIX)
2017-09-08 22:36:16 +03:00
SRC = $(wildcard src/*.cc src/c_api/*.cc src/core/*.cc src/pass/*.cc)
SRC_COMPILER = $(wildcard src/top/*/*.cc wildcard src/top/vision/*/*.cc src/compiler/*.cc src/compiler/*/*.cc)
ALL_OBJ = $(patsubst %.cc, build/%.o, $(SRC))
TOP_OBJ = $(patsubst %.cc, build/%.o, $(SRC_COMPILER))
2017-09-08 22:36:16 +03:00
ALL_DEP = $(ALL_OBJ)
2016-07-05 21:23:49 +03:00
include tests/cpp/unittest.mk
test: $(TEST)
2016-06-23 07:00:50 +03:00
build/src/%.o: src/%.cc
2016-06-23 07:00:50 +03:00
@mkdir -p $(@D)
$(CXX) $(CFLAGS) -MM -MT build/src/$*.o $< >build/src/$*.d
2016-06-23 07:00:50 +03:00
$(CXX) -c $(CFLAGS) -c $< -o $@
2016-07-10 20:55:50 +03:00
lib/libnnvm.a: $(ALL_DEP)
2016-07-05 21:23:49 +03:00
@mkdir -p $(@D)
$(AR) crv $@ $(filter %.o, $?)
2016-07-05 21:23:49 +03:00
lib/libnnvm_compiler.$(SHARED_LIBRARY_SUFFIX): lib/libnnvm.a ${TOP_OBJ}
@mkdir -p $(@D)
2017-09-08 22:36:16 +03:00
$(CXX) $(CFLAGS) -shared -o $@ $(filter %.o, $^) $(LDFLAGS) -Wl,${WHOLE_ARCH} lib/libnnvm.a -Wl,${NO_WHOLE_ARCH}
2016-06-23 07:00:50 +03:00
cython:
cd python; python setup.py build_ext --inplace
cython3:
cd python; python3 setup.py build_ext --inplace
cyclean:
rm -rf python/nnvm/*/*.so python/nnvm/*/*.dylib python/nnvm/*/*.cpp
lint: pylint cpplint
cpplint:
2017-09-08 22:36:16 +03:00
python dmlc-core/scripts/lint.py nnvm cpp include src
2016-07-02 21:21:10 +03:00
pylint:
pylint python/nnvm --rcfile=$(ROOTDIR)/tests/lint/pylintrc
2016-07-02 21:21:10 +03:00
doc:
doxygen docs/Doxyfile
2016-06-23 07:00:50 +03:00
clean:
2016-07-05 21:23:49 +03:00
$(RM) -rf build lib bin *~ */*~ */*/*~ */*/*/*~ */*.o */*/*.o */*/*/*.o cli_test
2016-06-23 07:00:50 +03:00
-include build/*.d
-include build/*/*.d
2017-05-26 00:36:10 +03:00
-include build/*/*/*.d