Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. jinhwanlazy created this gist Mar 5, 2017.
    18 changes: 18 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    BUILDDIR = build
    SRCDIR = src

    OPENSCAD:=$(shell type -p openscad || echo /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD)

    VPATH = $(SRCDIR):$(BUILDDIR)

    STL_TARGETS = $(patsubst $(SRCDIR)/%.scad,$(BUILDDIR)/%.stl,$(wildcard $(SRCDIR)/*.scad))

    .PHONY: all clean
    all: $(STL_TARGETS)

    $(BUILDDIR)/%.stl: %.scad
    mkdir -p ${BUILDDIR}
    ${OPENSCAD} -o $@ $<

    clean:
    rm -f ${BUILDDIR}/*.stl