-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
62 lines (48 loc) · 1.23 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
# Suspend command echo for non-verbose builds
ifeq ("$(VERBOSE)","1")
NO_ECHO :=
TEST_VERBOSE := -v
else
NO_ECHO := @
TEST_VERBOSE :=
endif
# Set up project-relative source paths
BUILD_OUTPUTS := $(abspath ./dist) $(abspath ./build) $(abspath ./blatann.egg-info)
TEST_ROOT := $(abspath ./tests)
TEST_VERBOSE := -v
# Utility commands
RM := rm -rf
CD := cd
CP := cp
TOUCH := touch
MKDIR := mkdir
CAT := cat
ifeq ($(OS),Windows_NT)
PYTHON ?= python
else
PYTHON ?= python3
endif
# Python-based commands
PIP := $(PYTHON) -m pip
VENV := $(PYTHON) -m venv
COVERAGE := $(PYTHON) -m coverage
RUFF := $(PYTHON) -m ruff
ISORT := $(PYTHON) -m isort
# Target Definitions
.PHONY: default binaries clean run-tests setup-dev lint-check format
# First target, default to building the wheel
default: binaries
binaries:
$(NO_ECHO)$(PYTHON) -m build
clean:
$(NO_ECHO)$(RM) $(BUILD_OUTPUTS)
setup-dev:
$(NO_ECHO)$(PIP) install -e .[dev]
run-tests:
$(NO_ECHO)$(PYTHON) -m unittest discover $(TEST_VERBOSE) -s $(TEST_ROOT) -t $(TEST_ROOT)
lint-check:
$(NO_ECHO)$(RUFF) check .
$(NO_ECHO)$(ISORT) --check .
format:
$(NO_ECHO)$(RUFF) check --fix .
$(NO_ECHO)$(ISORT) .