forked from buzzert/smartbar
41 lines
923 B
Makefile
41 lines
923 B
Makefile
GO := $(shell which go)
|
|
ifeq (, $(GO))
|
|
$(error "Required Go toolchain (go) not in $(PATH).")
|
|
endif
|
|
|
|
PAGES := $(sort $(wildcard pages/*.html)) pages.yaml
|
|
|
|
.PHONY: serve build clean
|
|
|
|
build: dist/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
|
|
|
|
serve: build
|
|
xdg-open "http://localhost:8000" || true
|
|
python -m http.server
|
|
|
|
PDF := dist/output.pdf
|
|
PDF_2UP := dist/output-2up.pdf
|
|
|
|
.PHONY: deps
|
|
deps:
|
|
@$(GO) mod tidy
|
|
|
|
.PHONY: pdf
|
|
pdf: build deps
|
|
@echo "Generating PDF with headless Chrome..."
|
|
@$(GO) run ./cmd/pdf --in dist/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
|
|
|
|
clean:
|
|
rm -rf dist index.html
|
|
|