1 # reprap-objects Makefile, reuseable parts
3 # Build scripts for various 3D designs
5 # Copyright 2012-2023 Ian Jackson
7 # This work is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This work is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this work. If not, see <http://www.gnu.org/licenses/>.
24 DUTILS ?= $(CWD)/diziet-utils
25 PLAY ?= $(CWD) # deprecated, for compatibility only
27 AUTO_TOPLEVELS := $(foreach m,$(USING_AUTOS),$(shell $(DUTILS)/toplevel-find $m))
29 AUTO_INCS += funcs.scad
31 default: autoincs scads
33 $(shell set -xe; $(DUTILS)/commitid.scad.pl >commitid.scad.tmp; cmp commitid.scad.tmp commitid.scad || mv -f commitid.scad.tmp commitid.scad )
35 autoincs: $(AUTO_INCS) $(AUTO_STLS_INCS)
36 scads: $(addsuffix .auto.scad, $(AUTO_TOPLEVELS))
37 stls: $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
40 $(MAKE) $(addsuffix .auto.scad, $(shell $(DUTILS)/toplevel-find $*))
42 $(MAKE) $(addsuffix .auto.stl, $(shell $(DUTILS)/toplevel-find $*))
49 %.stl: %.scad $(AUTO_INCS)
50 openscad -d .$@.d.tmp -o $*.tmp.stl $<
52 @sed -e 's/\.tmp\.stl:/.stl:/' <.$@.d.tmp >.$@.d
56 AUTOBASE=$(shell echo $(1) | perl -pe 's/,\w+\.auto$$//')
59 cpp -nostdinc -P <$< $o
61 funcs.scad: diziet-utils/funcs.scad.cpp
62 cpp -nostdinc -P $< $o
64 %.gcode: manual-gcode-generator %.m-g
68 pstoedit -dt -f "dxf: -polyaslines -mm" $< $@
74 $(M4) -P >$@.tmp $< && $i
76 .PRECIOUS: %.auto.scad
77 %.auto.scad: $(DUTILS)/toplevel-make Makefile $(DUTILS)/toplevel-find
82 .PRECIOUS: %.stl %.gcode %.eps %.dxf
85 rm -f *~ *.stl *.auto.scad *.gcode .*.d $(AUTO_INCS)