1 # reprap-objects Makefile, reuseable parts
3 # Build scripts for various 3D designs
4 # Copyright 2012-2016 Ian Jackson
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.
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.
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/>.
23 DUTILS ?= $(CWD)/diziet-utils
24 PLAY ?= $(CWD) # deprecated, for compatibility only
26 AUTO_TOPLEVELS := $(foreach m,$(USING_AUTOS),$(shell $(DUTILS)/toplevel-find $m))
28 AUTO_INCS += funcs.scad
30 default: autoincs scads
32 $(shell set -xe; $(DUTILS)/commitid.scad.pl >commitid.scad.tmp; cmp commitid.scad.tmp commitid.scad || mv -f commitid.scad.tmp commitid.scad )
34 autoincs: $(AUTO_INCS) $(AUTO_STLS_INCS)
35 scads: $(addsuffix .auto.scad, $(AUTO_TOPLEVELS))
36 stls: $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
39 $(MAKE) $(addsuffix .auto.scad, $(shell $(DUTILS)/toplevel-find $*))
41 $(MAKE) $(addsuffix .auto.stl, $(shell $(DUTILS)/toplevel-find $*))
48 %.stl: %.scad $(AUTO_INCS)
49 openscad -d .$@.d.tmp -o $*.tmp.stl $<
51 @sed -e 's/\.tmp\.stl:/.stl:/' <.$@.d.tmp >.$@.d
55 AUTOBASE=$(shell echo $(1) | perl -pe 's/,\w+\.auto$$//')
58 cpp -nostdinc -P <$< $o
60 funcs.scad: diziet-utils/funcs.scad.cpp
61 cpp -nostdinc -P $< $o
63 %.gcode: manual-gcode-generator %.m-g
67 pstoedit -dt -f "dxf: -polyaslines -mm" $< $@
73 $(M4) -P >$@.tmp $< && $i
75 .PRECIOUS: %.auto.scad
76 %.auto.scad: $(DUTILS)/toplevel-make Makefile $(DUTILS)/toplevel-find
81 .PRECIOUS: %.stl %.gcode %.eps %.dxf
84 rm -f *~ *.stl *.auto.scad *.gcode .*.d $(AUTO_INCS)