From 7d111332eba52bbb7080f0cc4d87a77fd569d390 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 6 Jan 2021 09:41:03 +0100 Subject: [PATCH 01/10] correct typos --- src/songs/gedanken_sind_frei.ly | 2 +- src/songs/gedanken_sind_frei.tex | 17 ++++------------- src/songs/koenig_von_preussen.ly | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/songs/gedanken_sind_frei.ly b/src/songs/gedanken_sind_frei.ly index f82a605..72cd4c8 100644 --- a/src/songs/gedanken_sind_frei.ly +++ b/src/songs/gedanken_sind_frei.ly @@ -3,7 +3,7 @@ \header { title = "Die Gedanken sind frei" - composer = "Volksweise (um 1815) " + composer = "Volksweise, um 1815" poet = "" tagline = "" } diff --git a/src/songs/gedanken_sind_frei.tex b/src/songs/gedanken_sind_frei.tex index a6b3979..4a61148 100644 --- a/src/songs/gedanken_sind_frei.tex +++ b/src/songs/gedanken_sind_frei.tex @@ -1,14 +1,5 @@ \par -2. Die Gedanken sind frei, -wer kann sie erraten, -sie fliehen vorbei, -wie nächtliche Schatten. -Kein Mensch kann sie wissen, -kein Jäger erschießen. -Es bleibet dabei: -Die Gedanken sind frei. -\par -3. Ich denke, was ich will, +2. Ich denke, was ich will, und was mich beglücket, doch alles in der Still, und wie es sich schicket. @@ -17,7 +8,7 @@ kann niemand verwehren, es bleibet dabei: die Gedanken sind frei. \par -4. Ich liebe den Wein, +3. Ich liebe den Wein, mein Mädchen vor allen, sie tut mir allein am besten gefallen. @@ -26,7 +17,7 @@ bei meinem Glas Weine, mein Mädchen dabei: die Gedanken sind frei. \par -5. Und sperrt man mich ein +4. Und sperrt man mich ein im finsteren Kerker, das alles sind rein vergebliche Werke; @@ -35,7 +26,7 @@ zerreißen die Schranken und Mauern entzwei: die Gedanken sind frei. \par -6. Drum will ich auf immer +5. Drum will ich auf immer den Sorgen entsagen und will mich auch nimmer mit Grillen mehr plagen. diff --git a/src/songs/koenig_von_preussen.ly b/src/songs/koenig_von_preussen.ly index 1d7de03..cf3e064 100644 --- a/src/songs/koenig_von_preussen.ly +++ b/src/songs/koenig_von_preussen.ly @@ -3,7 +3,7 @@ \header { title = "O König von Preußen" - composer = "Volksweise (18. Jh.)" + composer = "Volksweise, 18. Jh." poet = "" tagline = "" } From f53f7b13244259d27db526e47fb2c34ba34d94f9 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 6 Jan 2021 13:47:00 +0100 Subject: [PATCH 02/10] correct typos --- src/songs/koenig_von_preussen.tex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/songs/koenig_von_preussen.tex b/src/songs/koenig_von_preussen.tex index 07e36bb..e1f5b19 100644 --- a/src/songs/koenig_von_preussen.tex +++ b/src/songs/koenig_von_preussen.tex @@ -25,8 +25,8 @@ und bringen sie uns wieder, sie henken uns nicht auf, das Kriegsrecht wird gesprochen: Der Kerl muß Gassen lauf! -5. \par -Und wann wir Gassen laufen, +\par +5. Und wann wir Gassen laufen, so spielet man uns auf mit Waldhorn und Trompeten, da geht es tapfer drauf; From d0e659cd3e3420b61ffca92dc77f95ef94dcc833 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 13:54:56 +0200 Subject: [PATCH 03/10] update makebook to version 2.2 --- bin/makebook | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/bin/makebook b/bin/makebook index 93913e0..237a79d 100755 --- a/bin/makebook +++ b/bin/makebook @@ -6,10 +6,10 @@ # #**********************************************************# # makebook # -# written by Donald P. Goodman III # -# Copyright (C) 2011 # -# # -# Impose pdf pages for binding # +# written by Donald P. Goodman III # +# Copyright (C) 2011 # +# # +# Impose pdf pages for binding # #**********************************************************# # # This program is free software: you can redistribute it @@ -34,7 +34,7 @@ PATH=/bin:/usr/bin:/usr/local/bin ; export PATH umask 033 # define our revision number variable for rcs -REVISION="2.1" +REVISION="2.2" # define error codes E_WRONG_ARGS=64 # too many or few args E_BAD_SIG_TYPE=65 # invalid type of signature @@ -88,8 +88,7 @@ command -v bc >/dev/null 2>&1 || # print the version information and exit successfully versionfunc () { - echo "makebook v${REVISION}. Copyright (C) 2011, Donald P." - echo "Goodman III." + echo "makebook v${REVISION}. Copyright (C) 2011, Donald P Goodman III." echo "This program comes with ABSOLUTELY NO WARRANTY." echo "This is free software, and you are welcome to " echo "redistribute it under certain conditions; see " @@ -263,6 +262,9 @@ then cp "$FILE_NAME" "$NEW_FILE_NAME" else FILE_NAME="book.pdf" + if [ $VERBOSE -eq 1 ]; then + echo "makebook: No input file named; using stdin..." + fi cat /dev/stdin > "$NEW_FILE_NAME" fi # declare holder variable for pdftk @@ -287,8 +289,8 @@ fi # get some information about our source document NUM_PAGES=`pdfinfo "$NEW_FILE_NAME" | awk '/Pages:/ {print $2}'`; -SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $3}'`; -SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page\ size:/ {print $5}'`; +SRC_PAGE_WIDTH=`pdfinfo "$NEW_FILE_NAME" | awk '/Page size:/ {print $3}'`; +SRC_PAGE_HEIGHT=`pdfinfo "$NEW_FILE_NAME" | awk '/Page size:/ {print $5}'`; # find the number of pages we'll have per signature PAGES_PER_SIG=$(dc -e "$PAGES_PER_SIG $SECT_TYPE * p") # determine if extra pages will be necessary From 660a08779cedddafe50c410043f51a3695d9a9a9 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 14:50:22 +0200 Subject: [PATCH 04/10] start cleaning up directory creation --- Makefile | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 48bd97e..c753bc0 100644 --- a/Makefile +++ b/Makefile @@ -23,11 +23,6 @@ LY_OPUS=$(patsubst %.ly,${BUILD_OPUS_DIR}/%.opus,$(notdir ${LY_FILES})) .PHONY: book songs midi opus clean directories all .DEFAULT_GOAL := all -directories: ${BUILD_DIR} ${BUILD_BOOK_DIR} ${TMP_BOOK_DIR} ${BUILD_SONG_DIR} ${BUILD_MIDI_DIR} ${TMP_DIR} ${TMP_SONG_DIR} ${TMP_MIDI_DIR} ${BUILD_OPUS_DIR} - -${BUILD_DIR}: - mkdir -p ${BUILD_DIR} - ${BUILD_BOOK_DIR}: mkdir -p ${BUILD_BOOK_DIR} @@ -37,9 +32,6 @@ ${BUILD_SONG_DIR}: ${BUILD_MIDI_DIR}: mkdir -p ${BUILD_MIDI_DIR} -${TMP_DIR}: - mkdir -p ${TMP_DIR} - ${TMP_BOOK_DIR}: mkdir -p ${TMP_BOOK_DIR} @@ -52,20 +44,20 @@ ${TMP_MIDI_DIR}: ${BUILD_OPUS_DIR}: mkdir -p ${BUILD_OPUS_DIR} -${TMP_SONG_DIR}/%.pdf: ${SONG_DIR}/%.ly ${SONG_DIR}/%.tex +${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 rm -r ${SRC_DIR}/tmp-ly -${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi +${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi | ${BUILD_MIDI_DIR} cp $< $@ -${TMP_MIDI_DIR}/%-1.midi: ${SONG_DIR}/%.ly +${TMP_MIDI_DIR}/%-1.midi: ${SONG_DIR}/%.ly | ${TMP_MIDI_DIR} lilypond --output=${TMP_MIDI_DIR} ${WORKING_DIR}/$< -${BUILD_OPUS_DIR}/%.opus: ${BUILD_MIDI_DIR}/%.midi +${BUILD_OPUS_DIR}/%.opus: ${BUILD_MIDI_DIR}/%.midi | ${BUILD_OPUS_DIR} timidity $< -Ow -o - | opusenc - $@ -${TMP_BOOK_DIR}/%.pdf: ${SRC_DIR}/%.tex ${SRC_DIR}/images/title.png +${TMP_BOOK_DIR}/%.pdf: ${SRC_DIR}/%.tex ${SRC_DIR}/images/title.png | ${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 @@ -87,13 +79,13 @@ ${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_DIR}/%.pdf: ${TMP_DIR}/%.pdf | ${BUILD_BOOK_DIR} ${BUILD_SONG_DIR} cp $< $@ -book: directories ${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} -songs: directories ${LY_PDFS} -midi: directories ${LY_MIDIS} -opus: directories ${LY_OPUS} +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} +songs: ${LY_PDFS} +midi: ${LY_MIDIS} +opus: ${LY_OPUS} all: book songs midi opus clean: From e8971ac0945dd0d0f3dfbdf47cf6c78dd75d5b44 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:03:29 +0200 Subject: [PATCH 05/10] 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} From 6fffc7adb6f40830867c7a225653a08d21a0774d Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:26:37 +0200 Subject: [PATCH 06/10] remove editor config --- .editorconfig | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index eae7250..0000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 4 - -[Makefile] -indent_style = tab From 49035152d00acb33712667c194cff28b6ed63873 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:26:55 +0200 Subject: [PATCH 07/10] run make with j4 in ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fcb276c..63f3382 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ build: image: thallian/latex-builder script: - - make + - make -j4 artifacts: paths: - build/* From 33f2a7fa705004d7cf29584ce34d8689d13e3f06 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:27:26 +0200 Subject: [PATCH 08/10] Only remove the tmp-ly folder at the clean target. Without that, parallel building of songs fails. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1a7a4c4..35539af 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,6 @@ LY_OPUS=$(patsubst %.ly,${BUILD_OPUS_DIR}/%.opus,$(notdir ${LY_FILES})) ${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}.dir cp $< $@ @@ -73,3 +72,4 @@ all: book songs midi opus clean: rm -rf ${BUILD_DIR} rm -rf ${TMP_DIR} + rm -r ${SRC_DIR}/tmp-ly From 391ea7059af924634a29873dd10d22af7e345a50 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:43:57 +0200 Subject: [PATCH 09/10] ignore src/tmp-ly --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f4d8d16..2232c4d 100755 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ .vscode tmp build -src/tmp_ly +src/tmp-ly From e59d496f0f1c66186640976ceab4c3ed66778a95 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Mon, 18 Apr 2022 15:46:53 +0200 Subject: [PATCH 10/10] clean up makefile --- Makefile | 93 +++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 49 deletions(-) diff --git a/Makefile b/Makefile index 35539af..dee7356 100644 --- a/Makefile +++ b/Makefile @@ -1,75 +1,70 @@ mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST))) WORKING_DIR := $(patsubst %/,%,$(dir $(mkfile_path))) + BOOKNAME=kommersbuch SRC_DIR=src BUILD_DIR=build TMP_DIR=tmp -SONG_DIR=${SRC_DIR}/songs -BUILD_BOOK_DIR=${BUILD_DIR}/books -TMP_BOOK_DIR=${TMP_DIR}/books -BUILD_SONG_DIR=${BUILD_DIR}/songs -TMP_SONG_DIR=${TMP_DIR}/songs -BUILD_MIDI_DIR=${BUILD_DIR}/midi -TMP_MIDI_DIR=${TMP_DIR}/midi -BUILD_OPUS_DIR=${BUILD_DIR}/opus +SONG_DIR=$(SRC_DIR)/songs +BUILD_BOOK_DIR=$(BUILD_DIR)/books +TMP_BOOK_DIR=$(TMP_DIR)/books +BUILD_SONG_DIR=$(BUILD_DIR)/songs +TMP_SONG_DIR=$(TMP_DIR)/songs +BUILD_MIDI_DIR=$(BUILD_DIR)/midi +TMP_MIDI_DIR=$(TMP_DIR)/midi +BUILD_OPUS_DIR=$(BUILD_DIR)/opus -LY_FILES=$(wildcard ${SONG_DIR}/*.ly) -LY_PDFS=$(patsubst %.ly,${BUILD_SONG_DIR}/%.pdf,$(notdir ${LY_FILES})) -LY_TMP_PDFS=$(patsubst %.ly,${TMP_SONG_DIR}/%.pdf,$(notdir ${LY_FILES})) -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})) +BOOK_TYPES=folio quarto sexto octavo + +LY_FILES=$(wildcard $(SONG_DIR)/*.ly) +LY_PDFS=$(patsubst %.ly,$(BUILD_SONG_DIR)/%.pdf,$(notdir $(LY_FILES))) +LY_TMP_PDFS=$(patsubst %.ly,$(TMP_SONG_DIR)/%.pdf,$(notdir $(LY_FILES))) +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 all .DEFAULT_GOAL := all +define BUILDER +$(TMP_BOOK_DIR)/%-$(TYPE).pdf: $(TMP_BOOK_DIR)/%.pdf + cd $(TMP_BOOK_DIR) && \ + ../../bin/makebook -v -t $(TYPE) -i $$(notdir $$<) -o $$(notdir $$@) +endef +$(foreach TYPE,$(BOOK_TYPES),$(eval $(BUILDER))) + %.dir: mkdir -p $* -${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 +$(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 -${BUILD_MIDI_DIR}/%.midi: ${TMP_MIDI_DIR}/%-1.midi | ${BUILD_MIDI_DIR}.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}.dir - lilypond --output=${TMP_MIDI_DIR} ${WORKING_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}.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}.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 +$(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 -${TMP_BOOK_DIR}/%-folio.pdf: ${TMP_BOOK_DIR}/%.pdf - cd ${TMP_BOOK_DIR} && \ - ../../bin/makebook -v -t folio -i $(notdir $<) -o $(notdir $@) - -#long edge binding -${TMP_BOOK_DIR}/%-quarto.pdf: ${TMP_BOOK_DIR}/%.pdf - cd ${TMP_BOOK_DIR} && \ - ../../bin/makebook -v -t quarto -i $(notdir $<) -o $(notdir $@) - -${TMP_BOOK_DIR}/%-sexto.pdf: ${TMP_BOOK_DIR}/%.pdf - cd ${TMP_BOOK_DIR} && \ - ../../bin/makebook -v -t sexto -i $(notdir $<) -o $(notdir $@) - -#short edge binding -${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}.dir ${BUILD_SONG_DIR}.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} -songs: ${LY_PDFS} -midi: ${LY_MIDIS} -opus: ${LY_OPUS} +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) +songs: $(LY_PDFS) +midi: $(LY_MIDIS) +opus: $(LY_OPUS) all: book songs midi opus clean: - rm -rf ${BUILD_DIR} - rm -rf ${TMP_DIR} - rm -r ${SRC_DIR}/tmp-ly + rm -rf $(BUILD_DIR) + rm -rf $(TMP_DIR) + rm -rf $(SRC_DIR)/tmp-ly