-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmake-case
More file actions
77 lines (61 loc) · 2.72 KB
/
make-case
File metadata and controls
77 lines (61 loc) · 2.72 KB
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
# Copyright 2018, mbugert
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# move this file and the src/ folder into the laserscad dist/ folder, then call with 'make -f make-case -j <j>' - do not set this higher than 7, otherwise, filename clashes can unfortunately occur
UNITS := 0.one_size_fits_all 1.beats 2.bass 3.keys 4.sample 5.fm 6.kick
THICKNESSES := 2.5 3 5
GIF_THICKNESS := $(word 2,$(THICKNESSES))
LKERF := 0
MODELS :=
PNGS :=
MODEL_NAME=volca_case
MODEL=src/$(MODEL_NAME).scad
TARGET_DIR=target/
GIF=$(TARGET_DIR)$(MODEL_NAME).gif
# $(1): unit.name, $(2): thickness
define build
$(eval unit=$(word 1,$(subst ., ,$(1))))
$(eval name=$(word 2,$(subst ., ,$(1))))
$(eval thickness=$(2))
$(eval SPECIALIZED_TARGET_DIR=$(TARGET_DIR)$(name)/)
$(eval TEMP_DIR=$(SPECIALIZED_TARGET_DIR)temp$(thickness)/)
$(eval dxf=$(SPECIALIZED_TARGET_DIR)$(MODEL_NAME)__$(name)__$(thickness).dxf)
$(eval svg=$(SPECIALIZED_TARGET_DIR)$(MODEL_NAME)__$(name)__$(thickness)_engrave.svg)
$(eval png=$(SPECIALIZED_TARGET_DIR)$(MODEL_NAME)__$(name)__$(thickness).png)
MODELS += $(dxf)
PNGS += $$(png)
$(SPECIALIZED_TARGET_DIR):
@mkdir -p $(SPECIALIZED_TARGET_DIR)
$(dxf) $(svg): | $(SPECIALIZED_TARGET_DIR)
@echo Making $(name) for $(thickness)mm thick materials...
+@$(MAKE) -s cut engrave model=$(MODEL) \
TARGET_DIR=$(SPECIALIZED_TARGET_DIR) \
TEMP=$(TEMP_DIR) \
OFLAGS='-D lkerf=$(LKERF) -D thickness=$(thickness) -D unit=$(unit)'
+@$(MAKE) -s clean model=$(MODEL) TEMP=$(TEMP_DIR)
@mv $(SPECIALIZED_TARGET_DIR)$(MODEL_NAME).dxf $(dxf)
@mv $(SPECIALIZED_TARGET_DIR)$(MODEL_NAME)_engrave.svg $(svg)
$(png): | $(SPECIALIZED_TARGET_DIR)
@echo Rendering PNG for $(name) for $(thickness)mm thick materials...
@openscad -o $$@ --camera=79,50,-11,44.5,0,310,510 --projection=p --imgsize=800,600 -D thickness=$(thickness) -D unit=$(unit) $(MODEL) 2> /dev/null
endef
$(foreach t,$(THICKNESSES),$(foreach u,$(UNITS),$(eval $(call build,$(u),$(t)))))
$(GIF): $(PNGS)
@echo Creating GIF for $(GIF_THICKNESS)mm thick materials...
@convert -delay 120 -loop 0 $(filter %$(GIF_THICKNESS).png,$(PNGS)) $@
.PHONY: all clean
.DEFAULT_GOAL := all
all: $(MODELS) $(GIF)
clean:
@rm -rf $(TARGET_DIR)