Skip to content

Instantly share code, notes, and snippets.

@kenbarbour
Last active January 8, 2022 15:50
Show Gist options
  • Save kenbarbour/5f26072ad35a5d717e3617a8159689dd to your computer and use it in GitHub Desktop.
Save kenbarbour/5f26072ad35a5d717e3617a8159689dd to your computer and use it in GitHub Desktop.
Generic Makefile for OpenSCAD
# This Makefile generates files for printing SCAD documents
# Copyright (C) 2016 Kenneth Barbour | kenbarbour.com
# License: GNU GPL v3 (or later)
## make all Generate STL for each SCAD file
## make gcode Generate gcode for each SCAD file
## SCAD Compiler
SCADC?=openscad
## Slicing program
SLICER?=slic3r
STL_TARGETS = $(patsubst %.scad,%.stl,$(wildcard *.scad))
GCODE_TARGETS = $(patsubst %.scad,%.gcode,$(wildcard *.scad))
.PHONY: all models gcode clean
all: models gcode
models: $(STL_TARGETS)
gcode: $(GCODE_TARGETS)
%.stl: %.scad
$(SCADC) -o $@ $<
%.gcode: %.stl
$(SLICER) $< -o $@
clean:
rm -f *.stl *.gcode
@kenbarbour
Copy link
Author

EDIT: removed plater and plated models because slic3r automatically does this for you and plater was an ambigous project name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment