mixtape/makefile

41 lines
940 B
Makefile
Raw Normal View History

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
2024-06-03 09:54:05 +02:00
.DEFAULT_GOAL := pdf
2023-12-28 01:13:23 +01:00
2024-02-06 14:18:25 +01:00
%.pdf: %$(SRC_EXTENSION)
$(CHORDPRO_CMD) -o $@ $<
2023-12-28 01:13:23 +01:00
2024-02-06 14:18:25 +01:00
%.html: %$(SRC_EXTENSION)
$(CHORDPRO_CMD) -o $@ $<
2023-12-28 01:13:23 +01:00
2024-06-03 09:54:05 +02:00
all: pdf 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
2024-06-03 09:54:05 +02:00
.PHONY: songbook
songbook: pdf
$(MAKE) $(SONGBOOK)
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)