|
1 | 1 | VENV = .venv |
2 | | -export PATH := $(abspath ${VENV})/bin:${PATH} |
| 2 | +VENVBIN = ${VENV}/bin |
| 3 | + |
| 4 | +# Detect windows - works on both 32 & 64-bit windows |
| 5 | +ifeq ($(OS),Windows_NT) |
| 6 | +VENVBIN = ${VENV}/Scripts |
| 7 | +endif |
| 8 | + |
| 9 | +export PATH := $(abspath ${VENVBIN}):${PATH} |
| 10 | + |
3 | 11 |
|
4 | 12 | .PHONY: init test build benchmark |
5 | 13 |
|
6 | 14 | # Default target executed when no arguments are given to make. |
7 | | -default_target: all |
| 15 | +default_target: build test |
8 | 16 |
|
9 | 17 | help: ## Show this help |
10 | 18 | @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
11 | 19 |
|
12 | 20 | ################################ |
13 | 21 |
|
14 | | -all: depend build test ## Prepare, build and test |
| 22 | +all: depend build test ## Get dependencies, build and test |
15 | 23 |
|
16 | 24 | build: ${VENV} clean ## Build and clean |
17 | | - python3 setup.py bdist_wheel |
| 25 | + python setup.py bdist_wheel |
18 | 26 | ls -lh dist |
19 | 27 |
|
20 | | -${VENV}: ${VENV}/bin/activate |
| 28 | +${VENV}: ${VENVBIN}/activate |
21 | 29 |
|
22 | | -${VENV}/bin/activate: requirements.txt |
23 | | - test -d ${VENV} || virtualenv ${VENV} |
24 | | - # remove packages not in the requirements.txt |
| 30 | +${VENVBIN}/activate: requirements.txt |
| 31 | + virtualenv ${VENV} |
| 32 | +# remove packages not in the requirements.txt |
25 | 33 | pip3 freeze | grep -v -f requirements.txt - | grep -v '^#' | grep -v '^-e ' | xargs pip3 uninstall -y || echo "never mind" |
26 | | - # install and upgrade based on the requirements.txt |
27 | | - pip3 install --upgrade -r requirements.txt |
28 | | - # let make know this is the last time requirements changed |
29 | | - touch ${VENV}/bin/activate |
| 34 | +# install and upgrade based on the requirements.txt |
| 35 | + python -m pip install --upgrade -r requirements.txt |
| 36 | +# let make know this is the last time requirements changed |
| 37 | + touch ${VENVBIN}/activate |
30 | 38 |
|
31 | 39 | depend: ${VENV} ## Prepare dependencies |
32 | | - python3 download-c-lib.py |
| 40 | + python download-c-lib.py |
33 | 41 |
|
34 | 42 | test: ${VENV} ## Test all targets |
35 | | - python3 -m pytest --capture=no --verbose |
| 43 | + python -m pytest --capture=no --verbose |
36 | 44 |
|
37 | 45 | benchmark: ${VENV} ## Run CRUD benchmarks |
38 | | - python3 -m benchmark |
| 46 | + python -m benchmark |
39 | 47 |
|
40 | 48 | clean: ## Clean build artifacts |
41 | 49 | rm -rf build/ |
|
0 commit comments