summaryrefslogtreecommitdiff
path: root/2005/flow-accounting-ols2005/OLS2005/Makefile
blob: 1b0ee7ae852d09e5a9c93bf7190b107ad1f420a7 (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
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
# Makefile for proceedings using the OLS/GCCSummit schema.

# Tools - some of the dvi programs are from dviutils-1.0-9.rpm
#         pdftk is from pdftk-1.12-0.rpm
LATEX	  = latex
BIBTEX	  = bibtex
DVIPS	  = dvips
DVIPDF	  = echo dvipdfm
DVICONCAT = dviconcat
PDFCONCAT = pdftk
# EXTRATEX  = /usr/share/texmf:
# Note: dvipdfm can be used to generate PDF from DVI in a pinch,
# but pdflatex seems to do slightly better.  We'll invoke both
# latex and pdflatex in the latex2dvi script, and skip dvipdfm
# for now.

all: papers

# Get the set of all papers.  DIRS can be set on the command line to
# suppress some of the papers; as a side effect this disables
# generation of the proceedings.

# To rebuild the Example paper, delete the EXAMPLE/ from the DIRS line below
#DIRS := $(subst /,,$(filter-out  Texmf/ TEMPLATES/, $(wildcard */)))
ifeq ($(DIRS),)
DIRS := $(subst /,,$(filter-out EXAMPLE/ Texmf/ TEMPLATES/, $(wildcard */)))
all: proceedings ProcSeq.mk

# Writing a dependency list for this file is impossible.  We want it
# to be regenerated only when the set of subdirectories changes, but
# there is no way to know that.  Fortunately, generating it is cheap.
ifneq ($(MAKECMDGOALS), clean)
include ProcSeq.mk
ProcSeq.mk:
	@set fnord $(DIRS); shift; \
	while [ $$# -gt 0 ]; do \
	    dir=$${1%/}; shift; \
	    printf '%s/%s-proc.tex: %s/%s-proc.stmp; @:\n' \
                   $$dir $$dir $$dir $$dir; \
	    printf '%s/%s-proc.stmp: ProcDefs.tex %s\n' $$dir $$dir $$prev; \
	    printf '\t./Texmf/make-wrapper $$^ $$@\n'; \
	    prev=$$dir/$$dir-proc.aux; \
	done > $@T
	@mv -f $@T $@
endif
endif

SUBMAKES := $(DIRS:=/Makefile.inc)
include $(SUBMAKES)

# $(space) expands to a single space.
space := $(empty) $(empty)
SEARCHPATH := $(subst $(space),:,$(DIRS)):  # intentional trailing colon

# Render PDF and PostScript for each individual paper.
PS  = $(PAPERS:.dvi=.ps)
PDF = $(PAPERS:.dvi=.pdf)

papers: $(PS) $(PDF)
proceedings: Proceedings.ps Proceedings.pdf

# Render PDF and PostScript for the entire proceedings.  This works as
# follows: For each paper we generate a wrapper file, $(paper)-proc.tex, 
# which reads $(paper).tex in proceedings mode.  The content of this file
# depends on a small number of settings extracted from the top-level
# Proceedings.tex, and the .aux file of the alphabetically previous paper.
# A DVI file generated (in the usual manner) from that wrapper file will
# be suitable for concatenation with all the other DVIs to make the full
# proceedings DVI, from which we then generate PostScript and PDF as usual.

# Stamp-file pattern to prevent trivial changes in Proceedings.tex from
# triggering a complete rebuild.
ProcDefs.tex: ProcDefs.stmp; @:
ProcDefs.stmp: Frontmatter.tex
	{ echo '\PassOptionsToClass{proceedings}{ols}'; \
	  fgrep '\def\Proc' $<; } > ProcDefs.texT
	./Texmf/move-if-change ProcDefs.texT ProcDefs.tex
	echo timestamp > $@

ProcToc.tex: ProcToc.stmp; @:
ProcToc.stmp: $(PAPERS:.dvi=-proc.aux)
	./Texmf/make-toc $(@:.stmp=.tex) $^
	echo timestamp > $@

# These must have explicit rules; the implicit rules below are geared to
# subdirectories, and will not work.
Frontmatter.dvi: Frontmatter.tex ProcToc.tex
	./Texmf/latex2dvi $(*F)

Proceedings.dvi: Frontmatter.dvi $(PAPERS:.dvi=-proc.dvi)
	$(DVICONCAT) -o $@ $^

Proceedings.pdf: Frontmatter.pdf $(PAPERS:.dvi=-proc.pdf)
	$(PDFCONCAT) $^ cat output $@

Proceedings.ps: Proceedings.dvi
	TEXINPUTS=$(SEARCHPATH) $(DVIPS) -q -o $@ $<

# Proceedings.pdf: Proceedings.dvi
#	TEXINPUTS=$(SEARCHPATH) $(DVIPDF) -q -o $@ $<

# Utility.
clean:
	-rm -f $(PAPERS) $(PS) $(PDF)
	-rm -f $(PAPERS:.dvi=.aux) $(PAPERS:.dvi=.oaux) $(PAPERS:.dvi=.log)
	-rm -f $(PAPERS:.dvi=.bbl) $(PAPERS:.dvi=.blg)
	-rm -f $(PAPERS:.dvi=-proc.tex) $(PAPERS:.dvi=-proc.stmp)
	-rm -f $(PAPERS:.dvi=-proc.dvi) $(PAPERS:.dvi=-proc.log)
	-rm -f $(PAPERS:.dvi=-proc.pdf) 
	-rm -f $(PAPERS:.dvi=-proc.aux) $(PAPERS:.dvi=-proc.oaux)
	-rm -f $(PAPERS:.dvi=-proc.bbl) $(PAPERS:.dvi=-proc.blg)

	-rm -f ProcSeq.mk ProcDefs.tex ProcDefs.stmp ProcToc.stmp ProcToc.tex
	-rm -f Frontmatter.dvi Frontmatter.log Frontmatter.aux Frontmatter.oaux
	-rm -f Proceedings.dvi Proceedings.ps Proceedings.pdf

# Pattern rules.  Generation of PDF/PS from DVI is straightforward.
%.pdf: %.dvi
	cd $(@D) && $(DVIPDF) -o $(@F) $(<F)

%.ps: %.dvi
	cd $(@D) && $(DVIPS) -q -o $(@F) $(<F)

.fig.eps:
	fig2dev -L eps $< >$@

.fig.pdf:
	fig2dev -L pdf $< >$@


# Properly regenerating a .dvi file from the corresponding .tex file
# requires running LaTeX (and possibly BibTeX) in a loop.  GNU make
# cannot be coded to do this, so we have a helper script to do it.
# We read the .aux files for nefarious purposes, so make needs to be
# aware that this operation generates them too.
%.dvi %.aux: %.tex
	cd $(@D) && TEXINPUTS=../Texmf:$$TEXINPUTS ../Texmf/latex2dvi $(*F)

.PHONY: all papers proceedings clean
.SECONDARY:  # Never delete intermediate files.

personal git repositories of Harald Welte. Your mileage may vary