-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
72 lines (58 loc) · 1.7 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
PYTHON ?= python
.DEFAULT_GOAL := build
HELP_LINE=" \033[36m%-30s\033[0m %s\n"
# Absolutely awesome: http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help:
@echo "CTools Makefile"
@echo
@echo "Variables:"
@printf $(HELP_LINE) PYTHON "python executable path"
@echo
@echo "Commands:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf $(HELP_LINE), $$1, $$2}'
.PHONY: dist
dist: clean ## Build dists
@$(CURDIR)/tools/dist.sh
@$(MAKE) clean-cache
.PHONY: clean-cache
clean-cache:
@find . -name *.egg-info -exec rm -rf {} +
@find . -name *.pyc -exec rm -rf {} +
@find . -name *.pyo -exec rm -rf {} +
@find . -name *.so -exec rm -rf {} +
@find . -name *.pyd -exec rm -rf {} +
.PHONY: clean
clean: clean-cache ## Clean cache, include dist
@rm -rf dist
@rm -rf build
.PHONY: format fmt
format fmt: ## Format code
@clang-format --verbose -i src/*
@black **/*.py
@black *.py
.PHONY: benchmark
benchmark: ## Run benchmark
@$(PYTHON) $(CURDIR)/tools/runbenchmark.py benchmarks/
.PHONY: pypi-test
pypi-test:
@$(CURDIR)/tools/upload-pypi.sh test
.PHONY: pypi
pypi:
@$(CURDIR)/tools/upload-pypi.sh
.PHONY: build
build: clean ## Build package
@$(PYTHON) setup.py build_ext --inplace
.PHONY: test
test: ## Run unit tests
@$(PYTHON) $(CURDIR)/tools/runtest.py -s ./tests -p .
.PHONY: check-doc
check-doc: ## Check documentation
$(PYTHON) $(CURDIR)/tools/checkdoc.py 'ctools.**'
.PHONY: doc
doc: ## Build documentation
cd $(CURDIR)/docs && make clean && make html
PY_INCLUDE=$(shell $(PYTHON) -c "from sysconfig import get_paths as gp; print(gp()['include'])")
.PHONY: check
check: ## Clang-tidy codes
clang-tidy src/* -- -I "$(PY_INCLUDE)"