cleanup/namespacing

This commit is contained in:
2025-08-10 17:36:57 -07:00
parent 5c1a76f223
commit 9d5a558137
11 changed files with 50 additions and 63 deletions

View File

@@ -4,22 +4,28 @@ ifeq (, $(GO))
endif
PAGES := $(sort $(wildcard pages/*.html)) pages.yaml
TEMPLATES := $(sort $(wildcard templates/*.gohtml))
OUT_DIR := _dist
PAGES_DIR := pages
TEMPLATES_DIR := templates
.PHONY: serve build clean
build: dist/index.stamp
build: $(OUT_DIR)/index.stamp
dist/index.stamp: $(PAGES) templates/base.gohtml templates/index.gohtml templates/print.gohtml templates/print_2up.gohtml cmd/build/main.go
@$(GO) run ./cmd/build
@mkdir -p dist
@date +%s > dist/index.stamp
$(OUT_DIR)/index.stamp: $(PAGES) $(TEMPLATES) cmd/build/main.go
@$(GO) run ./cmd/build --pages $(PAGES_DIR) --out $(OUT_DIR) --templates $(TEMPLATES_DIR) --order pages.yaml
@mkdir -p $(OUT_DIR)
@date +%s > $(OUT_DIR)/index.stamp
serve: build
xdg-open "http://localhost:8000" || true
python -m http.server
@echo "Serving $(OUT_DIR) as document root..."
@xdg-open "http://localhost:8000/index.html" || true
@cd $(OUT_DIR) && python -m http.server
PDF := dist/output.pdf
PDF_2UP := dist/output-2up.pdf
PDF := $(OUT_DIR)/output.pdf
PDF_2UP := $(OUT_DIR)/output-2up.pdf
.PHONY: deps
deps:
@@ -28,13 +34,13 @@ deps:
.PHONY: pdf
pdf: build deps
@echo "Generating PDF with headless Chrome..."
@$(GO) run ./cmd/pdf --in dist/print.html --out $(PDF)
@$(GO) run ./cmd/pdf --in $(OUT_DIR)/print.html --out $(PDF)
.PHONY: pdf-2up
pdf-2up: build deps
@echo "Generating 2-up PDF with headless Chrome..."
@$(GO) run ./cmd/pdf --in dist/print_2up.html --out $(PDF_2UP) --w 11 --h 8.5
@$(GO) run ./cmd/pdf --in $(OUT_DIR)/print_2up.html --out $(PDF_2UP) --w 11 --h 8.5
clean:
rm -rf dist index.html
rm -rf $(OUT_DIR) index.html