diff options
author | Chunseok Lee <chunseok.lee@samsung.com> | 2020-03-05 15:10:09 +0900 |
---|---|---|
committer | Chunseok Lee <chunseok.lee@samsung.com> | 2020-03-05 15:22:53 +0900 |
commit | d91a039e0eda6fd70dcd22672b8ce1817c1ca50e (patch) | |
tree | 62668ec548cf31fadbbf4e99522999ad13434a25 /Makefile.template | |
parent | bd11b24234d7d43dfe05a81c520aa01ffad06e42 (diff) | |
download | nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.tar.gz nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.tar.bz2 nnfw-d91a039e0eda6fd70dcd22672b8ce1817c1ca50e.zip |
catch up to tizen_5.5 and remove unness dir
- update to tizen_5.5
- remove dirs
Diffstat (limited to 'Makefile.template')
-rw-r--r-- | Makefile.template | 183 |
1 files changed, 183 insertions, 0 deletions
diff --git a/Makefile.template b/Makefile.template new file mode 100644 index 000000000..a0ae361b8 --- /dev/null +++ b/Makefile.template @@ -0,0 +1,183 @@ +HOST_ARCH?=$(shell uname -p) +TARGET_ARCH?=$(shell uname -p) +BUILD_TYPE?=Debug +CROSS_BUILD?=0 +HOST_OS?=linux +TARGET_OS?=linux +PARALLEL_BUILD?=1 +## TODO: fix obs build break +OBS_BUILD?=OFF +COVERAGE_BUILD?=0 +BENCHMARK_ACL_BUILD?=0 +OPTIONS?= +GENERATE_NNAPI_TESTS?=1 +TFLITE_MAJOR_VER?=1 +TFLITE_MINOR_VER?=13 + +# make TARGET and TYPE to lowercase +HOST_ARCH_LC=$(shell echo $(HOST_ARCH) | tr A-Z a-z) +TARGET_ARCH_LC=$(shell echo $(TARGET_ARCH) | tr A-Z a-z) +BUILD_TYPE_LC=$(shell echo $(BUILD_TYPE) | tr A-Z a-z) +# we need base name 'arm` for all arm arch +TARGET_ARCH_BASE=$(TARGET_ARCH_LC) +ifneq (,$(findstring arm64,$(TARGET_ARCH_BASE))) + # arm64 as target-arch comes from Android + TARGET_ARCH_BASE=arm64 + # For now Android is the only option for arm64 + TARGET_OS:=android +else ifneq (,$(findstring arm,$(TARGET_ARCH_BASE))) + TARGET_ARCH_BASE=arm +else ifneq (,$(findstring aarch64,$(TARGET_ARCH_BASE))) + # aarch64 as target-arch comes from all except for Android + TARGET_ARCH_BASE=aarch64 +endif +# Set CROSS_BUILD=1 when ROOTFS_DIR is given, and TARGET_ARCH is different to HOST_ARCH. +ifneq ($(ROOTFS_DIR),) +ifneq ($(TARGET_ARCH_LC),$(HOST_ARCH_LC)) + CROSS_BUILD=$(if $(wildcard $(ROOTFS_DIR)),1,0) +endif +endif +# the toolchain file, only for cross build +ifeq ($(CROSS_BUILD),1) + TOOLCHAIN_FILE=cmake/buildtool/cross/toolchain_$(TARGET_ARCH_LC)-$(TARGET_OS).cmake + OPTIONS+= -DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) +endif + +ifeq ($(COVERAGE_BUILD),1) + OPTIONS+= -DENABLE_COVERAGE=ON +else + OPTIONS+= -DENABLE_COVERAGE=OFF +endif + +ifeq ($(BENCHMARK_ACL_BUILD),1) + OPTIONS+= -DBUILD_BENCHMARK_ACL=1 +endif + +ifneq ($(EXT_ACL_FOLDER),) + OPTIONS+= -DBUILD_ARMCOMPUTE=OFF + OPTIONS+= -DARMCompute_EXTDIR=$(EXT_ACL_FOLDER) +endif + +ifneq ($(EXTERNAL_VOLUME),) + OPTIONS+= -DNNFW_EXTERNALS_DIR=$(EXTERNAL_VOLUME) +endif + +ifneq ($(OBS_BUILD),OFF) + # Use pre-installed google test library + OPTIONS+= -DBUILD_GTEST=FALSE + OPTIONS+= -DBUILD_ARMCOMPUTE=FALSE + OPTIONS+= -DDOWNLOAD_ARMCOMPUTE=FALSE + OPTIONS+= -DDOWNLOAD_TENSORFLOW=FALSE + # Use pre-installed tensorflow lite library + OPTIONS+= -DBUILD_TENSORFLOW_LITE=FALSE + # Disable logging runtime build for Tizen + OPTIONS+= -DBUILD_LOGGING=FALSE + OPTIONS+= -DBUILD_TOOLS=FALSE + # Disable "tflite-run" and "tflite_benchmark_model" for Tizen + OPTIONS+= -DBUILD_TFLITE_RUN=FALSE + OPTIONS+= -DBUILD_TFLITE_BENCHMARK_MODEL=FALSE +endif + +ifeq ($(GENERATE_NNAPI_TESTS),1) + OPTIONS+= -DGENERATE_RUNTIME_NNAPI_TESTS=ON +endif + +ifeq ($(PARALLEL_BUILD),1) + # Get number of processors (linux only for now) + ifeq ($(HOST_OS),linux) + NPROCS?=$(shell grep -c ^processor /proc/cpuinfo) + endif +endif + +NPROCS?=1 +WORKHOME=Product +WORKFOLDER=$(TARGET_ARCH_LC)-$(TARGET_OS).$(BUILD_TYPE_LC) +WORKDIR=$(WORKHOME)/$(WORKFOLDER) + +BUILD_ROOT=$(WORKDIR)/obj +INSTALL_ROOT=$(WORKDIR)/out + +BUILD_FOLDER=$(WORKFOLDER)/obj +INSTALL_FOLDER=$(WORKFOLDER)/out +BUILD_ALIAS=$(WORKHOME)/obj +INSTALL_ALIAS=$(WORKHOME)/out + +INSTALL_PATH?=$(CURDIR)/$(WORKDIR)/out + +TIMESTAMP_CONFIGURE=$(WORKDIR)/CONFIGURE +TIMESTAMP_BUILD=$(WORKDIR)/BUILD +TIMESTAMP_INSTALL=$(WORKDIR)/INSTALL + +all: build + +### +### Command (public) +### +configure: configure_internal + +build: build_internal + +install: $(TIMESTAMP_INSTALL) + +clean: + rm -rf $(WORKDIR) + +distclean: + rm -rf $(WORKDIR) + rm -rf externals/*.stamp + rm -rf tests/nnapi/src/generated/ + +### +### Command (internal) +### +configure_internal: + NNFW_BUILD_DIR="$(CURDIR)/$(BUILD_ROOT)" NNFW_INSTALL_PREFIX=$(INSTALL_PATH) ./nnfw configure \ + -DCMAKE_BUILD_TYPE=$(BUILD_TYPE_LC) -DTARGET_ARCH=$(TARGET_ARCH_LC) \ + -DHOST_OS=$(HOST_OS) \ + -DTARGET_OS=$(TARGET_OS) \ + -DTFLITE_MAJOR_VER=$(TFLITE_MAJOR_VER) \ + -DTFLITE_MINOR_VER=$(TFLITE_MINOR_VER) \ + $(OPTIONS) + touch $(TIMESTAMP_CONFIGURE) + +build_internal: $(BUILD_ROOT) + cd $(BUILD_ROOT) && make -j $(NPROCS) all + rm -rf $(BUILD_ALIAS) + ln -s $(BUILD_FOLDER) $(BUILD_ALIAS) + touch $(TIMESTAMP_BUILD) + +install_internal: + cd $(BUILD_ROOT) && make install + rm -rf $(INSTALL_ALIAS) + ln -s $(INSTALL_FOLDER) $(INSTALL_ALIAS) + touch $(TIMESTAMP_INSTALL) + +build_test_suite: install_internal + @echo "packaging test suite" + @rm -rf $(INSTALL_ROOT)/test-suite.tar.gz + @tar -zcf test-suite.tar.gz tests/scripts tests/framework infra $(INSTALL_ALIAS) --dereference + @mv test-suite.tar.gz $(INSTALL_ROOT)/. + +build_coverage_suite: install_internal + @echo "packaging test-coverage suite" + @rm -rf $(INSTALL_ROOT)/coverage-suite.tar.gz + @find Product -name "*.gcno" > include_lists.txt + @pwd | grep -o '/' | wc -l > tests/scripts/build_path_depth.txt + @tar -zcf coverage-suite.tar.gz tests/scripts tests/framework tools/lcov-to-cobertura-xml \ + nnas nnfw infra runtimes $(INSTALL_ALIAS) --dereference -T include_lists.txt + @rm -rf include_lists.txt tests/scripts/build_path_depth.txt + @mv coverage-suite.tar.gz $(INSTALL_ROOT)/. + +### +### Timestamps +### +$(WORKDIR): + mkdir -p $@ + +$(BUILD_ROOT): $(WORKDIR) configure_internal + +$(TIMESTAMP_CONFIGURE): configure_internal + +$(TIMESTAMP_BUILD): $(TIMESTAMP_CONFIGURE) build_internal + +$(TIMESTAMP_INSTALL): $(TIMESTAMP_BUILD) install_internal |