-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile.am
159 lines (139 loc) · 6.24 KB
/
Makefile.am
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
## Makefile.am -- Config file for GNU Automake.
##
## Copyright (C) 2024 Artyom V. Poptsov <[email protected]>
##
## This file is part of SPARC book.
##
## This program is free software: you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation, either version 3 of the
## License, or (at your option) any later version.
##
## This program is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program. If not, see <http://www.gnu.org/licenses/>.
ACLOCAL_AMFLAGS = -I build-aux
SUBDIRS = .
all: sparc.pdf
SECTIONS = \
src/ru/sections/commands.tex \
src/ru/sections/introduction.tex \
src/ru/sections/electronics-voltage.tex \
src/ru/sections/electronics-circuits.tex \
src/ru/sections/electronics-potential-difference.tex \
src/ru/sections/electronics-resistance.tex \
src/ru/sections/electronics-building-circuits.tex \
src/ru/sections/dialogues-with-computer-title-image.tex \
src/ru/sections/dialogues-with-computer-introduction.tex \
src/ru/sections/dialogues-with-computer-algorithms.tex \
src/ru/sections/dialogues-with-computer-arduino.tex \
src/ru/sections/dialogues-with-computer-multimeter.tex \
src/ru/sections/dialogues-with-computer-breadboard.tex \
src/ru/sections/dialogues-with-computer-memory.tex \
src/ru/sections/dialogues-with-computer-control-flow.tex \
src/ru/sections/dialogues-with-computer-arduino-ide.tex \
src/ru/sections/dialogues-with-computer-program-structure.tex \
src/ru/sections/dialogues-with-computer-wokwi.tex \
src/ru/sections/white-noise-introduction.tex \
src/ru/sections/white-noise-analog-ports.tex \
src/ru/sections/white-noise-serial-port.tex \
src/ru/sections/white-noise-signal-types.tex \
src/ru/sections/white-noise-adc.tex \
src/ru/sections/white-noise-voltage-divider.tex \
src/ru/sections/pwm-intro.tex \
src/ru/sections/pwm-duty-cycle.tex \
src/ru/sections/pwm-wavelength.tex \
src/ru/sections/pwm-tasks.tex \
src/ru/sections/music-and-technology-synthesis-sound.tex \
src/ru/sections/music-and-technology-synthesis-speaker.tex \
src/ru/sections/music-and-technology-synthesis-rhythm.tex \
src/ru/sections/music-and-technology-synthesis-harmony.tex \
src/ru/sections/music-and-technology-synthesis-octave-system.tex \
src/ru/sections/music-and-technology-synthesis-simple-melodies.tex \
src/ru/sections/music-and-technology-synthesis-arrays.tex \
src/ru/sections/music-and-technology-synthesis-two-dimensional-arrays.tex \
src/ru/sections/music-and-technology-synthesis-staff.tex \
src/ru/sections/music-and-technology-synthesis-rest.tex \
src/ru/sections/music-and-technology-synthesis-dotted-notes.tex \
src/ru/sections/music-and-technology-synthesis-flats-and-sharps.tex \
src/ru/sections/music-and-technology-synthesis-musical-scale.tex \
src/ru/sections/music-and-technology-synthesis-bass-clef.tex \
src/ru/sections/music-and-technology-synthesis-music-band.tex \
src/ru/sections/communication-intro.tex \
src/ru/sections/communication-serial-port.tex \
src/ru/sections/communication-i2c.tex \
src/ru/sections/game-dev-intro.tex \
src/ru/sections/game-dev-lcd.tex \
src/ru/sections/game-dev-genre-and-plot.tex \
src/ru/sections/game-dev-player.tex \
src/ru/sections/game-dev-buttons.tex \
src/ru/sections/game-dev-game-map.tex \
src/ru/sections/game-dev-sounds.tex \
src/ru/sections/game-dev-graphics.tex \
src/ru/sections/game-dev-animation.tex \
src/ru/sections/game-dev-logic.tex \
src/ru/sections/appendix-octaves.tex \
src/ru/sections/appendix-prostokvashino-score.tex \
src/ru/sections/appendix-twinkle-twinkle-little-star-01.tex \
src/ru/sections/appendix-twinkle-twinkle-little-star-02.tex
COMMIT = $(shell git rev-parse HEAD)
SECTIONS_OUT = \
$(foreach section, $(SECTIONS), out/$(section))
out/src/ru/references.bib: src/references.bib
@echo "CP $< -> $@" \
&& cp $< $@
out/src/ru/sparc-blx.bib: out/src/ru/references.bib out/src/ru/sparc.aux
@echo "BIBTEX $@" \
&& cd out/src/ru/ \
&& bibtex sparc
out/src/ru/version.tex: src/ru/version.tex.in
@echo "GEN $@" \
&& sed "s/[@]COMMIT[@]/${COMMIT}/g; s/[@]VERSION[@]/$(PACKAGE_VERSION)/g" $< > $@
out/src/ru/sections/%.tex: src/ru/sections/%.tex
@[ -d $(abs_top_srcdir)/out/src/ru/sections ] \
|| mkdir -p $(abs_top_srcdir)/out/src/ru/sections
@echo "LILYPOND $< -> $@" \
&& lilypond-book \
--include $(abs_top_srcdir)/out/src/ru/ \
--output $(abs_top_srcdir)/out/src/ru/sections/ \
--pdf $< > [email protected] 2>&1 \
|| (cat [email protected]; exit 1)
out/src/ru/sparc.tex: src/ru/sparc.tex $(SECTIONS_OUT) out/src/ru/version.tex
@echo "LILYPOND sparc.tex -> out/sparc.tex" \
&& lilypond-book \
--include $(abs_top_srcdir)/out/src/ru/ \
--output $(abs_top_srcdir)/out/src/ru/ \
--pdf $(abs_top_srcdir)/src/ru/sparc.tex > sparc.tex.log 2>&1 \
|| (cat sparc.tex.log; exit 1)
make_glossary: out/src/ru/sparc.aux
@echo "GLOSSARY sparc" \
&& cd out/src/ru/ \
&& makeglossaries sparc > makeglossaries.log 2>&1 \
|| (cat makeglossaries.log; exit 1)
make_index: out/src/ru/sparc.aux
@echo "INDEX sparc" \
&& cd out/src/ru/ \
&& makeindex sparc > makeindex.log 2>&1
out/src/ru/sparc.aux: src/ru/sparc.tex out/src/ru/sparc.tex out/src/ru/version.tex
@echo "XELATEX out/sparc.tex -> out/sparc.xdv" \
&& cd out/src/ru/ \
&& xelatex --interaction=batchmode --draftmode --no-pdf --shell-escape sparc.tex > sparc.pdf.log.1 2>&1 \
|| (echo "---- sparc.pdf.log.1 ----"; cat sparc.pdf.log.1; echo "---- sparc.log ----"; cat sparc.log) && exit 0
out/src/ru/sparc.pdf: out/src/ru/sparc.aux make_glossary make_index out/src/ru/sparc-blx.bib
@echo "XELATEX out/sparc.tex -> out/sparc.pdf" \
&& cd out/src/ru/ \
&& xelatex --shell-escape sparc.tex > sparc.pdf.log.2 2>&1 \
|| cat sparc.pdf.log.2 && exit 0
sparc.pdf: out/src/ru/sparc.pdf
@echo "COPY sparc.pdf" \
&& [ -e out/src/ru/sparc.pdf ] && cp out/src/ru/sparc.pdf sparc.pdf \
|| ( echo "ERROR: File 'out/src/ru/sparc.pdf' not found" \
&& exit 1 )
.PHONY: clean-local
clean-local:
rm -rf out
rm sparc.pdf