-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (23 loc) · 1016 Bytes
/
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
# based on https://ricardoanderegg.com/posts/makefile-python-project-tricks/
# Override PWD so that it's always based on the location of the file and **NOT**
# based on where the shell is when calling `make`. This is useful if `make`
# is called like `make -C <some path>`
PWD := $(realpath $(dir $(abspath $(firstword $(MAKEFILE_LIST)))))
MAKEFILE_PWD := $(CURDIR)
# Using $$() instead of $(shell) to run evaluation only when it's accessed
# https://unix.stackexchange.com/a/687206
PYTHON = $$(if [ -d $(PWD)/'.venv' ]; then echo $(PWD)/".venv/bin/python3"; else echo "python3"; fi)
# https://earthly.dev/blog/python-makefile/#phony-targets
# [...] tell "make" not to consider an existing file with the same name.
.PHONY: help clean test install
help:
echo "options: ["hello", "clean", "test", "install"]"
hello:
echo "Hello, World"
clean:
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -delete
test:
$(PYTHON) scripts/run_tests.py
install:
$(PYTHON) setup.py --verbose build