# Makefile -- 小型の電動アクチュエーター制御 FPGA(iCE40 UP5K)
#   make all     : 検査 → 検証 → 波形 → 合成・配置配線 → 設計書 → MANIFEST
#   make lint / sim / mutation / waves / impl / doc / repro / clean
SHELL := /bin/bash
.PHONY: all build lint sim mutation waves impl doc manifest repro clean

all: build doc manifest

build: lint sim mutation waves impl

lint:
	bash scripts/run_lint.sh

sim:
	bash scripts/run_sim.sh
	python3 scripts/summarize_sim.py

mutation:
	bash scripts/run_mutation.sh

waves:
	python3 scripts/make_waves.py
	node scripts/svg2png.js doc/block_diagram.svg doc/block_diagram.png 2

impl:
	mkdir -p build
	bash scripts/run_impl.sh

doc:
	bash scripts/tool_versions.sh >/dev/null
	source scripts/env.sh && python3 scripts/build_doc.py
	node scripts/html2pdf.js doc/design.html doc/design.pdf

manifest:
	bash scripts/make_manifest.sh

repro:
	bash scripts/check_repro.sh

clean:
	rm -rf build results doc/design.html doc/design.pdf doc/block_diagram.png
