summaryrefslogtreecommitdiff
path: root/.meta/generiere-mks.mk
blob: fa040afed9c4584b7147c3e9adcbc9e1f43d1a79 (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
../.meta/prefix.mk: ../.meta/prefix-Liste ../.meta/generiere-mks.mk
	{ \
	  cat "$<"; \
	  for ton in c d e f g a h; do \
			for halbton in "" is es; do \
				for oktave in "" _; do \
					printf '%s%s%s\n' "$${ton}" "$${halbton}" "$${oktave}"; \
				done; \
			done; \
	  done \
	  | sed " \
			s/^ees/es/; \
			s/^hes/b/; \
			s/^/transponiert-/; \
	  "; \
	  seq 20 \
	  | sed 'p;h;s/$$/E/;g;s/$$/S/'; \
	  for i in {1..20}; do \
	    for j in {1..6}; do \
	      printf '%s.%s\n' "$${i}" "$${j}"; \
	      printf '%sS.%s\n' "$${i}" "$${j}"; \
	      printf '%sE.%s\n' "$${i}" "$${j}"; \
	    done; \
	  done; \
	} \
	| while read -r prefix; do \
		printf '%%-%s.pre: ' "$${prefix}"; \
		printf '%%.pre\n' "$${prefix}"; \
		printf '\tsed " \\\n'; \
		if [ -z "$${prefix##transponiert-*}" ]; then \
			printf '\t\t1i define(\\`transponiert'"'"',%s) \\\n' "$${prefix#transponiert-}"; \
		elif echo "$${prefix}" | grep -qx "[0-9]\+[ES]\?"; then \
			nummer=$$(echo "$${prefix}" | sed 's/[ES]$$//'); \
			printf '\t\t1i define(\\`STR_%s'"'"',\\`%s'"'"') \\\n' "$${prefix}" "$${nummer}"; \
		elif echo "$${prefix}" | grep -qx "[0-9]\+[ES]\?\.[0-9]\+"; then \
			printf '\t\t1i define(\\`STR_%s'"'"',\\`%s'"'"') \\\n' "$${prefix%.*}" "$${prefix#*.}"; \
		else \
			printf '\t\t1i define(\\`%s'"'"') \\\n' "$${prefix}"; \
		fi; \
		printf '\t" "$$<" >"$$@"\n'; \
		printf '\n'; \
	done \
	>"$@"

../.meta/papierformat.mk: ../.meta/generiere-mks.mk ../.meta/*.papierformat
	for datei in ../.meta/*.papierformat; do \
		name="$${datei##*/}"; \
		name="$${name%.*}"; \
		printf "%%-%s.pre: %s %%.pre\n" "$${name}" "$${datei}"; \
		printf "\tcat \$$^ > \$$@\n"; \
	done \
	>"$@"

meta.mk: ../.meta/papierformat.mk ../.meta/prefix.mk

.PHONY: meta.mk