SHELL := /bin/sh
.DEFAULT_GOAL := help
.DELETE_ON_ERROR:
PYTHON ?= .venv/bin/python
OPENSCAD ?= $(if $(wildcard /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD),/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD,openscad)
PDFTOPPM ?= pdftoppm
BUILD := build
STL_DIR ?= ../scratch/stl/education
PDF_DIR := output/pdf

include mk/artifacts.mk
include mk/quality.mk

.PHONY: help all setup clean
help:
	@echo 'StackCalc Learning Lab | prototype collection 01'
	@echo 'make setup                 Install Python dependencies in .venv'
	@echo 'make all                   SVG + SCAD + STL + PDF + validation + download ZIP'
	@echo 'make svg scad              Generate manufacturing sources and previews'
	@echo 'make stl                   Render laser-ready parts to scratch/stl/education'
	@echo 'make pdf                   Letter/A4 reference cards and teacher booklets'
	@echo 'make check                 Check math, SVG, PDF and watertight STL geometry'
	@echo 'make render-pdf            Rasterize all PDF pages for visual review'
	@echo 'make bundle                Assemble a versioned prototype download'
	@echo 'Overrides: PYTHON=/path/to/python OPENSCAD=/path/to/openscad'

setup:
	python3 -m venv .venv
	.venv/bin/python -m pip install -r requirements.txt

all: bundle

clean:
	rm -rf build output
	rm -f $(STLS)
