forked from vak/makefile2dot
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
70 lines (54 loc) · 1.47 KB
/
Copy pathMakefile
File metadata and controls
70 lines (54 loc) · 1.47 KB
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
#
# Use this Makefile as an example.
#
# It also builds the project for disctibution. This way, you can visualize how
# the project is built and distributed.
#
.PHONY: default
default:
@echo 'Type "make all" to generate example output.png.'
@echo 'Type "make dist" to generate the distributables.'
@echo 'Type "make upload" to upload the distributables to pypi.'
# Variables for long names.
VERSION := 1.0.2
LIB_FILES := makefile2dot/__init__.py
TEST_FILES := makefile2dot/test_makefile2dot.py
WHEEL = dist/makefile2dot-$(VERSION)-py3-none-any.whl
TARGZ = dist/makefile2dot-$(VERSION).tar.gz
TEMP = $(WHEEL) \
$(TARGZ) \
.linted \
.checked \
.twine_checked \
.uploaded \
example.dot \
example.png
.PHONY: all
all: output.png
output.png: output.dot
dot -Tpng < $< > $@
output.dot: Makefile .checked # This is a comment
scripts/makefile2dot --direction TB -o $@
.PHONY: lint
lint: .linted
.linted: $(LIB_FILES) scripts/makefile2dot
pycodestyle $(LIB_FILES) scripts/makefile2dot && touch .linted
.PHONY: check
check: .checked
.checked: .linted $(TEST_FILES)
pytest && touch .checked
.PHONY: dist
dist: .twine_checked
$(WHEEL): .checked setup.py
python -m setup bdist_wheel
$(TARGZ): .checked setup.py
python -m setup sdist
.twine_checked: $(WHEEL) $(TARGZ)
twine check dist/* && touch .twine_checked
.PHONY: upload
upload: .uploaded
.uploaded: .twine_checked
twine upload -u $(PYPI_USER) -p $(PYPI_PASS) $(WHEEL) $(TARGZ) && touch .uploaded
.PHONY: clean
clean:
rm -f $(TEMP)