2024-06-01 11:53:13 +02:00
|
|
|
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
|
|
|
|
|
2024-02-06 14:18:25 +01:00
|
|
|
SRC_DIR := $(wildcard content/*)
|
2023-12-28 01:13:23 +01:00
|
|
|
SRC_EXTENSION := .cho
|
|
|
|
|
2024-02-06 14:18:25 +01:00
|
|
|
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
|
2023-12-28 01:13:23 +01:00
|
|
|
|
|
|
|
.DEFAULT_GOAL := all
|
|
|
|
|
2024-02-06 14:18:25 +01:00
|
|
|
%.pdf: %$(SRC_EXTENSION)
|
2024-06-01 11:53:13 +02:00
|
|
|
$(CHORDPRO_CMD) -o $@ $<
|
2023-12-28 01:13:23 +01:00
|
|
|
|
2024-02-06 14:18:25 +01:00
|
|
|
%.html: %$(SRC_EXTENSION)
|
2024-06-01 11:53:13 +02:00
|
|
|
$(CHORDPRO_CMD) -o $@ $<
|
2023-12-28 01:13:23 +01:00
|
|
|
|
2024-02-06 14:18:25 +01:00
|
|
|
all: $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)
|
2023-12-28 01:13:23 +01:00
|
|
|
|
2024-02-06 14:18:25 +01:00
|
|
|
$(SONGBOOK): $(SONG_PDF)
|
2023-12-28 01:13:23 +01:00
|
|
|
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^
|
|
|
|
|
2023-12-28 01:18:59 +01:00
|
|
|
.PHONY: html
|
2024-02-06 14:18:25 +01:00
|
|
|
html: $(SONG_HTML)
|
2023-12-28 01:18:59 +01:00
|
|
|
|
|
|
|
.PHONY: pdf
|
2024-02-06 14:18:25 +01:00
|
|
|
pdf: $(SONG_PDF)
|
2023-12-28 01:18:59 +01:00
|
|
|
|
2023-12-28 01:13:23 +01:00
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2024-02-06 14:18:25 +01:00
|
|
|
rm -f $(SONG_PDF) $(SONG_HTML) $(SONGBOOK)
|