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
|
SCAD=openscad
STLOPTS= --export-format binstl
PNGOPTS= --colorscheme BeforeDawn --viewall --autocenter --imgsize 800,800 \
--render
STLDIR = stlout
PNGDIR = pngout
SRC = $(wildcard *.scad)
STL = $(addprefix $(STLDIR)/,$(SRC:.scad=.stl))
PNG = $(addprefix $(PNGDIR)/,$(SRC:.scad=.png))
BITSTORAGE_SIZES = $(STLDIR)/bitstorage_1x1x6.35.stl $(STLDIR)/bitstorage_1x2x6.35.stl $(STLDIR)/bitstorage_2x2x6.35.stl \
$(STLDIR)/bitstorage_1x1x4.stl $(STLDIR)/bitstorage_1x2x4.stl $(STLDIR)/bitstorage_2x2x4.stl
SIMPLEBOX_SIZES = $(STLDIR)/simplebox_1x1x4.stl $(STLDIR)/simplebox_2x1x4.stl $(STLDIR)/simplebox_2x1x3.stl \
$(STLDIR)/simplebox_3x1x4.stl $(STLDIR)/simplebox_3x1x3.stl $(STLDIR)/simplebox_2x2x4.stl \
$(STLDIR)/simplebox_2x2x4.stl
.PHONY: _default
_default: stl
.PHONY: all
all: clean stl png
.PHONY: stl
stl: $(STLDIR) $(STL)
$(STLDIR)/gridfinity.stl: gridfinity.scad
@echo
$(STLDIR)/bitstorage_%.stl: bitstorage.scad
@echo [ STL ] $< $*
@$(SCAD) $(STLOPTS) \
-D ux=$(firstword $(subst x, ,$*)) -D uy=$(word 2,$(subst x, ,$*)) \
-D wrench_size=$(word 3,$(subst x, ,$*))\
-o $@ $<
$(STLDIR)/bitstorage.stl: $(BITSTORAGE_SIZES)
@echo
$(STLDIR)/simplebox_%.stl: simplebox.scad
@echo [ STL ] $< $*
@$(SCAD) $(STLOPTS) \
-D ux=$(firstword $(subst x, ,$*)) -D uy=$(word 2,$(subst x, ,$*)) \
-D uz=$(word 3,$(subst x, ,$*))\
-o $@ $<
$(STLDIR)/simplebox.stl: $(SIMPLEBOX_SIZES)
@echo
$(STLDIR)/%.stl: %.scad
@echo [ STL ] $<
@$(SCAD) $(STLOPTS) -o $@ $<
png: $(PNGDIR) $(PNG)
$(PNGDIR)/gridfinity.png: gridfinity.scad
@echo
$(PNGDIR)/%.png: %.scad
@echo [ PNG ] $<
@$(SCAD) $(PNGOPTS) -o $@ $<
$(PNGDIR):
@mkdir -p $(PNGDIR)/
$(STLDIR):
@mkdir -p $(STLDIR)/
.PHONY: clean
clean:
@rm -rf $(STLDIR)/
@rm -rf $(PNGDIR)/
|