593d22dae0ecb6c51b4a8b40af1ab40549000925
[libresoc-isa-manual.git] / powerpc-add / build / Makefile
1 #=======================================================================
2 # Makefile for generating LaTeX documents
3 #-----------------------------------------------------------------------
4 #
5 # This is a simple makefile for generating LaTeX documents. It will
6 # run bibtex, generate eps from xfig figures, and make pdfs. The
7 # makefile supports builds in non-source directories: just make a
8 # build directory, copy the makefile there, and change the srcdir
9 # variable accordingly.
10 #
11 # Note that the makefile assumes that the default dvips/ps2pdfwr
12 # commands "do the right thing" for fonts in pdfs. This is true on
13 # Athena/Linux and Fedora Core but is not true for older redhat installs ...
14 #
15 # At a minimum you should just change the main variable to be
16 # the basename of your toplevel tex file. If you use a bibliography
17 # then you should set the bibfile variable to be the name of your
18 # .bib file (assumed to be in the source directory).
19 #
20
21 # Targets:
22 # (none) makes PDFs in output/
23 # clean removed everything except PDFs in output/
24 # clean-all removed everything in output/
25
26 # Directories relative to the top level:
27 outdir = output
28 srcdir = src
29 # Relative to output:
30 relsrcdir = ../$(srcdir)
31
32 docs_with_bib = power-spec
33 docs_without_bib =
34
35 srcs = $(wildcard $(srcdir)/*.tex)
36 figs = $(wildcard $(srcdir)/figs/*)
37 bibs = $(srcdir)/power-spec.bib
38
39 #=======================================================================
40 # You shouldn't need to change anything below this
41 #=======================================================================
42
43 PDFLATEX := TEXINPUTS=$(relsrcdir): pdflatex -interaction=nonstopmode -halt-on-error
44 BIBTEX := BIBINPUTS=$(relsrcdir): bibtex
45
46 default : $(outdir) pdf
47
48 #------------------------------------------------------------
49 # PDF
50
51 pdfs_with_bib = $(addsuffix .pdf, $(docs_with_bib))
52 pdfs_without_bib = $(addsuffix .pdf, $(docs_without_bib))
53 pdfs = $(pdfs_with_bib) $(pdfs_without_bib)
54
55 Makefile: build/Makefile
56 ln -s $^ .
57
58 pdf : $(pdfs) Makefile
59 .PHONY: pdf open
60
61 $(outdir):
62 mkdir $@
63
64 open: $(pdfs)
65 open $(pdfs)
66
67 $(pdfs_with_bib): %.pdf: $(srcdir)/%.tex $(srcs) $(figs) $(bibs)
68 cd $(outdir); $(PDFLATEX) $* || true
69 cd $(outdir); $(BIBTEX) $* || true
70 cd $(outdir); $(PDFLATEX) $* || true
71 cd $(outdir); makeglossaries $* || true
72 cd $(outdir); $(PDFLATEX) $* || true
73
74 $(pdfs_without_bib): %.pdf: $(srcdir)/%.tex $(srcs) $(figs)
75 cd $(outdir); $(PDFLATEX) $* || true
76 cd $(outdir); makeglossaries $* || true
77 cd $(outdir); $(PDFLATEX) $* || true
78
79 junk += *.aux *.log *.bbl *.blg *.toc *.out
80
81 #------------------------------------------------------------
82 # Other Targets
83
84 clean :
85 rm -rf $(addprefix $(outdir)/, $(junk))
86
87 clean-all: clean
88 rm -rf $(addprefix $(outdir)/, $(pdfs))