summaryrefslogtreecommitdiff
path: root/Verleih_uns_Frieden__/Makefile
blob: 9a5f07fc020c37cb48612ec87047bcf1243e0a37 (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
CURDOC=$(shell basename "$(CURDIR)")
STROPHEN=[^%]
VARIANTE=1

ifeq ($(MIDI),1)
  MIDI_REGEX=
else
  MIDI_REGEX=/\\\\midi/{ :a; s/\\\\midi[^{}]*{/\\\\midi/; tb; N; ba; :b; s/{[^{}]*}//; tb; s/\\\\midi[^{}]*}//; t; N; bb; };
endif

ifeq ($(KLAVIER),1)
  KLAVIER_REGEX=
else
  KLAVIER_REGEX=/%Klavier%/d;
endif

all: $(CURDOC).pdf
	pkill -SIGHUP -xf 'mupdf(-x11)? (.*/)?$<' || true

clean:
	rm -f *.pre

Clean: clean
	rm -f *.pdf *.midi

%.pre: %.ly
	sed " \
		s@%spezifisch%@$(SPEZIFISCH)@ ; \
		s/%STR_\($(STROPHEN)\)%//g; \
		s/%Variante_$(VARIANTE)%//; \
		$(KLAVIER_REGEX) \
		$(MIDI_REGEX) \
	" "$<" > "$@"

$(CURDOC).meta: $(CURDOC)-plain.meta
	cat "$<" >"$@"

$(CURDOC)-%.meta: ../.meta/%.meta $(CURDOC).pre
	sed " \
		1 i define(input,$(CURDOC).pre) \
	" "$<" \
	| m4 \
	>"$@"

%.pdf: %.meta stimmen.pre texte.pre
	lilypond $<
	pkill -SIGHUP -xf "mupdf $@" || true