chiark / gitweb /
Introduce o alias for capturing stdout to $@
[reprap-play.git] / reprap-objects.make
index 9d9bf54c46bfc3bb4b41e456fc7e9ff98ed939e2..d47a23cfc735040cc73b40466e0298f4f11d99fa 100644 (file)
@@ -40,6 +40,9 @@ stls:         $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
 %.auto.stls:
        $(MAKE) $(addsuffix .auto.stl, $(shell $(DUTILS)/toplevel-find $*))
 
+i=mv -f $@.tmp $@
+o= >$@.tmp && $i
+
 -include .*.d
 
 %.stl:         %.scad $(AUTO_INCS)
@@ -52,28 +55,28 @@ stls:               $(addsuffix .auto.stl, $(AUTO_TOPLEVELS))
 AUTOBASE=$(shell echo $(1) | perl -pe 's/,\w+\.auto$$//')
 
 %:             %.cpp
-               cpp -nostdinc -P <$< >$@.tmp && mv -f $@.tmp $@
+               cpp -nostdinc -P <$< $o
 
 funcs.scad:    diziet-utils/funcs.scad.cpp
-               cpp -nostdinc -P $< >$@.tmp && mv -f $@.tmp $@
+               cpp -nostdinc -P $< $o
 
 %.gcode:       manual-gcode-generator %.m-g
-               $(CWD)/$^ >$@.tmp && mv -f $@.tmp $@
+               $(CWD)/$^ $o
 
 %.dxf:         %.eps
                pstoedit -dt -f "dxf: -polyaslines -mm" $< $@
 
 %:             %.pl
-               ./$< >$@.tmp && mv -f $@.tmp $@
+               ./$< $o
 
 %:             %.m4
-               $(M4) -P >$@.tmp $< && mv -f $@.tmp $@
+               $(M4) -P >$@.tmp $< && $i
 
 .PRECIOUS: %.auto.scad
 %.auto.scad: $(DUTILS)/toplevel-make Makefile $(DUTILS)/toplevel-find
                @echo ' write $@'
                $< $@ >$@.tmp
-               @mv -f $@.tmp $@
+               @$i
 
 .PRECIOUS:     %.stl %.gcode %.eps %.dxf