-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
74 lines (58 loc) · 1.48 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
# https://makefiletutorial.com
# https://devhints.io/makefile
.PHONY: all run clean uninstall test
TARGET := pathpick
SHELL := /bin/bash
PREFIX ?= /usr/local
PYTHON ?= /usr/bin/env python
BUILD_DIR := app
SOURCE_DIR := src
SRC := $(shell find $(SOURCE_DIR) -type f)
all: $(TARGET)
run:
$(PYTHON) -m $(SOURCE_DIR)
clean:
$(PYTHON) setup.py clean
-find . -type f -name '*.pyc' -delete
-find . -type d -name '__pycache__' -delete
-find . -name '*.egg-info' -exec rm -rfv {} \;
-rm -rfv \
.pytest_cache \
build \
dist \
$(BUILD_DIR) \
$(TARGET)
setupinstall: clean
$(PYTHON) setup.py install
cool:
nice:
echo nice
sweet:
echo sweet
pipinstall: clean
pip install -U . --use-feature=in-tree-build
$(TARGET): $(SRC)
mkdir -p $(BUILD_DIR)
cp -r $(SOURCE_DIR) $(BUILD_DIR)/$(TARGET)
$(PYTHON) -m zipapp \
$(BUILD_DIR) \
--main $(TARGET).__main__:main \
--python $(shell which python) \
--output $(TARGET) \
--compress
rm -rf $(BUILD_DIR)
app: $(TARGET)
install: $(TARGET)
install -m 755 $(TARGET) $(PREFIX)/bin/$(TARGET)
$(MAKE) clean
uninstall:
rm $(PREFIX)/bin/$(TARGET)
test:
@VENV=$(shell mktemp -d); \
trap "rm -rf $$VENV" EXIT; \
python3 -m venv $$VENV --symlinks; \
source $$VENV/bin/activate; \
pip --disable-pip-version-check install -q pytest; \
pytest -v; \
deactivate
@$(MAKE) --quiet clean &>/dev/null