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)