summaryrefslogtreecommitdiff
path: root/Konzerte/2018_05_13/make
blob: fad03c72808c390a42c1dd532192bf678b121013 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash

set -e

cd "$(dirname "$0")"

teile=(
  Kyrie
  Halleluja
  Befiehl_dem_Herren_deine_Wege
#  Die_beste_Zeit_im_Jahr_ist_mein # EG319 1-4
  Die_beste_Zeit_im_Jahr_ist_mein
  Aennchen_von_Tharau_
  Im_Fruehling
  Wie_lieblich_ist_der_Maien # EG501
  Ich_sing_dir_mein_Lied
  Denn_er_hat_seinen_Engeln_
  Ueber_dir_wach_ein_Engel
  Horch_die_Wellen_tragen
  Hoere_nun_Herr_die_Bitten
  Schoen_ist_die_Erde
  Viele_verachten_die_edele_Musik
  Lobe_den_Herren
)

rm -f *.pre

for teil in "${teile[@]}"
do
  (
    cd ../../${teil}
    sed -n '
      s/^[^:]*%\.pdf.*:\s*//
      T
      s/%/'"${teil##*/}"'/g
      p
    ' Makefile | \
      tr ' ' '\n' | \
      grep '\.pre$' | \
      xargs -r make "$@"
  )
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[@]}"
        do
          echo "${loopLines}" | \
            sed "
              s|%TEIL%|${teil}|g
              s|%TEIL-BASE%|${teil##*/}|g
              s|%IF \([^=]\+\)=\1%||g
              /%IF [^=]\+=[^=]\+%/d
            "
        done
        unset loopLines
      fi
      echo "${line}"
    fi
  done > alles.pre

lilypond alles.pre