Das Songbook
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.7 KiB

BUILDDIR = build/
# all ODT source files, and replace .odt by .pdf
PDF_SOURCES_SONGS := $(subst odt,pdf,$(wildcard src/Songs/*.odt))
PDF_SOURCES_EXTRA := $(subst odt,pdf,$(wildcard src/Extra/*.odt))
# replace src/*/ by build/*/
TARGETS_SONGS := $(addprefix build/Songs/,$(notdir $(PDF_SOURCES_SONGS)))
TARGETS_EXTRA := $(addprefix build/Extra/,$(notdir $(PDF_SOURCES_EXTRA)))
.PHONY: help
help: ## show this help message
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@[ -d $(BUILDDIR) ] || mkdir -p $(BUILDDIR)
.PHONY: build
build: prepare $(TARGETS_SONGS) $(TARGETS_EXTRA) index bundle archive ## build Songbook A-Y, A-Z, songbook.md and archive
build/Songs/%.pdf : src/Songs/%.odt
@soffice --headless "-env:UserInstallation=file:///tmp/LibreOffice_Conversion" --convert-to pdf:writer_pdf_Export --outdir build/Songs/ "$<"
build/Extra/%.pdf : src/Extra/%.odt
@soffice --headless "-env:UserInstallation=file:///tmp/LibreOffice_Conversion" --convert-to pdf:writer_pdf_Export --outdir build/Extra/ "$<"
@python3 scripts/create-index.py
@python3 scripts/create-index.py -t ay
@pdfunite build/Extra/Cover+Intro.pdf build/Extra/Index.pdf build/Songs/* build/Extra/Akkorde.pdf build/Songbook.pdf
@pdfunite build/Extra/Cover+Intro.pdf build/Extra/Index_A-Y.pdf build/Songs/[A-Y]* build/Extra/Akkorde.pdf build/Songbook_A-Y.pdf
@[ -e build/Songbook.tar.gz ] && rm -r build/Songbook.tar.gz || true
@cd build/ && tar czf Songbook.tar.gz *
.PHONY: clean
clean: ## remove all build artifacts
@[ -d $(BUILDDIR) ] && rm -r $(BUILDDIR) || true