From e8971ac0945dd0d0f3dfbdf47cf6c78dd75d5b44 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:03:29 +0200 Subject: [PATCH] use template target for folder creation --- Makefile | 36 +++++++++--------------------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index c753bc0..1a7a4c4 100644 --- a/Makefile +++ b/Makefile @@ -20,44 +20,26 @@ LY_MIDIS=$(patsubst %.ly,${BUILD_MIDI_DIR}/%.midi,$(notdir ${LY_FILES})) LY_TMP_MIDIS=$(patsubst %.ly,${TMP_MIDI_DIR}/%.midi,$(notdir ${LY_FILES})) LY_OPUS=$(patsubst %.ly,${BUILD_OPUS_DIR}/%.opus,$(notdir ${LY_FILES})) -.PHONY: book songs midi opus clean directories all +.PHONY: book songs midi opus clean all .DEFAULT_GOAL := all -${BUILD_BOOK_DIR}: - mkdir -p ${BUILD_BOOK_DIR} +%.dir: + mkdir -p $* -${BUILD_SONG_DIR}: - mkdir -p ${BUILD_SONG_DIR} - -${BUILD_MIDI_DIR}: - mkdir -p ${BUILD_MIDI_DIR} - -${TMP_BOOK_DIR}: - mkdir -p ${TMP_BOOK_DIR} - -${TMP_SONG_DIR}: - mkdir -p ${TMP_SONG_DIR} - -${TMP_MIDI_DIR}: - mkdir -p ${TMP_MIDI_DIR} - -${BUILD_OPUS_DIR}: - mkdir -p ${BUILD_OPUS_DIR} - -${TMP_SONG_DIR}/%.pdf: ${SONG_DIR}/%.ly ${SONG_DIR}/%.tex | ${TMP_SONG_DIR} +${TMP_SONG_DIR}/%.pdf: ${SONG_DIR}/%.ly ${SONG_DIR}/%.tex | ${TMP_SONG_DIR}.dir cd ${SRC_DIR} && lualatex --jobname='$(notdir $(basename $@))' --output-directory=${WORKING_DIR}/${TMP_SONG_DIR} --shell-escape ${WORKING_DIR}/${SRC_DIR}/song.tex ${WORKING_DIR}/${SONG_DIR}/$(notdir $(basename $@)).ly ${WORKING_DIR}/${SONG_DIR}/$(notdir $(basename $@)).tex rm -r ${SRC_DIR}/tmp-ly -${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi | ${BUILD_MIDI_DIR} +${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi | ${BUILD_MIDI_DIR}.dir cp $< $@ -${TMP_MIDI_DIR}/%-1.midi: ${SONG_DIR}/%.ly | ${TMP_MIDI_DIR} +${TMP_MIDI_DIR}/%-1.midi: ${SONG_DIR}/%.ly | ${TMP_MIDI_DIR}.dir lilypond --output=${TMP_MIDI_DIR} ${WORKING_DIR}/$< -${BUILD_OPUS_DIR}/%.opus: ${BUILD_MIDI_DIR}/%.midi | ${BUILD_OPUS_DIR} +${BUILD_OPUS_DIR}/%.opus: ${BUILD_MIDI_DIR}/%.midi | ${BUILD_OPUS_DIR}.dir timidity $< -Ow -o - | opusenc - $@ -${TMP_BOOK_DIR}/%.pdf: ${SRC_DIR}/%.tex ${SRC_DIR}/images/title.png | ${TMP_BOOK_DIR} +${TMP_BOOK_DIR}/%.pdf: ${SRC_DIR}/%.tex ${SRC_DIR}/images/title.png | ${TMP_BOOK_DIR}.dir latexmk -cd -lualatex -e '$$lualatex=q/lualatex %O -shell-escape %S/' -output-directory=${WORKING_DIR}/${TMP_BOOK_DIR} $< rm -r ${SRC_DIR}/tmp-ly @@ -79,7 +61,7 @@ ${TMP_BOOK_DIR}/%-octavo.pdf: ${TMP_BOOK_DIR}/%.pdf cd ${TMP_BOOK_DIR} && \ ../../bin/makebook -v -t octavo -i $(notdir $<) -o $(notdir $@) -${BUILD_DIR}/%.pdf: ${TMP_DIR}/%.pdf | ${BUILD_BOOK_DIR} ${BUILD_SONG_DIR} +${BUILD_DIR}/%.pdf: ${TMP_DIR}/%.pdf | ${BUILD_BOOK_DIR}.dir ${BUILD_SONG_DIR}.dir cp $< $@ book: ${BUILD_BOOK_DIR}/${BOOKNAME}.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-folio.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-quarto.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-sexto.pdf ${BUILD_BOOK_DIR}/${BOOKNAME}-octavo.pdf ${LY_FILES}