summaryrefslogtreecommitdiff
path: root/Konzerte/2017_12_09/make
blob: 364bb9f867aa8574b36b235f6878bfd77620202c (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
#!/bin/bash

set -e

cd "$(dirname "$0")"

teile=(
  Nun_komm_der_Heiden_Heiland_/parts/I.ly
  Nun_komm_der_Heiden_Heiland_/parts/V.ly
  Vom_Himmel_kam_der_Engel_Schar/parts/I.ly
  Vom_Himmel_kam_der_Engel_Schar/parts/VI.ly
  Vom_Himmel_hoch_da_komm_ich_her.pre
  Messias/parts/III.ly
  Messias/parts/XII.ly
  Messias/parts/XV.ly
  Messias/parts/XLII.ly
)

rm -f *.pre

for teil in "${teile[@]}"; do
  if [ "${teil%.pre}.pre" = "${teil}" ]; then
    (
      cd "../../${teil%.pre}"
      make "$@" "${teil}"
    )
  fi
done

while read -r line
do
  if [ "%LOOP%${line#%LOOP%}" = "${line}" ]; then
    loopLines="${loopLines}
${line#%LOOP%}"
  else
    if [ -n "${loopLines}" ]; then
      for teil in "${teile[@]}"; do
        if echo "${teil}" | grep -qF '/'; then
          datei="${teil}"
        else
          datei="${teil%.*}/${teil}"
        fi
        echo "${loopLines}" | \
          sed "
            s|%TEIL%|${datei}|g
          "
      done
      unset loopLines
    fi
    echo "${line}"
  fi
done < alles.ly > alles.pre

lilypond alles.pre