Files
smartbar/Makefile

47 lines
1.1 KiB
Makefile
Raw Normal View History

2025-08-10 17:17:01 -07:00
GO := $(shell which go)
ifeq (, $(GO))
$(error "Required Go toolchain (go) not in $(PATH).")
endif
PAGES := $(sort $(wildcard pages/*.html)) pages.yaml
2025-08-10 17:36:57 -07:00
TEMPLATES := $(sort $(wildcard templates/*.gohtml))
OUT_DIR := _dist
PAGES_DIR := pages
TEMPLATES_DIR := templates
2025-08-10 17:17:01 -07:00
.PHONY: serve build clean
2025-08-10 17:36:57 -07:00
build: $(OUT_DIR)/index.stamp
2025-08-10 17:17:01 -07:00
2025-08-10 17:36:57 -07:00
$(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
2025-08-10 17:17:01 -07:00
serve: build
2025-08-10 17:36:57 -07:00
@echo "Serving $(OUT_DIR) as document root..."
@xdg-open "http://localhost:8000/index.html" || true
@cd $(OUT_DIR) && python -m http.server
2025-08-10 17:17:01 -07:00
2025-08-10 17:36:57 -07:00
PDF := $(OUT_DIR)/output.pdf
PDF_2UP := $(OUT_DIR)/output-2up.pdf
2025-08-10 17:17:01 -07:00
.PHONY: deps
deps:
@$(GO) mod tidy
.PHONY: pdf
pdf: build deps
@echo "Generating PDF with headless Chrome..."
2025-08-10 17:36:57 -07:00
@$(GO) run ./cmd/pdf --in $(OUT_DIR)/print.html --out $(PDF)
2025-08-10 17:17:01 -07:00
.PHONY: pdf-2up
pdf-2up: build deps
@echo "Generating 2-up PDF with headless Chrome..."
2025-08-10 17:36:57 -07:00
@$(GO) run ./cmd/pdf --in $(OUT_DIR)/print_2up.html --out $(PDF_2UP) --w 11 --h 8.5
2025-08-10 17:17:01 -07:00
clean:
2025-08-10 17:36:57 -07:00
rm -rf $(OUT_DIR) index.html
2025-08-10 17:17:01 -07:00