OUTPUT_DIR=out LETTER_FLAG=-d letter NEW_CLEF_FLAG=-d modern-clefs LILYPOND=lilypond ### Templates SCORES= define COMMAND_template $(LILYPOND) $(3) -o $(OUTPUT_DIR)/$(1)$(2) $(1).ly endef define SCORE_RULE_template $(1)$(2): $(call COMMAND_template,$(1),$(2),$(3)) .PHONY: $(1)$(2) endef define ALL_SCORE_RULES_template $(call SCORE_RULE_template,$(1),,) $(call SCORE_RULE_template,$(1),-new-clefs,$(NEW_CLEF_FLAG)) $(call SCORE_RULE_template,$(1),-letter,$(LETTER_FLAG)) $(call SCORE_RULE_template,$(1),-letter-new-clefs,$(LETTER_FLAG) $(NEW_CLEF_FLAG)) SCORES+=$(1) SCORE_TARGETS+=$(1) $(1)-letter endef ### Actual rule definitions $(eval $(call ALL_SCORE_RULES_template,AspiratioMentisAdDeum)) $(eval $(call ALL_SCORE_RULES_template,DialogusInterJesumEtHominem)) $(eval $(call ALL_SCORE_RULES_template,SalveRegina)) all: $(SCORE_TARGETS) help: @echo "usage: make " @echo "score-rule:" @echo " Build a A4 PDF score, with original clefs" @echo " -new-clefs Build a A4 PDF score, with treble&bass clefs" @echo " -letter Build a Letter PDF score, with original clefs" @echo " -letter-new-clefs Build a Letter PDF score, with treble&bass clefs" @echo "score: $(SCORES)" .PHONY: help