-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
99 lines (83 loc) · 2.63 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
######################################################################
# Makefile for RaphaëlPy project
# Run 'make help' for more info
######################################################################
######################################################################
# settable variables
######################################################################
PYTHON=python
PREFIX=
USER=
SPHINX_BUILD_COMMAND=sphinx-build
SPHINX_BUILD_DIR=build/doc
######################################################################
# auxiliary functions and variables
######################################################################
_PYTHON_HELP=" PYTHON ... sets python executable (e.g. PYTHON='python3'). Defaults is 'python'"
INSTALLCMD=$(PYTHON) setup.py install
EXAMPLES=$(shell cd examples; ls *.py)
EXAMPLES_RAPHAELJS=$(shell cd examples/raphaeljs; ls *.py)
######################################################################
# targets
######################################################################
.PHONY: doc examples
help:
@echo
@echo "RaphaëlPy makefile"
@echo
@echo "targets:"
@echo " install"
@echo " runs 'python setup.py install' to installs the application"
@echo " options:"
@echo " USER=1 ... adds '--user' switch to the install command"
@echo " PREFIX=/your/prefix ... adds '--prefix=/your/prefix' to the install commands"
@echo $(_PYTHON_HELP)
@echo " test"
@echo " run tests"
@echo $(_PYTHON_HELP)
@echo " doc"
@echo " create Sphinx HTML documentation"
@echo " options:"
@echo " SPHINX_BUILD_COMMAND ... sphinx build command (default is 'sphinx-build')"
@echo " SPHINX_BUILD_DIR ... target directory (default is 'build/doc')"
@echo " examples"
@echo " buld all examples (takes some time)"
@echo " clean"
@echo " cleans intermediate and auxiliary files"
@echo " dist"
@echo " creates distribution for PyPI by 'pythonX setup.py sdist bdist_wheel' command"
install:
ifneq ($(USER),)
$(INSTALLCMD) --user
else ifneq ($(PREFIX),)
$(INSTALLCMD) --prefix $(PREFIX)
else
$(INSTALLCMD)
endif
test:
$(PYTHON) tests
doc:
$(SPHINX_BUILD_COMMAND) -b html -a -E doc $(SPHINX_BUILD_DIR)/html
.ONESHELL:
examples:
@cd examples
for example in $(EXAMPLES); do
@echo $$example
$(PYTHON) $$example
done
@cd raphaeljs
for example in $(EXAMPLES_RAPHAELJS); do
@echo $$example
$(PYTHON) $$example
done
clean:
rm -rf build
rm -rf dist
rm -rf *.egg-info
find . -type f -name '*.pyc' -delete
find . -type d -name __pycache__ -delete
find . -type f -name '*.svg' -delete
dist:
make clean
python2 setup.py sdist bdist_wheel
python3 setup.py sdist bdist_wheel