-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
44 lines (33 loc) · 1.15 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
BOARDS ?= $(patsubst m4board_%.scad,%,$(wildcard m4board_*.scad))
OUTPUT_DIR = stl
PARTS ?= top top_notext bottom texts
MKDIR = mkdir -p
SCADC ?= openscad -q
.PHONY: all $(BOARD_REVS)
define BOARD_RULE_TPL
all: $(1)
$(1): $(OUTPUT_DIR)
ifneq (,$(filter $(PARTS),top))
$(1): stl/m4board_$(1)_top.stl
endif
ifneq (,$(filter $(PARTS),top_notext))
$(1): stl/m4board_$(1)_top_notext.stl
endif
ifneq (,$(filter $(PARTS),bottom))
$(1): stl/m4board_$(1)_bottom.stl
endif
ifneq (,$(filter $(PARTS),texts))
$(1): stl/m4board_$(1)_texts.stl
endif
endef
$(foreach rev,$(BOARDS),$(eval $(call BOARD_RULE_TPL,$(rev))))
stl/m4board_%_top.stl: m4board_%.scad pcb_enclosure/pcb_enclosure.scad
$(SCADC) -o $@ -DAssembled=false -DExport=\"top\" $<
stl/m4board_%_top_notext.stl: m4board_%.scad pcb_enclosure/pcb_enclosure.scad
$(SCADC) -o $@ -DAssembled=false -DExport=\"top\" -DAddTexts=false $<
stl/m4board_%_bottom.stl: m4board_%.scad pcb_enclosure/pcb_enclosure.scad
$(SCADC) -o $@ -DAssembled=false -DExport=\"bottom\" $<
stl/m4board_%_texts.stl: m4board_%.scad pcb_enclosure/pcb_enclosure.scad
$(SCADC) -o $@ -DAssembled=false -DExport=\"texts\" $<
$(OUTPUT_DIR):
$(MKDIR) $@