ly/Makefile: Change footer format to "Commit xxxx (yyyy-mm-dd) — ..."
[sunny256-utils.git] / Lib / std / ly / Makefile
blob9c2c4b95399e368ba153508ed7b216520b337e4e
1 # STDprojnameDTS/Makefile
2 # File ID: STDuuidDTS
4 NAME = STDprojnameDTS
6 AFVLOCKDIR = $(HOME)/.$(NAME)-afv.lock
7 DEPS = .version.ily *.ily *.ly Makefile
8 DIRTYSTR = $$(git diff-index --name-only HEAD . | grep -q . && echo -n -dirty)
9 ENGR = \"Engraved with LilyPond v\" (lilypond-version) \"\"
10 FRESCOLOCKDIR = $(HOME)/.$(NAME)-fresco.lock
11 IGNFILES =
12 IGNFILES += -e '\.midi$$'
13 IGNFILES += -e '\.mp3$$'
14 IGNFILES += -e '\.opus$$'
15 IGNFILES += -e '\.pdf$$'
16 IGNFILES += -e '\.wav$$'
17 LILYPOND = lilypond
18 PLAYER = mpv
19 SA_GIT = \#(string-append \"Commit %h$(DIRTYSTR) (%cs) — \" $(ENGR))
20 SA_NOGIT = \#(string-append \"Compiled $$(date +%Y-%m-%d) — \" $(ENGR))
22 .PHONY: all
23 all: midi pdf
25 .version.ily: *.ily *.ly Makefile
26 if [ -z "$$(git log -1 --format=%h . 2>/dev/null)" ]; then \
27 echo "versioninfo = $(SA_NOGIT)"; \
28 else \
29 git log -1 --format="versioninfo = $(SA_GIT)" .; \
30 fi >.version.ily
32 %.midi: $(DEPS)
33 $(LILYPOND) $*.ly
35 %.pdf: $(DEPS)
36 $(LILYPOND) $*.ly
38 %.wav: $(DEPS)
39 $(MAKE) $*.midi
40 timidity --output-24bit -Ow $*.midi
42 %.mp3: $(DEPS)
43 $(MAKE) $*.wav
44 rm -f $*.mp3
45 wav_to_mp3 $*.wav
47 %.opus: $(DEPS)
48 $(MAKE) $*.wav
49 rm -f $*.opus
50 wav_to_opus $*.wav
52 .PHONY: afv
53 afv:
54 mkdir $(AFVLOCKDIR)
55 (sess -- afv -l5 $(NAME).ly '*.ily' $(NAME).midi; \
56 rmdir $(AFVLOCKDIR)) &
58 .PHONY: clean
59 clean:
60 rm -f $(NAME).mp3 $(NAME).opus $(NAME).pdf $(NAME).wav .version.ily
62 .PHONY: diff
63 diff:
64 git diff *.ly *.ily
66 .PHONY: dist
67 dist:
68 $(MAKE) .version.ily
69 $(LILYPOND) -dno-point-and-click $(NAME).ly
71 .PHONY: dw
72 dw:
73 git diff --word-diff *.ly *.ily
75 .PHONY: dww
76 dww:
77 git diff --word-diff --word-diff-regex=. *.ly *.ily
79 .PHONY: edit
80 edit:
81 $(EDITOR) $$(git ls-files | grep -v $(IGNFILES))
83 .PHONY: fresco
84 fresco:
85 mkdir $(FRESCOLOCKDIR)
86 (sess frescobaldi $(NAME).ly; rmdir $(FRESCOLOCKDIR)) &
88 .PHONY: midi
89 midi: $(NAME).midi
91 .PHONY: mp3
92 mp3: $(NAME).mp3
94 .PHONY: opus
95 opus: $(NAME).opus
97 .PHONY: pdf
98 pdf: $(NAME).pdf
100 .PHONY: play
101 play: $(NAME).wav
102 $(PLAYER) $(NAME).wav
104 .PHONY: slow
105 slow: $(NAME).midi
106 timidity --output-24bit -T 50 $(NAME).midi
108 .PHONY: swp
109 swp:
110 for f in .*.swp; do \
111 git add $$(basename $$(echo $$f | cut -c 2-) .swp); \
112 vim -r $$f; rm -i $$f; \
113 done
115 .PHONY: touch
116 touch:
117 touch $(NAME).ly
119 .PHONY: view
120 view: $(NAME).pdf
121 sess okular $(NAME).pdf &>/dev/null &
123 .PHONY: wav
124 wav: $(NAME).wav