From 3249aa12ff78e3998a82f579db049819aab8b97e Mon Sep 17 00:00:00 2001 From: Stavros Kounis Date: Wed, 26 Jun 2024 14:18:04 +0000 Subject: [PATCH] feat(makefile) Produce a combined .epub file including the arf.md and all the annexes available in .md #190 --- Makefile | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 56d2094..3400d22 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,8 @@ SOURCE_DOCS := $(wildcard docs/*.md) BUILD_DIR :=./build +EPUB_OUTPUT := $(BUILD_DIR)/epub/arf+annexes.epub +MD_FILES := docs/arf.md $(sort $(wildcard docs/annexes/*/*.md)) SITE_DIR :=./site EXPORTED_DOCS=\ $(SOURCE_DOCS:.md=.pdf) \ @@ -32,6 +34,13 @@ PANDOC_PDF_OPTIONS= --pdf-engine=xelatex PANDOC_DOCX_OPTIONS= PANDOC_EPUB_OPTIONS=--to epub3 +# Check if the pandoc is installed +check-pandoc: + @which pandoc > /dev/null || (echo "Pandoc not found, installing..." && make install-pandoc) + +install-pandoc: + sudo apt-get update && sudo apt-get install -y pandoc + # Pattern-matching Rules %.pdf : %.md @@ -49,10 +58,15 @@ PANDOC_EPUB_OPTIONS=--to epub3 # Targets and dependencies -.PHONY: all clean +.PHONY: all clean combined.epub all : $(EXPORTED_DOCS) mkdocs +# Target to create an EPUB from arf.md and all the annexes. +epub: check-pandoc + mkdir -p $(BUILD_DIR)/epub + $(PANDOC) $(PANDOC_OPTIONS) $(PANDOC_EPUB_OPTIONS) -o $(EPUB_OUTPUT) $(MD_FILES) + mkdocs: $(MKDOCS) build