From d87cc59f1fea91e014efb0dbacf3777fc69c7c4c Mon Sep 17 00:00:00 2001 From: "mark a. foltz" Date: Tue, 10 Feb 2026 15:29:23 -0800 Subject: [PATCH] Update Makefile --- Makefile | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 95ab967..a9090a4 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,10 @@ BIKESHED ?= bikeshed BIKESHED_ARGS ?= --print=plain -.PHONY: lint watch watch-app watch-net all +# Define all spec source files +BS_SOURCES = index.bs application.bs network.bs -# TODO: Generalize targets to reduce duplication. +.PHONY: lint watch all all: index.html application.html network.html @@ -16,28 +17,22 @@ application.html: application.bs application_messages.html network.html: network.bs network_messages.html $(BIKESHED) $(BIKESHED_ARGS) spec $< -messages_appendix.html: messages_appendix.cddl scripts/pygmentize_dir.py scripts/cddl_lexer.py scripts/openscreen_cddl_dfns.py - ./scripts/pygmentize_dir.py - -application_messages.html: application_messages.cddl scripts/pygmentize_dir.py scripts/cddl_lexer.py scripts/openscreen_cddl_dfns.py - ./scripts/pygmentize_dir.py - -network_messages.html: network_messages.cddl scripts/pygmentize_dir.py scripts/cddl_lexer.py scripts/openscreen_cddl_dfns.py - ./scripts/pygmentize_dir.py - -lint: index.bs - $(BIKESHED) $(BIKESHED_ARGS) --dry-run --force spec --line-numbers $< - -watch: index.bs - @echo 'Browse to file://${PWD}/index.html' - $(BIKESHED) $(BIKESHED_ARGS) watch $< - -watch-app: application.bs - @echo 'Browse to file://${PWD}/application.html' - $(BIKESHED) $(BIKESHED_ARGS) watch $< - -watch-net: network.bs - @echo 'Browse to file://${PWD}/network.html' - $(BIKESHED) $(BIKESHED_ARGS) watch $< - - +CDDL_SOURCES = messages_appendix.cddl application_messages.cddl network_messages.cddl +CDDL_OUTPUTS = messages_appendix.html application_messages.html network_messages.html +PYGMENTIZE_DIR = ./scripts/pygmentize_dir.py +MESSAGE_SCRIPTS = $(PYGMENTIZE_DIR) scripts/cddl_lexer.py scripts/openscreen_cddl_dfns.py + +$(CDDL_OUTPUTS) : $(CDDL_SOURCES) $(MESSAGE_SCRIPTS) + $(PYGMENTIZE_DIR) + +lint: $(BS_SOURCES) + @for file in $(BS_SOURCES); do \ + echo "Linting $$file..."; \ + $(BIKESHED) $(BIKESHED_ARGS) --dry-run --die-when=late --line-numbers spec $$file; \ + done + +watch: $(BS_SOURCES) + @for file in $(BS_SOURCES); do \ + echo "Browse to file://${PWD}/$$file"; \ + ( $(BIKESHED) $(BIKESHED_ARGS) watch $$file & ) \ + done