-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
75 lines (66 loc) · 2.39 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
75
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SHELL := /bin/bash
MAKEFILE_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
OS := $(shell uname -s)
# Allowed CPU values: k8, armv7a, aarch64
ifeq ($(OS),Linux)
CPU ?= k8
else
$(error $(OS) is not supported)
endif
ifeq ($(filter $(CPU),k8 armv7a aarch64),)
$(error CPU must be k8, armv7a, aarch64)
endif
# Allowed COMPILATION_MODE values: opt, dbg
COMPILATION_MODE ?= opt
ifeq ($(filter $(COMPILATION_MODE),opt dbg),)
$(error COMPILATION_MODE must be opt or dbg)
endif
BAZEL_OUT_DIR := $(MAKEFILE_DIR)/bazel-out/$(CPU)-$(COMPILATION_MODE)/bin
BAZEL_BUILD_FLAGS := --crosstool_top=@crosstool//:toolchains \
--compiler=gcc \
--compilation_mode=$(COMPILATION_MODE) \
--copt=-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION \
--copt=-std=c++14 \
--verbose_failures \
--cpu=$(CPU) \
--experimental_repo_remote_exec
ifeq ($(COMPILATION_MODE), opt)
BAZEL_BUILD_FLAGS += --linkopt=-Wl,--strip-all
else ifeq ($(COMPILATION_MODE), dbg)
# for now, disable arm_neon in dbg.
# see: https://github.com/tensorflow/tensorflow/issues/33360
BAZEL_BUILD_FLAGS += --cxxopt -DTF_LITE_DISABLE_X86_NEON
endif
ifeq ($(CPU),k8)
BAZEL_BUILD_FLAGS += --copt=-includeglibc_compat.h
else ifeq ($(CPU),aarch64)
BAZEL_BUILD_FLAGS += --copt=-ffp-contract=off
else ifeq ($(CPU),armv7a)
BAZEL_BUILD_FLAGS += --copt=-ffp-contract=off
endif
DEMO_OUT_DIR := $(MAKEFILE_DIR)/out/$(CPU)/demo
demo:
bazel build $(BAZEL_BUILD_FLAGS) //src:MultiVideoStreamsDemo
mkdir -p $(DEMO_OUT_DIR)
cp -f $(BAZEL_OUT_DIR)/src/MultiVideoStreamsDemo \
.
clean:
rm -rf $(MAKEFILE_DIR)/bazel-* \
$(MAKEFILE_DIR)/out \
DOCKER_WORKSPACE=$(MAKEFILE_DIR)
DOCKER_CPUS=k8
DOCKER_TAG_BASE=multiple-video-streams-demo
include $(MAKEFILE_DIR)/docker/docker.mk