Files
letterpress/Makefile
Dunya Kirkali 0f64b1133e Add Nix flake for reproducible dev and CI/CD
- flake.nix pins the full toolchain (asciidoctor + pdf/epub3/diagram/
  mathematical, plantuml, graphviz, jre, vale, epubcheck) via bundlerEnv
- Gemfile/Gemfile.lock/gemset.nix lock the Ruby gems; work around the
  vendored mtex2MML cmake_minimum_required incompatibility
- 'nix build' produces book.pdf + book.epub; 'nix develop' gives a shell
  where all existing make targets work
- CI/CD workflows now install Nix and build/lint/validate through the flake
- devcontainer uses Nix; add .envrc for direnv; document in README

Co-authored-by: Shelley <shelley@exe.dev>
2026-08-08 22:27:23 +02:00

55 lines
1.1 KiB
Makefile

SOURCE_FOLDER := source
SHELL := bash
ASCIIDOC_FILES := $(wildcard $(SOURCE_FOLDER)/*.adoc)
FIGURES = $(shell find . -name '*.svg')
PDF_NAME := book.pdf
PDF_PATH := output/$(PDF_NAME)
EPUB_NAME := book.epub
EPUB_PATH := output/$(EPUB_NAME)
ASCIIDOC_FLAGS = \
--doctype book
.PHONY: all count clean lint epubcheck
all: $(PDF_PATH) $(EPUB_PATH)
$(PDF_PATH): $(ASCIIDOC_FILES) $(FIGURES) Makefile metadata.yaml | output
asciidoctor-pdf book.adoc $(ASCIIDOC_FLAGS) \
-o $@ \
-r asciidoctor-diagram \
-r asciidoctor-mathematical
$(EPUB_PATH): $(ASCIIDOC_FILES) $(FIGURES) Makefile metadata.yaml | output
asciidoctor-epub3 book.adoc $(ASCIIDOC_FLAGS) \
-o $@ \
-r asciidoctor-diagram \
-r asciidoctor-mathematical
count:
@dir="$(SOURCE_FOLDER)"; \
total=0; \
while read -r file; do \
words=$$(wc -w < "$$file"); \
total=$$((total + words)); \
printf "%6d %s\n" "$$words" "$$file"; \
done < <(find "$$dir" -type f -name "*.adoc" | sort); \
printf "%6d total\n" "$$total"
epubcheck: $(EPUB_PATH)
epubcheck $(EPUB_PATH)
output:
mkdir output
clean:
rm -vrf output
lint:
vale source/