BUILDDIR=build SRCDIR=parts VPATH = $(SRCDIR) STL_TARGETS = $(patsubst $(SRCDIR)/%.scad,$(BUILDDIR)/%.stl,$(wildcard $(SRCDIR)/*.scad)) all: $(STL_TARGETS) $(BUILDDIR)/%.stl: %.scad mkdir -p ${BUILDDIR} openscad -o $@ $^