Files
letterpress/Makefile
Dunya Kirkali 59ff4fc3a3 Add epubcheck target for local EPUB validation (#9)
Backported from em_book's CI. Adds a 'make epubcheck' target that builds
the EPUB (via its dependency) and validates it with EPUBCheck, so authors
can catch EPUB issues locally before publishing.

- New epubcheck target depending on the EPUB path
- Document it in the README
- Add .PHONY declarations

Co-authored-by: Dunya Kirkali <exedev@writting.exe.xyz>
Co-authored-by: Shelley <shelley@exe.dev>
2026-08-08 22:05:23 +02:00

46 lines
860 B
Makefile

SOURCE_FOLDER := source
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:
wc -w source/*
epubcheck: $(EPUB_PATH)
epubcheck $(EPUB_PATH)
output:
mkdir output
clean:
rm -vrf output
lint:
vale source/