-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
97 lines (73 loc) · 3.98 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
BLENDER = $(shell command -v blender-4.2 blender 2>/dev/null | head -n 1)
MAGICK = $(shell command -v magick gm 2>/dev/null | head -n 1)
PYTHON = $(shell command -v python3 python 2>/dev/null | head -n 1)
PCB_LAYERS := GM1 TXT GTO GTS GTL G1 G2 GBL GBS GBO
OUTDIR = output
# Main output: files for both boards
.PHONY: all render clean
all: \
$(OUTDIR)/mainboard.zip \
$(OUTDIR)/support_board.zip \
$(OUTDIR)/support_board.Parts.blend \
$(OUTDIR)/support_board.PCB.blend \
$(OUTDIR)/mainboard.Parts.blend \
$(OUTDIR)/mainboard.PCB.blend \
$(OUTDIR)/mainboard.Front.blend \
$(OUTDIR)/mainboard.Display.blend \
$(OUTDIR)/mainboard.Highlight.blend
clean:
rm -rf $(OUTDIR)
$(MAKE) -C primitives clean
$(MAKE) -C parts clean
# Output parts!
.SECONDARY:
$(OUTDIR)/mainboard.zip: $(OUTDIR)/mainboard.normal.png
# cheating a bit, as this gets generated along with these
$(OUTDIR)/mainboard.normal.svg: $(OUTDIR)/mainboard.front.svg $(OUTDIR)/mainboard.back.svg
touch $@
# Board output file: part lists, PCB layer files, traces
$(OUTDIR)/%.zip: \
$(OUTDIR)/%.mouser.txt \
$(OUTDIR)/%.tinytronics.txt \
$(OUTDIR)/%.PCB.zip \
$(OUTDIR)/%.front.traces.png \
$(OUTDIR)/%.back.traces.png
rm -f $@
cd $(OUTDIR) && zip $*.zip $(patsubst $(OUTDIR)/%,%,$^)
# PCB output file: layer files
$(OUTDIR)/%.PCB.zip: \
$(foreach layer,$(PCB_LAYERS),$(OUTDIR)/%.PCB.$(layer))
rm -f $@
cd $(OUTDIR) && zip $*.PCB.zip $(patsubst $(OUTDIR)/%,%,$^)
# PCB layer files and base part overview is generated by generated/compose_<pcb>.py once the parts and primitives are in place
$(OUTDIR)/%.front.svg $(OUTDIR)/%.back.svg $(OUTDIR)/%.PCB.obj $(foreach layer,$(PCB_LAYERS),$(OUTDIR)/%.PCB.$(layer)) $(OUTDIR)/%.parts.txt $(OUTDIR)/%.Front.obj $(OUTDIR)/%.Display.obj $(OUTDIR)/%.Highlight.obj: generator/compose_%.py $(OUTDIR)/primitives.stamp $(OUTDIR)/parts.stamp
$(PYTHON) $<
# Trace files are generated by generator/post.py from the board composer output
$(OUTDIR)/%.front.traces.svg $(OUTDIR)/%.back.traces.svg: generator/post.py $(OUTDIR)/%.front.svg $(OUTDIR)/%.back.svg
$(PYTHON) $< $*
# Part lists are generated by generator/orderlist.py from the board composer output
$(OUTDIR)/%.mouser.txt $(OUTDIR)/%.tinytronics.txt: generator/orderlist.py $(OUTDIR)/%.parts.txt
$(PYTHON) $< $*
%.png: %.svg
$(MAGICK) convert $< $@
# Deal with stuff in sub-makes (parts and primitives)
$(OUTDIR)/%.stamp: %/Makefile | $(OUTDIR)/
cd $* && $(MAKE) BLENDER=$(BLENDER)
touch $@
$(OUTDIR)/:
mkdir -p $@
# Generate blend files for render directory
$(OUTDIR)/support_board.Parts.blend: render/blend-import-support-board-parts.py render/parts.template.blend $(OUTDIR)/support_board.parts.txt
cd render && $(BLENDER) -b --python blend-import-support-board-parts.py --python-exit-code 1
$(OUTDIR)/support_board.PCB.blend: render/blend-import-support-board.py render/support_board.template.blend $(OUTDIR)/support_board.PCB.obj
cd render && $(BLENDER) -b --python blend-import-support-board.py --python-exit-code 1
$(OUTDIR)/mainboard.Parts.blend: render/blend-import-mainboard-parts.py render/parts.template.blend $(OUTDIR)/mainboard.parts.txt
cd render && $(BLENDER) -b --python blend-import-mainboard-parts.py --python-exit-code 1
$(OUTDIR)/mainboard.PCB.blend: render/blend-import-mainboard.py render/mainboard.template.blend $(OUTDIR)/mainboard.PCB.obj
cd render && $(BLENDER) -b --python blend-import-mainboard.py --python-exit-code 1
$(OUTDIR)/mainboard.Front.blend: render/blend-import-front.py render/acrylic.template.blend $(OUTDIR)/mainboard.Front.obj
cd render && $(BLENDER) -b --python blend-import-front.py --python-exit-code 1
$(OUTDIR)/mainboard.Display.blend: render/blend-import-display.py render/acrylic.template.blend $(OUTDIR)/mainboard.Display.obj
cd render && $(BLENDER) -b --python blend-import-display.py --python-exit-code 1
$(OUTDIR)/mainboard.Highlight.blend: render/blend-import-highlight.py render/acrylic.template.blend $(OUTDIR)/mainboard.Highlight.obj
cd render && $(BLENDER) -b --python blend-import-highlight.py --python-exit-code 1