Skip to content

Commit b81802a

Browse files
author
Ivan Dlugos
committed
makefile windows support (assumes "bash")
1 parent aa7e2ef commit b81802a

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

Makefile

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,49 @@
11
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+
311

412
.PHONY: init test build benchmark
513

614
# Default target executed when no arguments are given to make.
7-
default_target: all
15+
default_target: build test
816

917
help: ## Show this help
1018
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
1119

1220
################################
1321

14-
all: depend build test ## Prepare, build and test
22+
all: depend build test ## Get dependencies, build and test
1523

1624
build: ${VENV} clean ## Build and clean
17-
python3 setup.py bdist_wheel
25+
python setup.py bdist_wheel
1826
ls -lh dist
1927

20-
${VENV}: ${VENV}/bin/activate
28+
${VENV}: ${VENVBIN}/activate
2129

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
2533
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
3038

3139
depend: ${VENV} ## Prepare dependencies
32-
python3 download-c-lib.py
40+
python download-c-lib.py
3341

3442
test: ${VENV} ## Test all targets
35-
python3 -m pytest --capture=no --verbose
43+
python -m pytest --capture=no --verbose
3644

3745
benchmark: ${VENV} ## Run CRUD benchmarks
38-
python3 -m benchmark
46+
python -m benchmark
3947

4048
clean: ## Clean build artifacts
4149
rm -rf build/

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
pip
2+
wheel
23
flatbuffers==1.12
34
pytest>=4.4.1

0 commit comments

Comments
 (0)