-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
78 lines (68 loc) · 1.88 KB
/
Makefile
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
#
# Unix programming in C
#
# (c) Martin Beran, Jan Pechanec, Vladimir Kotal
#
# - "make slides" creates lecture slides
# - "make notes" creates slides with notes in the A4 format
#
# For correct links and PDF bookmarks it is necessary to run make twice.
#
# Do not edit m4 files, those are automatically created during the document
# generation.
#
# The 'spellcheck' target requires the aspell program.
#
LATEX= pdflatex
M4= m4
SLIDE_TEX= unix-linux-prog-in-c_slides-only.tex
NOTE_TEX= unix-linux-prog-in-c.tex
SLIDE_PDF= $(SLIDE_TEX:tex=pdf)
NOTE_PDF= $(NOTE_TEX:tex=pdf)
SLIDE_NEW= $(SLIDE_PDF:pdf=pdf.new)
NOTE_NEW= $(NOTE_PDF:pdf=pdf.new)
TEX_FILES= common.tex \
intro.tex \
file-api.tex \
user-access.tex \
proc.tex \
signals.tex \
synchro.tex \
network.tex \
threads.tex \
files.tex \
other.tex \
sys-v-semaphores.tex \
history.tex \
appendix.tex
SLIDES= $(TEX_FILES) $(SLIDE_TEX)
NOTES= $(TEX_FILES) $(NOTE_TEX)
all: slides notes spellcheck
slides: $(SLIDES)
@for i in $(SLIDES); do \
new=`echo $$i | sed -e 's/.tex/.m4.tex/g'`; \
$(M4) -D NOSPELLCHECK $$i > $$new; \
done
$(LATEX) $(SLIDE_TEX:tex=m4.tex)
mv $(SLIDE_TEX:tex=m4.pdf) $(SLIDE_PDF)
notes: $(NOTES)
@for i in $(NOTES); do \
new=`echo $$i | sed -e 's/.tex/.m4.tex/g'`; \
$(M4) -D NOSPELLCHECK $$i > $$new; \
done
$(LATEX) $(NOTE_TEX:tex=m4.tex)
mv $(NOTE_TEX:tex=m4.pdf) $(NOTE_PDF)
clean:
-rm -f *.log *.aux *.m4.tex *.pdf *.m4.tmp *.out
spellcheck:
@rm -f /tmp/aspell.out
@echo "test" | sed -E -f spellfilter.sed >/dev/null; \
if [ $$? -ne 0 ]; then echo "sed failed"; exit 1; fi
@for file in ${SLIDES}; do \
echo "### Checking $$file"; \
$(M4) $$file | sed -E -f spellfilter.sed | \
aspell -t --personal=./unix_dict.txt list | \
tee -a /tmp/aspell.out; \
if [ $$? -ne 0 ]; then exit 1; fi; \
done
@if [ -s /tmp/aspell.out ]; then exit 1; fi