mixtape/makefile

48 lines
1.6 KiB
Makefile

MIXTAPE_DIR := mixtape
CLASSIC_DIR := classic
SRC_EXTENSION := .cho
MIXTAPE_FILES := $(wildcard $(MIXTAPE_DIR)/*$(SRC_EXTENSION))
CLASSIC_FILES := $(wildcard $(CLASSIC_DIR)/*$(SRC_EXTENSION))
MIXTAPE_PDF := $(patsubst $(MIXTAPE_DIR)/%$(SRC_EXTENSION), $(MIXTAPE_DIR)/%.pdf, $(MIXTAPE_FILES))
CLASSIC_PDF := $(patsubst $(CLASSIC_DIR)/%$(SRC_EXTENSION), $(CLASSIC_DIR)/%.pdf, $(CLASSIC_FILES))
MIXTAPE_HTML := $(patsubst $(MIXTAPE_DIR)/%$(SRC_EXTENSION), $(MIXTAPE_DIR)/%.html, $(MIXTAPE_FILES))
CLASSIC_HTML := $(patsubst $(CLASSIC_DIR)/%$(SRC_EXTENSION), $(CLASSIC_DIR)/%.html, $(CLASSIC_FILES))
MIXTAPE_SONGBOOK := mixtape.pdf
CLASSIC_SONGBOOK := classic.pdf
.DEFAULT_GOAL := all
$(MIXTAPE_DIR)/%.pdf: $(MIXTAPE_DIR)/%$(SRC_EXTENSION)
chordpro --config=chordpro.json -o $@ $<
$(MIXTAPE_DIR)/%.html: $(MIXTAPE_DIR)/%$(SRC_EXTENSION)
chordpro --config=chordpro.json -o $@ $<
$(CLASSIC_DIR)/%.pdf: $(CLASSIC_DIR)/%$(SRC_EXTENSION)
chordpro --config=chordpro.json -o $@ $<
$(CLASSIC_DIR)/%.html: $(CLASSIC_DIR)/%$(SRC_EXTENSION)
chordpro --config=chordpro.json -o $@ $<
all: $(MIXTAPE_PDF) $(MIXTAPE_HTML) $(CLASSIC_PDF) $(CLASSIC_HTML) $(MIXTAPE_SONGBOOK) $(CLASSIC_SONGBOOK)
$(MIXTAPE_SONGBOOK): $(MIXTAPE_PDF)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^
$(CLASSIC_SONGBOOK): $(CLASSIC_PDF)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@ $^
.PHONY: html
html: $(MIXTAPE_HTML) $(CLASSIC_HTML)
.PHONY: pdf
pdf: $(MIXTAPE_PDF) $(CLASSIC_PDF) $(MIXTAPE_SONGBOOK) $(CLASSIC_SONGBOOK)
.PHONY: clean
clean:
rm -f $(MIXTAPE_PDF) $(MIXTAPE_HTML) $(CLASSIC_PDF) $(CLASSIC_HTML) $(MIXTAPE_SONGBOOK) $(CLASSIC_SONGBOOK)