forked from yaqwsx/KiKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
89 lines (70 loc) · 3.36 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
.SHELLFLAGS += -e
PCM_KIKIT_RESOURCES := $(shell find pcm/kikit -type f -print) \
$(shell find kikit/resources/graphics -type f -print)
PCM_LIB_RESOURCES := $(shell find pcm/kikit-lib -type f -print) \
$(shell find kikit/resources/graphics -type f -print) \
$(shell find kikit/resources/kikit.kicad_sym -type f -print) \
$(shell find kikit/resources/kikit.pretty -type f -print)
.PHONY: doc clean package release test test-system test-unit
all: doc package test pcm
doc: doc/panelization.md doc/examples.md
doc/panelization.md: kikit/panelize.py scripts/panelizeDoc.py
PYTHONPATH="$(pwd):${PYTHONPATH}" python3 scripts/panelizeDoc.py > $@
doc/resources/conn.png: doc/resources/conn.kicad_pcb
pcbdraw --silent $< $@ || pcbdraw plot --silent $< $@
convert $@ -define png:include-chunk=none $@
doc/examples.md: scripts/exampleDoc.py doc/resources/conn.png
PYTHONPATH="$(pwd):${PYTHONPATH}" python3 scripts/exampleDoc.py > $@
package:
rm -f dist/*
python3 setup.py sdist bdist_wheel
install: package
pip3 install --no-deps --force dist/*.whl
release: package
twine upload dist/*
test: test-system test-unit
test-system: build/test $(shell find kikit -type f)
cd build/test && bats ../../test/system
test-unit:
cd test/units && pytest
build/test:
mkdir -p $@
pcm: pcm-kikit pcm-lib
pcm-kikit: $(PCM_KIKIT_RESOURCES)
rm -rf build/pcm-kikit build/pcm-kikit.zip
mkdir -p build/pcm-kikit
mkdir -p build/pcm-kikit/resources
cp -r pcm/kikit/* build/pcm-kikit
find build/pcm-kikit -name "*.pyc" -type f -delete
cp kikit/resources/graphics/kikitIcon_64x64.png build/pcm-kikit/resources/icon.png
ls -lah build
scripts/setJson.py -s versions.-1.install_size=$$( find build/pcm-kikit -type f -exec ls -la {} + | tr -s ' ' | cut -f5 -d' ' | paste -s -d+ - | bc ) \
build/pcm-kikit/metadata.json build/pcm-kikit/metadata.json
cd build/pcm-kikit && zip ../pcm-kikit.zip -r *
cp build/pcm-kikit/metadata.json build/pcm-kikit-metadata.json
scripts/setJson.py \
-s versions.-1.download_sha256=\"$$( sha256sum build/pcm-kikit.zip | cut -d' ' -f1)\" \
-s versions.-1.download_size=$$( du -sb build/pcm-kikit.zip | cut -f1) \
-s versions.-1.download_url=\"TBA\" \
build/pcm-kikit-metadata.json build/pcm-kikit-metadata.json
pcm-lib: $(PCM_LIB_RESOURCES)
rm -rf build/pcm-kikit-lib build/pcm-kikit-lib.zip
mkdir -p build/pcm-kikit-lib
mkdir -p build/pcm-kikit-lib/resources
mkdir -p build/pcm-kikit-lib/symbols
mkdir -p build/pcm-kikit-lib/footprints
cp -r pcm/kikit-lib/* build/pcm-kikit-lib
cp kikit/resources/graphics/kikitIcon_64x64.png build/pcm-kikit-lib/resources/icon.png
cp -r kikit/resources/kikit.pretty build/pcm-kikit-lib/footprints
cp -r kikit/resources/kikit.kicad_sym build/pcm-kikit-lib/symbols
scripts/setJson.py -s versions.-1.install_size=$$(find build/pcm-kikit-lib -type f -exec ls -la {} + | tr -s ' ' | cut -f5 -d' ' | paste -s -d+ - | bc) \
build/pcm-kikit-lib/metadata.json build/pcm-kikit-lib/metadata.json
cd build/pcm-kikit-lib && zip ../pcm-kikit-lib.zip -r *
cp build/pcm-kikit-lib/metadata.json build/pcm-kikit-lib-metadata.json
scripts/setJson.py \
-s versions.-1.download_sha256=\"$$( sha256sum build/pcm-kikit-lib.zip | cut -d' ' -f1)\" \
-s versions.-1.download_size=$$( du -sb build/pcm-kikit-lib.zip | cut -f1) \
-s versions.-1.download_url=\"TBA\" \
build/pcm-kikit-lib-metadata.json build/pcm-kikit-lib-metadata.json
clean:
rm -rf dist build