mixtape/makefile
Emil Miler 8b25dbdca2
Some checks failed
Build / build (push) Failing after 3s
Use shell to invoke ChordPro
This allows us to run the makefile with or without a shell function
with Docker. This should work both locally and during build in the
pipeline.
2024-06-01 11:53:13 +02:00

33 lines
758 B
Makefile

SRC_DIR := $(wildcard content/*)
SRC_EXTENSION := .cho
SONG_CHO := $(foreach dir,$(SRC_DIR),$(wildcard $(dir)/*$(SRC_EXTENSION)))
SONG_PDF := $(patsubst %$(SRC_EXTENSION),%.pdf,$(SONG_CHO))
SONG_HTML := $(patsubst %$(SRC_EXTENSION),%.html,$(SONG_CHO))
SONGBOOK := songbook.pdf
SHELL := $(shell echo $$SHELL)
.DEFAULT_GOAL := all
%.pdf: %$(SRC_EXTENSION)
$(SHELL) -c 'chordpro --config=chordpro.json -o $@ $<'
%.html: %$(SRC_EXTENSION)
$(SHELL) -c 'chordpro --config=chordpro.json -o $@ $<'
all: $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)
$(SONGBOOK): $(SONG_PDF)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^
.PHONY: html
html: $(SONG_HTML)
.PHONY: pdf
pdf: $(SONG_PDF)
.PHONY: clean
clean:
rm -f $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)