-
Notifications
You must be signed in to change notification settings - Fork 651
/
Makefile
89 lines (64 loc) · 2.75 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#
# Before invoking `make`, make sure the python environment is setup by following the instructions
# in README.md.
#
SHELL := /bin/zsh
# All the packages that we care about for linting, testing, etc.
CURR_DIR=$(notdir $(shell pwd))
SRC_PACKAGES=$(subst -,_,${CURR_DIR})
TEST_PACKAGES=${SRC_PACKAGES}
PACKAGES=${SRC_PACKAGES} ${TEST_PACKAGES} ${EXAMPLES}
ENV_DIR=envs/${CURR_DIR}-py${python}
# Docker image for CoreML
DOCKERFILE_PATH=docker/Dockerfile-coremltools-linux
DOCKERFILE_ROOT=docker/
DOCKER_TAG=docker.apple.com/turi/coremltools-linux:latest
# Define python version to use
PY_EXE ?= $(shell command -v python || command -v python)
python = 3.7
.PHONY: all build checkstyle clean clean_envs docker_build docker_push env env_force lint proto release style test test_fast test_slow wheel
all: build
build: ${ENV_DIR}/build_reqs
zsh -i scripts/build.sh --python=${python} --debug --no-check-env
checkstyle:
${PY_EXE} -m yapf -rdp ${PACKAGES}
clean:
rm -rf build
clean_envs:
rm -rf envs
docker_build:
docker build -f ${DOCKERFILE_PATH} -t ${DOCKER_TAG} ${DOCKERFILE_ROOT}
docker_push:
docker push ${DOCKER_TAG}
docs: ${ENV_DIR}/docs_reqs
zsh -i scripts/build_docs.sh --python=${python} --no-check-env
env:
zsh -i scripts/env_create.sh --python=${python} --dev
env_force:
zsh -i scripts/env_create.sh --python=${python} --force --dev --no-check-env
lint:
${PY_EXE} -m pylint -j 0 ${PACKAGES}
proto: ${ENV_DIR}/build_reqs
zsh -i scripts/build.sh --python=${python} --protobuf --debug --no-check-env
release: ${ENV_DIR}/build_reqs
zsh -i scripts/release_wheel.sh --no-check-env
style:
${PY_EXE} -m yapf -rip --verify ${PACKAGES}
test: ${ENV_DIR}/test_reqs
zsh -i scripts/test.sh --python=${python} --test-package="${TEST_PACKAGES}" --cov="${SRC_PACKAGES}" --no-check-env
test_fast: ${ENV_DIR}/test_reqs
zsh -i scripts/test.sh --python=${python} --test-package="${TEST_PACKAGES}" --cov="${SRC_PACKAGES}" --fast --no-check-env
test_slow: ${ENV_DIR}/test_reqs
zsh -i scripts/test.sh --python=${python} --test-package="${TEST_PACKAGES}" --cov="${SRC_PACKAGES}" --slow --no-check-env
wheel: ${ENV_DIR}/build_reqs
zsh -i scripts/build.sh --python=${python} --dist --no-check-env
# For Managing Environments, so we don't need to rebuild every time we run a target.
${ENV_DIR}/build_reqs: ./reqs/build.pip
zsh -i scripts/env_create.sh --python=${python} --exclude-test-deps
touch ${ENV_DIR}/build_reqs
${ENV_DIR}/test_reqs: ${ENV_DIR}/build_reqs ./reqs/test.pip
zsh -i scripts/env_create.sh --python=${python} --exclude-build-deps
touch ${ENV_DIR}/test_reqs
${ENV_DIR}/docs_reqs: ${ENV_DIR}/build_reqs ${ENV_DIR}/test_reqs ./reqs/docs.pip
zsh -i scripts/env_create.sh --python=${python} --include-docs-deps --exclude-build-deps --exclude-test-deps
touch ${ENV_DIR}/docs_reqs