chiark / gitweb /
bike-lipo-box: rotate again so glands are at front for viewing while printing
[reprap-play.git] / Makefile
1 # reprap-objects Makefile
2 #
3 # Build scripts for various 3D designs
4 # Copyright 2012-2016 Ian Jackson
5 #
6 # This work is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # This work is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this work.  If not, see <http://www.gnu.org/licenses/>.
18
19
20 HRR=/home/reprap
21 SLIC3R=$(HRR)/Slic3r/bin/slic3r
22 M4=m4
23 SKEINFORGE=python $(HRR)/reprappro-software.git/skeinforge/skeinforge_application/skeinforge_utilities/skeinforge_craft.py
24
25 CWD := $(shell pwd)
26 PLAY ?= $(CWD)
27
28 CONFIG=$(PLAY)/slic3r-config.ini
29
30 FILAMENTSPOOL_AUTOS = filamentspool filamentspool-lt filamentspool-sm
31
32 USING_AUTOS ?= $(FILAMENTSPOOL_AUTOS) xeno-drivebay-bracket dungeonquest-cone anke-gps-bracket cable-hole-trunking-cover anglepoise-neck crossbar-computer-led-mount wardrobe-hook knifeblock pandemic-counter pattress-boxes-3-cover bike-lipo-box
33
34 AUTO_TOPLEVELS := $(foreach m,$(USING_AUTOS),$(shell $(PLAY)/toplevel-find $m))
35
36 AUTO_INCS = funcs.scad utils.scad sealing-box.scad
37
38 default:        autoincs scads
39
40 $(shell set -xe; ./commitid.scad.pl >commitid.scad.tmp; cmp commitid.scad.tmp commitid.scad || mv -f commitid.scad.tmp commitid.scad )
41
42 autoincs:       $(AUTO_INCS)
43 scads:          $(addsuffix .auto.scad, $(AUTO_TOPLEVELS))
44 stls:           $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
45
46 %.auto.scads: %.scad
47         $(MAKE) $(addsuffix .auto.scad, $(shell $(PLAY)/toplevel-find $*))
48 %.auto.stls:
49         $(MAKE) $(addsuffix .auto.stl, $(shell $(PLAY)/toplevel-find $*))
50
51 -include .*.d
52
53 %.stl:          %.scad $(AUTO_INCS)
54                 openscad -d .$@.d.tmp -o $*.tmp.stl $<
55                 @rm -f $@
56                 @sed -e 's/\.tmp\.stl:/.stl:/' <.$@.d.tmp >.$@.d
57                 @rm .$@.d.tmp
58                 mv -f $*.tmp.stl $@
59
60 AUTOBASE=$(shell echo $(1) | perl -pe 's/,\w+\.auto$$//')
61
62 %.gcode:        %.stl $(CONFIG)
63                 $(SLIC3R) --load $(CONFIG) \
64                         --ignore-nonexistent-config \
65                         --load $(call AUTOBASE,$*).slic3r \
66                         --load $*.slic3r \
67                         --output $@.tmp $<
68                 @mv -f $@.tmp $@
69
70 %.gcode-sd:     %.gcode
71                 mount /media/sd
72                 cp $^ /media/sd/JOB.G
73                 sleep 0.5
74                 umount /media/sd
75
76 %:              %.cpp
77                 cpp -nostdinc -P <$< >$@.tmp && mv -f $@.tmp $@
78
79 funcs.scad:
80
81 #%.gcode:       %.stl
82 #               $(SKEINFORGE) $<
83
84 %.gcode:        manual-gcode-generator %.m-g
85                 $(PLAY)/$^ >$@.tmp && mv -f $@.tmp $@
86
87 dovecliptest.stl: doveclip.scad $(AUTO_INCS)
88
89 KNIFEBLOCK_KNIVES= 0 1 2
90 KNIFEBLOCK_TEMPLATES= bl hl
91 KNIFEBLOCK_TEMPLATE_FILES=\
92         $(foreach k,$(KNIFEBLOCK_KNIVES), \
93         $(foreach t,$(KNIFEBLOCK_TEMPLATES), \
94         knifeblock-knives-t$k$t.dxf))
95
96 knifeblock-knives-templates knifeblock.stl: $(KNIFEBLOCK_TEMPLATE_FILES)
97
98 .PRECIOUS: knifeblock-knives-t%.dxf
99 knifeblock-knives-t%.dxf: knifeblock-knives-filter knifeblock-knives-trace.fig
100                 ./$< $(notdir $*) <$(filter %.fig, $^) >$@.tmp.fig
101                 fig2dev -D -30 -L eps <$@.tmp.fig >$@.tmp.eps
102                 pstoedit -dt -f "dxf: -polyaslines -mm" $@.tmp.eps $@
103
104 PANDEMICCOUNTER_LETTERS=30 31 32 33 34 35
105 PANDEMICCOUNTER_DXFS=$(foreach l,$(PANDEMICCOUNTER_LETTERS), \
106         pandemic-counter-l$l.dxf)
107
108 pandemic-counter-letters: $(PANDEMICCOUNTER_DXFS)
109 pandemic-counter%.stl: $(PANDEMICCOUNTER_DXFS)
110
111 .PRECIOUS: pandemic-counter-l%.eps
112 pandemic-counter-l%.eps: pandemic-counter-letters.fig
113                 fig2dev -D +$(notdir $*) -L eps <$< >$@.tmp
114                 @mv -f $@.tmp $@
115
116 PANDEMICQUARANTINES_NUMBERS=1 2
117 PANDEMICQUARANTINES_DXFS=$(foreach l,$(PANDEMICQUARANTINES_NUMBERS), \
118         pandemic-quarantine-l$l.dxf)
119
120 pandemic-quarantine-numbers: $(PANDEMICQUARANTINES_DXFS)
121 pandemic-quarantine%.stl: $(PANDEMICQUARANTINES_DXFS)
122
123 .PRECIOUS: pandemic-quarantine-l%.eps
124 pandemic-quarantine-l%.eps: pandemic-quarantine-numbers.fig
125                 fig2dev -D +$(notdir $*) -L eps <$< >$@.tmp
126                 @mv -f $@.tmp $@
127
128 FILAMENTSPOOL_NUMBERS=$(shell seq 300 100 1500)
129 filamentspool-number-n%.eps:    filamentspool-number.eps.pl
130         ./$< $* >$@.tmp && mv -f $@.tmp $@
131
132 FILAMENTSPOOL_DXFS=$(foreach n,$(FILAMENTSPOOL_NUMBERS), \
133         filamentspool-number-n$n.dxf)
134
135 $(addsuffix .auto.stl, $(foreach f,$(FILAMENTSPOOL_AUTOS),$(shell \
136         ./toplevel-find $f))): $(FILAMENTSPOOL_DXFS)
137
138 filamentspool-numbers filamentspool.stl: $(FILAMENTSPOOL_DXFS)
139
140 SCREWRECESSTEST_SIZES= 2 3 4 5 6
141 SCREWRECESSTEST_DXFS=$(foreach s,$(SCREWRECESSTEST_SIZES), \
142         screw-recess-test-number-s$s.dxf)
143
144 screw-recess-test-number-s%.fig: screw-recess-test-number.fig.pl
145         ./$< $* >$@.tmp && mv -f $@.tmp $@
146
147 screw-recess-test-number-s%.eps: screw-recess-test-number-s%.fig
148                 fig2dev -L eps <$< >$@.tmp
149                 @mv -f $@.tmp $@
150
151 screw-recess-test-numbers screw-recess-test.stl: $(SCREWRECESSTEST_DXFS)
152
153 question-question.eps: question-question.fig
154                 fig2dev -L eps <$< >$@.tmp
155                 @mv -f $@.tmp $@
156
157 question-token.stl: question-question.dxf
158
159 lemon-stand.stl: lemon-stand.scad
160
161 .PRECIOUS: $(SCREWRECESSTEST_DXFS) $(SCREWRECESSTEST_DXFS) \
162         $(foreach s,$(SCREWRECESSTEST_SIZES), \
163                 screw-recess-test-number-s$s.fig \
164                 screw-recess-test-number-s$s.eps)
165
166 %.dxf:          %.eps
167                 pstoedit -dt -f "dxf: -polyaslines -mm" $< $@
168
169 %:              %.pl
170                 ./$< >$@.tmp && mv -f $@.tmp $@
171
172 %:              %.m4
173                 $(M4) -P >$@.tmp $< && mv -f $@.tmp $@
174
175 .PRECIOUS: %.auto.scad
176 %.auto.scad: $(PLAY)/toplevel-make Makefile $(PLAY)/toplevel-find
177                 @echo ' write $@'
178                 $< $@ >$@.tmp
179                 @mv -f $@.tmp $@
180
181 .PRECIOUS:      %.stl %.gcode %.eps %.dxf
182
183 clean:
184                 rm -f *~ *.stl *.auto.scad *.gcode .*.d $(AUTO_INCS)