forked from karton/karton
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
170 lines (129 loc) · 4.51 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
NULL=
MAKEFLAGS=-j1
CURRENT_MAKEFILE:=$(lastword $(MAKEFILE_LIST))
CHECK_PRG=./scripts/check-program
SVG2PNG=./scripts/svg2png
LOGO_SIZES = \
16 \
22 \
32 \
48 \
64 \
128 \
256 \
512 \
$(NULL)
LOGOS = \
$(patsubst %,logos/out/karton-%.png,$(LOGO_SIZES)) \
logos/out/favicon.ico \
$(NULL)
########################################################################
# Misc generic targets #
########################################################################
# KEEP THIS THE FIRST TARGET OF THE MAKEFILE!
# There's no automatic target as we don't need to really build anything.
.PHONY: automatic-target
automatic-target:
@echo "Nothing to build automatically!" >&2; exit 1
.PHONY: .FORCE
.FORCE:
true
.PHONY: lint
lint:
./scripts/lint.sh
########################################################################
# Docs #
########################################################################
docs/props.md: karton/dockerfile.py scripts/props_docs.py
./scripts/props_docs.py $@
.PHONY: docs
docs: docs/props.md
########################################################################
# Tests #
########################################################################
.PHONY: check
check: check-python2
.PHONY: check-python-all
check-python-all: check-python2 check-python3
.PHONY: check-python2
check-python2:
@mkdir -p test-results/ 2> /dev/null
python2 ./tests/run.py --save-json-results test-results/local.json
.PHONY: check-python3
check-python3:
@mkdir -p test-results/ 2> /dev/null
python3 ./tests/run.py --save-json-results test-results/local-python3.json
.PHONY: check-inception
check-inception: dist
./tests/run-inception.sh dist/karton-`python ./karton/version.py`.tar.gz "$(TARGETS)" $(TESTS)
.PHONY: distcheck
distcheck:
-$(MAKE) -f $(CURRENT_MAKEFILE) check-python2
-$(MAKE) -f $(CURRENT_MAKEFILE) check-python3
-$(MAKE) -f $(CURRENT_MAKEFILE) check-inception
@echo
@echo
@echo "SUMMARY OF BOTH LOCAL AND INCEPTION TESTS"
@echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@python ./tests/summary.py
.PHONY: distcheck-fast
distcheck-fast:
@# Locally, we only run Python 3 tests as the Python2 ones will be run
@# in inception.
@rm test-results/local.json 2> /dev/null || true
-$(MAKE) -f $(CURRENT_MAKEFILE) check-python3
-$(MAKE) -f $(CURRENT_MAKEFILE) check-inception TARGETS="ubuntu:devel"
@echo
@echo
@echo "SUMMARY OF FAST LOCAL AND INCEPTION TESTS"
@echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
@python ./tests/summary.py
.PHONY: rm-test-images
rm-test-images:
-docker rmi --force \
$$( docker images -q --format '{{ .Repository }} {{ .ID }}' | \
grep '^karton-test-' | \
awk '{ print $$2 }' )
-docker rmi --force \
$$( docker images --filter "dangling=true" --quiet )
########################################################################
# Distribution stuff #
########################################################################
.PHONY: dist
dist: MANIFEST.in
python setup.py sdist --format=gztar
MANIFEST.in: .FORCE
echo '# This file was generated by Makefile.' > $@
echo '# DO NOT EDIT!' >> $@
echo 'include MANIFEST.in' >> $@
git ls-files | sed 's/^/include /' >> $@
########################################################################
# Logos #
########################################################################
.PHONY: logos
logos: $(LOGOS)
logos/out/.stamp:
mkdir -p `dirname $@`
touch $@
logos/out/karton-16.png: logos/src/karton-16.png logos/out/.stamp
cp $< $@
logos/out/karton-22.png: logos/src/karton-22.png logos/out/.stamp
cp $< $@
logos/out/karton-32.png: logos/src/karton-small.svg logos/out/.stamp
$(SVG2PNG) $< $@ 32
logos/out/karton-48.png: logos/src/karton-small.svg logos/out/.stamp
$(SVG2PNG) $< $@ 48
logos/out/karton-64.png: logos/src/karton.svg logos/out/.stamp
$(SVG2PNG) $< $@ 64
logos/out/karton-128.png: logos/src/karton.svg logos/out/.stamp
$(SVG2PNG) $< $@ 128
logos/out/karton-256.png: logos/src/karton.svg logos/out/.stamp
$(SVG2PNG) $< $@ 256
logos/out/karton-512.png: logos/src/karton.svg logos/out/.stamp
$(SVG2PNG) $< $@ 512
logos/out/favicon.ico: logos/out/karton-16.png logos/out/karton-32.png logos/out/.stamp
@$(CHECK_PRG) convert
convert \
\( logos/out/karton-16.png \) \
\( logos/out/karton-32.png \) \
$@