chiark / gitweb /
Delete some more obsolete gcode generation runes
[reprap-play.git] / diziet-utils / reprap-objects.make
1 # reprap-objects Makefile, reuseable parts
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 M4=m4
21
22 CWD := $(shell pwd)
23 PLAY ?= $(CWD)
24
25 AUTO_TOPLEVELS := $(foreach m,$(USING_AUTOS),$(shell $(PLAY)/toplevel-find $m))
26
27 AUTO_INCS += funcs.scad
28
29 default:        autoincs scads
30
31 $(shell set -xe; $(PLAY)/commitid.scad.pl >commitid.scad.tmp; cmp commitid.scad.tmp commitid.scad || mv -f commitid.scad.tmp commitid.scad )
32
33 autoincs:       $(AUTO_INCS) $(AUTO_STLS_INCS)
34 scads:          $(addsuffix .auto.scad, $(AUTO_TOPLEVELS))
35 stls:           $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
36
37 %.auto.scads: %.scad
38         $(MAKE) $(addsuffix .auto.scad, $(shell $(PLAY)/toplevel-find $*))
39 %.auto.stls:
40         $(MAKE) $(addsuffix .auto.stl, $(shell $(PLAY)/toplevel-find $*))
41
42 -include .*.d
43
44 %.stl:          %.scad $(AUTO_INCS)
45                 openscad -d .$@.d.tmp -o $*.tmp.stl $<
46                 @rm -f $@
47                 @sed -e 's/\.tmp\.stl:/.stl:/' <.$@.d.tmp >.$@.d
48                 @rm .$@.d.tmp
49                 mv -f $*.tmp.stl $@
50
51 AUTOBASE=$(shell echo $(1) | perl -pe 's/,\w+\.auto$$//')
52
53 %:              %.cpp
54                 cpp -nostdinc -P <$< >$@.tmp && mv -f $@.tmp $@
55
56 funcs.scad:
57
58 %.gcode:        manual-gcode-generator %.m-g
59                 $(PLAY)/$^ >$@.tmp && mv -f $@.tmp $@
60
61 %.dxf:          %.eps
62                 pstoedit -dt -f "dxf: -polyaslines -mm" $< $@
63
64 %:              %.pl
65                 ./$< >$@.tmp && mv -f $@.tmp $@
66
67 %:              %.m4
68                 $(M4) -P >$@.tmp $< && mv -f $@.tmp $@
69
70 .PRECIOUS: %.auto.scad
71 %.auto.scad: $(PLAY)/toplevel-make Makefile $(PLAY)/toplevel-find
72                 @echo ' write $@'
73                 $< $@ >$@.tmp
74                 @mv -f $@.tmp $@
75
76 .PRECIOUS:      %.stl %.gcode %.eps %.dxf
77
78 clean:
79                 rm -f *~ *.stl *.auto.scad *.gcode .*.d $(AUTO_INCS)
80