use template target for folder creation

This commit is contained in:
Sebastian Hugentobler 2022-04-18 15:03:29 +02:00
parent 660a08779c
commit e8971ac094
Signed by: shu
GPG Key ID: BB32CF3CA052C2F0

View File

@ -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_TMP_MIDIS=$(patsubst %.ly,${TMP_MIDI_DIR}/%.midi,$(notdir ${LY_FILES}))
LY_OPUS=$(patsubst %.ly,${BUILD_OPUS_DIR}/%.opus,$(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 .DEFAULT_GOAL := all
${BUILD_BOOK_DIR}: %.dir:
mkdir -p ${BUILD_BOOK_DIR} mkdir -p $*
${BUILD_SONG_DIR}: ${TMP_SONG_DIR}/%.pdf: ${SONG_DIR}/%.ly ${SONG_DIR}/%.tex | ${TMP_SONG_DIR}.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}
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 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 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 $< $@ 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}/$< 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 - $@ 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} $< latexmk -cd -lualatex -e '$$lualatex=q/lualatex %O -shell-escape %S/' -output-directory=${WORKING_DIR}/${TMP_BOOK_DIR} $<
rm -r ${SRC_DIR}/tmp-ly rm -r ${SRC_DIR}/tmp-ly
@ -79,7 +61,7 @@ ${TMP_BOOK_DIR}/%-octavo.pdf: ${TMP_BOOK_DIR}/%.pdf
cd ${TMP_BOOK_DIR} && \ cd ${TMP_BOOK_DIR} && \
../../bin/makebook -v -t octavo -i $(notdir $<) -o $(notdir $@) ../../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 $< $@ 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} 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}