-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathMakefile
71 lines (51 loc) · 1.74 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
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
define HELP
CompilerGym usage examples. See README.md for details. Available targets:
make install
Install the example python packages.
make test
Run pytest in this directory.
make clean
Remove build artifacts.
make uninstall
Uninstall the example python packages.
endef
export HELP
# The path of the repository reoot.
ROOT := $(realpath $(dir $(realpath $(firstword $(MAKEFILE_LIST))))/..)
PYTHON ?= python3
# Extra command line arguments for pytest.
PYTEST_ARGS ?=
# The path of the XML pytest coverage report to generate when running the
# test-cov target.
COV_REPORT ?= $(ROOT)/coverage.xml
DISTTOOLS_OUTS := \
build \
compiler_gym_examples.egg-info \
dist \
$(NULL)
.DEFAULT_GOAL := help
help:
@echo "$$HELP"
install:
$(PYTHON) -m pip install -r requirements.txt
$(PYTHON) setup.py install
uninstall:
$(PYTHON) -m pip uninstall -y compiler_gym_examples
# DGL creates ~/.dgl on first run and I have found that this will fail if tests
# are invoked before this file exists. Suppress errors.
dgl-init:
python3 -c 'import dgl; print(dgl.__version__)' &>/dev/null || true
# The target to use. This is a relative file path of the directory or file to
# test. If not provided, all tests will be run
TEST_TARGET ?= .
test: dgl-init
pytest --no-success-flaky-report --benchmark-disable -n auto --durations=5 $(TEST_TARGET) --cov=compiler_gym --cov-report=xml:$(COV_REPORT) $(PYTEST_ARGS)
clean:
rm -rf $(DISTTOOLS_OUTS)
disclean: clean
purge: distclean uninstall
.PHONY: help install uninstall dgl-init test clean distclean purge