From 3ee2ef68052aa5a8aa0f620cdebd03c2038835f8 Mon Sep 17 00:00:00 2001 From: Samuel Justus Schwertfeger <113480134+SamuelSchwertfeger@users.noreply.github.com> Date: Fri, 2 Oct 2026 17:45:19 -0400 Subject: [PATCH] build: add Windows Makefile (tectonic + cmd.exe) - Makefile.windows mirrors Makefile.mac targets; recipes run in cmd.exe so it works from cmd, PowerShell and Git Bash with a native GNU make - README: Windows build/toolchain notes, fix CTAN latexmk link --- Makefile.windows | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 12 ++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Makefile.windows diff --git a/Makefile.windows b/Makefile.windows new file mode 100644 index 0000000..14a218f --- /dev/null +++ b/Makefile.windows @@ -0,0 +1,48 @@ +# Recipes use cmd.exe syntax; run with a native GNU make (make or mingw32-make). +SHELL := cmd.exe +TEX := tectonic +OUTDIR := build +CONST_TEX := constitution.tex +CONST_PDF := $(OUTDIR)/constitution.pdf +BYLAW_TEX := bylaws.tex +BYLAW_PDF := $(OUTDIR)/bylaws.pdf + +TEX_SOURCES := $(CONST_TEX) $(BYLAW_TEX) + +.PHONY: all constitution bylaws open open-bylaws clean watch help + +help: + @echo Targets: + @echo make constitution Build constitution PDF ($(CONST_PDF)) + @echo make bylaws Build bylaws PDF ($(BYLAW_PDF)) + @echo make all Build constitution + bylaws + @echo make open Build and open the constitution PDF + @echo make open-bylaws Build and open the bylaws PDF + @echo make watch Rebuild on file changes (Ctrl+C to stop) + @echo make clean Remove build output + +all: constitution bylaws + +constitution: $(CONST_PDF) +bylaws: $(BYLAW_PDF) + +$(CONST_PDF): $(CONST_TEX) + @if not exist $(OUTDIR) mkdir $(OUTDIR) + $(TEX) -X compile $(CONST_TEX) --outdir $(OUTDIR) + +$(BYLAW_PDF): $(BYLAW_TEX) + @if not exist $(OUTDIR) mkdir $(OUTDIR) + $(TEX) -X compile $(BYLAW_TEX) --outdir $(OUTDIR) + +open: constitution + start "" "$(subst /,\,$(CONST_PDF))" + +open-bylaws: bylaws + start "" "$(subst /,\,$(BYLAW_PDF))" + +watch: + @echo Watching .tex files for changes... + @powershell -NoProfile -Command "while ($$true) { & '$(MAKE)' -s all; Start-Sleep -Seconds 1 }" + +clean: + @if exist $(OUTDIR)\*.pdf del /q $(OUTDIR)\*.pdf diff --git a/README.md b/README.md index 90419e2..74d4e7e 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ cp Makefile.linux Makefile # macOS (uses tectonic) cp Makefile.mac Makefile + +# Windows (uses tectonic; in cmd/PowerShell: copy Makefile.windows Makefile) +cp Makefile.windows Makefile ``` Then build: @@ -41,14 +44,19 @@ make watch-bylaws # rebuild bylaws on change ``` On Linux this uses `latexmk -pvc`. On macOS it uses `fswatch` -(`brew install fswatch`). +(`brew install fswatch`). On Windows `make watch` re-runs `make all` every second +via PowerShell (there is no separate `watch-bylaws`). ## Toolchain -- **Linux:** [`latexmk`](https://m%67.ctan.org/pkg/latexmk) plus a TeX distribution +- **Linux:** [`latexmk`](https://ctan.org/pkg/latexmk) plus a TeX distribution (e.g. TeX Live: `sudo apt install texlive-full` or a smaller subset). - **macOS:** [Tectonic](https://tectonic-typesetting.github.io/) (`brew install tectonic`) — self-contained, downloads packages on demand. +- **Windows:** Tectonic (`winget install TectonicProject.Tectonic` or + `scoop install tectonic`) plus a native GNU make (`winget install ezwinports.make`, + `scoop install make`, or `mingw32-make`). The Makefile runs its recipes in + `cmd.exe`, so it works from cmd, PowerShell, or Git Bash. Either toolchain works on either OS; the split just reflects the most common setup for each. CI builds with Tectonic.