diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..eae7250 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +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 diff --git a/.gitignore b/.gitignore index 2232c4d..f4d8d16 100755 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ .vscode tmp build -src/tmp-ly +src/tmp_ly diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 63f3382..fcb276c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ build: image: thallian/latex-builder script: - - make -j4 + - make artifacts: paths: - build/* diff --git a/Makefile b/Makefile index dee7356..48bd97e 100644 --- a/Makefile +++ b/Makefile @@ -1,70 +1,101 @@ 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 -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})) -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 +.PHONY: book songs midi opus clean directories 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))) +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} -%.dir: - mkdir -p $* +${BUILD_DIR}: + mkdir -p ${BUILD_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 +${BUILD_BOOK_DIR}: + mkdir -p ${BUILD_BOOK_DIR} -$(BUILD_MIDI_DIR)/%.midi: $(TMP_MIDI_DIR)/%-1.midi | $(BUILD_MIDI_DIR).dir +${BUILD_SONG_DIR}: + mkdir -p ${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} + +${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 + 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 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 + 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 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 + latexmk -cd -lualatex -e '$$lualatex=q/lualatex %O -shell-escape %S/' -output-directory=${WORKING_DIR}/${TMP_BOOK_DIR} $< + rm -r ${SRC_DIR}/tmp-ly -$(BUILD_DIR)/%.pdf: $(TMP_DIR)/%.pdf | $(BUILD_BOOK_DIR).dir $(BUILD_SONG_DIR).dir +${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 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: 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} all: book songs midi opus clean: - rm -rf $(BUILD_DIR) - rm -rf $(TMP_DIR) - rm -rf $(SRC_DIR)/tmp-ly + rm -rf ${BUILD_DIR} + rm -rf ${TMP_DIR} diff --git a/bin/makebook b/bin/makebook index 237a79d..93913e0 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.2" +REVISION="2.1" # define error codes E_WRONG_ARGS=64 # too many or few args E_BAD_SIG_TYPE=65 # invalid type of signature @@ -88,7 +88,8 @@ command -v bc >/dev/null 2>&1 || # print the version information and exit successfully versionfunc () { - echo "makebook v${REVISION}. Copyright (C) 2011, Donald P Goodman III." + echo "makebook v${REVISION}. Copyright (C) 2011, Donald P." + echo "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 " @@ -262,9 +263,6 @@ 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 @@ -289,8 +287,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 diff --git a/src/songs/gedanken_sind_frei.ly b/src/songs/gedanken_sind_frei.ly index 72cd4c8..f82a605 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 4a61148..a6b3979 100644 --- a/src/songs/gedanken_sind_frei.tex +++ b/src/songs/gedanken_sind_frei.tex @@ -1,5 +1,14 @@ \par -2. Ich denke, was ich will, +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, und was mich beglücket, doch alles in der Still, und wie es sich schicket. @@ -8,7 +17,7 @@ kann niemand verwehren, es bleibet dabei: die Gedanken sind frei. \par -3. Ich liebe den Wein, +4. Ich liebe den Wein, mein Mädchen vor allen, sie tut mir allein am besten gefallen. @@ -17,7 +26,7 @@ bei meinem Glas Weine, mein Mädchen dabei: die Gedanken sind frei. \par -4. Und sperrt man mich ein +5. Und sperrt man mich ein im finsteren Kerker, das alles sind rein vergebliche Werke; @@ -26,7 +35,7 @@ zerreißen die Schranken und Mauern entzwei: die Gedanken sind frei. \par -5. Drum will ich auf immer +6. 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 cf3e064..1d7de03 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 = "" } diff --git a/src/songs/koenig_von_preussen.tex b/src/songs/koenig_von_preussen.tex index e1f5b19..07e36bb 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! -\par -5. Und wann wir Gassen laufen, +5. \par +Und wann wir Gassen laufen, so spielet man uns auf mit Waldhorn und Trompeten, da geht es tapfer drauf;