Skip to content

Instantly share code, notes, and snippets.

@choffee
Last active January 19, 2016 22:23
Show Gist options
  • Save choffee/5a4f06abebdbc832b144 to your computer and use it in GitHub Desktop.
Save choffee/5a4f06abebdbc832b144 to your computer and use it in GitHub Desktop.
# Makefile for OpenScad
#
# Copy of http://social.gl-como.it/display/3e3ce0df2355b11e6937f69900231262
#
BUILDDIR = build
CONFDIR = conf
SRCDIR = src
SLIC3R = slic3r
VPATH = $(SRCDIR):$(BUILDDIR)
STL_TARGETS = $(patsubst $(SRCDIR)/%.scad,$(BUILDDIR)/%.stl,$(wildcard $(SRCDIR)/*.scad))
GCODE_TARGETS = $(patsubst $(SRCDIR)/%.scad,$(BUILDDIR)/%.gcode,$(wildcard $(SRCDIR)/*.scad))
.PHONY: all gcode clean
all: $(STL_TARGETS)
gcode: $(GCODE_TARGETS)
$(BUILDDIR)/%.stl: %.scad $(SRCDIR)/lib/*
mkdir -p ${BUILDDIR}
openscad -o $@ $<
$(BUILDDIR)/%.gcode: %.stl ${CONFDIR}/basic.ini
${SLIC3R} --load ${CONFDIR}/basic.ini $<
clean:
rm -f ${BUILDDIR}/*.stl ${BUILDDIR}/*.gcode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment