summaryrefslogtreecommitdiff
path: root/Konzerte/2019_05_05/make
diff options
context:
space:
mode:
Diffstat (limited to 'Konzerte/2019_05_05/make')
-rwxr-xr-xKonzerte/2019_05_05/make84
1 files changed, 84 insertions, 0 deletions
diff --git a/Konzerte/2019_05_05/make b/Konzerte/2019_05_05/make
new file mode 100755
index 0000000..067fed2
--- /dev/null
+++ b/Konzerte/2019_05_05/make
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+set -e
+
+cd "$(dirname "$0")"
+
+teile_params=(
+ Cantate_Domino
+ 'Morgenlicht_leuchtet:STROPHEN="[1-3]"'
+ Er_ist_mein_Hirt
+ 'Ich_moecht_dass_einer_mit_mir_geht:STROPHEN="[1-4]"'
+ 'Komm_Heilger_Geist:STROPHEN="[1-2]"'
+ Denn_er_hat_seinen_Engeln_
+ 'Kommt_mit_Gaben_und_Lobgesang:STROPHEN="[1-3]"'
+ Tretet_her_zum_Tisch_des_Herrn
+
+ 'Bewahre_uns_Gott:STROPHEN="4"'
+)
+
+rm -f *.pre
+
+for teil_params in "${teile_params[@]}"
+do
+ teil="${teil_params%%:*}"
+ params="${teil_params#${teil}}"
+ params="${params#:}"
+ (
+ cd ../../${teil}
+ sed -n '
+ s/^\([^:]*%\|'"${teil##*/}"'\)\.pdf.*:\s*//
+ T
+ :a
+ /\\$/ {
+ N
+ s/\\\n/ /
+ ta
+ }
+ s/\n.*$//
+ s/%/'"${teil##*/}"'/g
+ p
+ ' Makefile | \
+ tr ' ' '\n' | \
+ grep '\.pre$' | \
+ xargs -r make ${params} "$@"
+ )
+done
+
+{
+ printf '\n\n'
+ cat alles.ly
+ printf '\n\n'
+} | \
+ while read -r line
+ do
+ if [[ "${line}" = '%LOOP%'* ]]
+ then
+ loopLines="${loopLines}
+${line#%LOOP%}"
+ else
+ if [ -n "${loopLines}" ]
+ then
+ for teil in "${teile_params[@]%%:*}"
+ do
+ echo "${loopLines}" | \
+ sed "
+ s|%TEIL%|${teil}|g
+ s|%TEIL-BASE%|${teil##*/}|g
+ /%IF \([^=%]\+\)!=\1%/d
+ s|%IF [^=%]\+!=[^=%]\+%||g
+ s|%IF \([^=%]*[^=!%]\)=\1%||g
+ /%IF [^=%]\+=[^=%]\+%/d
+ "
+ done
+ unset loopLines
+ fi
+ echo "${line}"
+ fi
+ done > alles.pre
+
+lilypond alles.pre
+
+#ps2pdf -sPAPERSIZE=a4 - empty.pdf </dev/null
+#pdfunite empty.pdf alles.pdf alles_.pdf
+#mv alles_.pdf alles.pdf