aboutsummaryrefslogtreecommitdiff
path: root/build/Makefile
blob: 7a64a4c677ca2d1013130337b2610ad2d0cbc08b (plain)
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
#=======================================================================
# Makefile for generating LaTeX documents
#-----------------------------------------------------------------------
#
# This is a simple makefile for generating LaTeX documents. It will
# run bibtex, generate eps from xfig figures, and make pdfs. The
# makefile supports builds in non-source directories: just make a
# build directory, copy the makefile there, and change the srcdir
# variable accordingly.
#
# Note that the makefile assumes that the default dvips/ps2pdfwr
# commands "do the right thing" for fonts in pdfs. This is true on
# Athena/Linux and Fedora Core but is not true for older redhat installs ...
#
# At a minimum you should just change the main variable to be
# the basename of your toplevel tex file. If you use a bibliography
# then you should set the bibfile variable to be the name of your
# .bib file (assumed to be in the source directory).
#

srcdir  = ../src

docs_with_bib = riscv-spec riscv-privileged
docs_without_bib =

srcs = $(wildcard $(srcdir)/*.tex)
figs = $(wildcard $(srcdir)/figs/*)
bibs = $(srcdir)/riscv-spec.bib

#=======================================================================
# You shouldn't need to change anything below this
#=======================================================================

PDFLATEX := TEXINPUTS=$(srcdir): pdflatex -interaction=nonstopmode -halt-on-error
BIBTEX := BIBINPUTS=$(srcdir): bibtex

default : pdf

#------------------------------------------------------------
# PDF

pdfs_with_bib = $(addsuffix .pdf, $(docs_with_bib))
pdfs_without_bib = $(addsuffix .pdf, $(docs_without_bib))
pdfs = $(pdfs_with_bib) $(pdfs_without_bib)

pdf : $(pdfs)
.PHONY: pdf open

open: $(pdfs)
	open $(pdfs)

$(pdfs_with_bib): %.pdf: $(srcdir)/%.tex $(srcs) $(figs) $(bibs)
	$(PDFLATEX) $*
	$(BIBTEX) $*
	$(PDFLATEX) $*
	$(PDFLATEX) $*

$(pdfs_without_bib): %.pdf: $(srcdir)/%.tex $(srcs) $(figs)
	$(PDFLATEX) $*
	$(PDFLATEX) $*

junk += $(pdfs) *.aux *.log *.bbl *.blg *.toc *.out

#------------------------------------------------------------
# Other Targets

clean :
	rm -rf $(junk) *~ \#*