bcrowell / calculus

a free and open-source calculus textbook

This URL has Read+Write access

calculus / Makefile
100644 83 lines (69 sloc) 2.165 kb
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
#
#
# See comments at the top of gen_graph.rb for notes about
# figures, fonts, lulu, etc.
#
#
#
 
BOOK = calc
MODE = nonstopmode
TERMINAL_OUTPUT = err
 
MAKEINDEX = makeindex $(BOOK).idx
 
DO_PDFLATEX_RAW = pdflatex -interaction=$(MODE) $(BOOK) >$(TERMINAL_OUTPUT)
SHOW_ERRORS = \
        print "========error========\n"; \
        open(F,"$(TERMINAL_OUTPUT)"); \
        while ($$line = <F>) { \
          if ($$line=~m/^\! / || $$line=~m/^l.\d+ /) { \
            print $$line \
          } \
        } \
        close F; \
        exit(1)
DO_PDFLATEX = echo "$(DO_PDFLATEX_RAW)" ; perl -e 'if (system("$(DO_PDFLATEX_RAW)")) {$(SHOW_ERRORS)}'
 
# Since book1 comes first, it's the default target --- you can just do ``make'' to make it.
 
book1:
@$(DO_PDFLATEX)
@rm -f $(TERMINAL_OUTPUT) # If pdflatex has a nonzero exit code, we don't get here, so the output file is available for inspection.
 
index:
$(MAKEINDEX)
 
book:
make clean
@$(DO_PDFLATEX)
@$(DO_PDFLATEX)
$(MAKEINDEX)
@$(DO_PDFLATEX)
@rm -f $(TERMINAL_OUTPUT) # If pdflatex has a nonzero exit code, we don't get here, so the output file is available for inspection.
 
test:
perl -e 'if (system("pdflatex -interaction=$(MODE) $(BOOK) >$(TERMINAL_OUTPUT)")) {print "error\n"} else {print "no error\n"}'
 
clean:
# Sometimes we get into a state where LaTeX is unhappy, and erasing these cures it:
rm -f *aux *idx *ilg *ind *log *toc
rm -f ch*/*aux
# Shouldn't exist in subdirectories:
rm -f */*.log
# Emacs backup files:
rm -f *~
rm -f */*~
# Misc:
rm -f ch*/figs/*.eps
rm -Rf ch*/figs/.xvpics
rm -f a.a
rm -f */a.a
rm -f */*/a.a
rm -f junk
rm -f err
# ... done.
rm -f calc_lulu.pdf
rm -f calc.pdf
rm -f temp.pdf
 
post:
cp calc.pdf /home/bcrowell/Lightandmatter/calc
 
prepress:
# The following makes Lulu not complain about missing fonts:
pdftk calc.pdf cat 3-end output temp.pdf
gs -q -dCompatibilityLevel=1.4 -dSubsetFonts=false -dPDFSETTINGS=/printer -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=calc_lulu.pdf temp.pdf -c '.setpdfwrite'
 
 
post_source:
# don't forget to commit first, git commit -a -m "comment"
# repo is hosted on github, see book's web page
git push