ifdef CHORDPRO_PIPELINE CHORDPRO_CMD = chordpro else CHORDPRO_CMD = docker run -ti --rm --env HOME=$(HOME) --env USER=$(USER) --workdir $(shell pwd) --volume $(HOME):$(HOME) chordpro/chordpro:latest chordpro --config=chordpro.json endif 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 .DEFAULT_GOAL := pdf %.pdf: %$(SRC_EXTENSION) $(CHORDPRO_CMD) -o $@ $< %.html: %$(SRC_EXTENSION) $(CHORDPRO_CMD) -o $@ $< all: pdf html songbook $(SONGBOOK): $(SONG_PDF) gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^ .PHONY: html html: $(SONG_HTML) .PHONY: pdf pdf: $(SONG_PDF) .PHONY: songbook songbook: pdf $(MAKE) $(SONGBOOK) .PHONY: clean clean: rm -f $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)