Whamcloud - gitweb
a47d5e7fa1a86ac38497af0243cef927eabf9482
[fs/lustre-release.git] / lustre / doc / Makefile.am
1 # Copyright (C) 2001, 2002 Cluster File Systems, Inc.
2 #
3 # This code is issued under the GNU General Public License.
4 # See the file COPYING in this distribution
5 LYX2PDF = GS_OPTIONS=-dCompatibilityLevel=1.1 $(srcdir)/tex2pdf -overwrite
6 TEX2PDF = GS_OPTIONS=-dCompatibilityLevel=1.1 $(srcdir)/tex2pdf -overwrite
7 LYX2PS = lyx --export ps
8 LYX2TEX = lyx --export latex
9 LYX2TXT = lyx --export text
10 LYX2HTML = lyx --export html
11 LATEX = latex
12 DVIPS = dvips
13 PS2PDF = ps2pdf
14 TEXEXPAND = texexpand
15 SUFFIXES = .lin .lyx .pdf .ps .sgml .html .txt .tex .fig .eps .dvi
16
17 if DOC
18   DOCS = lustre.pdf
19 else
20   DOCS =
21 endif
22
23 IMAGES := $(patsubst %.fig,%.eps,$(wildcard *.fig))
24 LYXFILES= $(filter-out $(patsubst %.lin,%.lyx,$(wildcard *.lin)),\
25         $(wildcard *.lin *.lyx))
26
27 MAINTAINERCLEANFILES =  $(IMAGES) $(DOCS) $(VERSIONED)
28 CLEANFILES = *.aux *.tex doc.old/*.aux doc.old/*.tex *.eps *.log *.pdf
29 VERSIONED = lustre.lyx doc.old/lustre.lyx
30 GENERATED = $(VERSIONED) lustre-full.tex lustre-chbar.tex
31
32 EXTRA_DIST = chbar.sh postbar tex2pdf $(DOCS) $(IMAGES) $(LYXFILES) lustre.bib
33
34 all:
35 docs: $(DOCS)
36
37 # These variables are set by lbuild/check-build.
38 RPMRELEASE ?= RELEASE
39 KERNTYPE ?= chaos
40 KERNRPM ?= kernel-2.4.18lustre13-RELEASE.i386.rpm
41
42 # update date and version in document
43 date := $(shell date +%x)
44 tag := $(shell echo '$$Name:  $$' | sed -e 's/^\$$Na''me: *\$$$$/HEAD/; s/^\$$Na''me: \(.*\) \$$$$/\1/')
45 addversion = sed -e 's|@T''AG@|$(tag)|g; s|@VER''SION@|$(VERSION)|g; s|@DA''TE@|$(date)|g; s|@RPM''RELEASE@|$(RPMRELEASE)|g; s|@KERN''TYPE@|$(KERNTYPE)|g; s|@KERN''RPM@|$(KERNRPM)|g'
46
47 # Regenerate when the $(VERSION) or $Name:  $ changes.
48 .INTERMEDIATE: $(GENERATED)
49 $(VERSIONED) : %.lyx: %.lin Makefile
50         $(addversion) $< > $@
51
52 .lyx.pdf:
53         @echo $(LYX2PDF) $< && $(LYX2PDF) $< || printf "\n*** Warning: not creating PDF docs; install lyx to rectify this\n"
54
55 .lyx.ps:
56         @echo $(LYX2PS) $< && $(LYX2PS) $< || printf "\n*** Warning: not creating PostScript docs; install lyx to rectify this\n"
57
58 .lyx.tex:
59         @echo $(LYX2TEX) $< && $(LYX2TEX) $< || printf "\n*** Warning: not creating LaTeX docs; install lyx to rectify this\n"
60
61 .lyx.txt:
62         @echo $(LYX2TXT) $< && $(LYX2TXT) $< || printf "\n*** Warning: not creating text docs; install lyx to rectify this\n"
63
64 .lyx.html:
65         @echo $(LYX2HTML) $< && $(LYX2HTML) $< || printf "\n*** Warning: not creating HTML docs; install lyx to rectify this\n"
66
67 .tex.pdf:
68         $(TEX2PDF) $<
69
70 .tex.dvi:
71         $(LATEX) $<
72         $(LATEX) $<
73
74 .dvi.ps:
75         $(DVIPS) $< -o $@
76
77 .ps.pdf:
78         $(PS2PDF) $< $@
79
80 lustre.tex lustre.pdf lustre.txt lustre.html: $(IMAGES) $(LYXFILES)
81 .fig.eps:
82         -fig2dev -L eps $< > $@
83
84 syncweb: lustre.pdf
85         cp lustre.pdf /usr/src/www/content/lustre/docs/lustre.pdf
86         ( cd /usr/src/www ; make lustre ; make synclustre )
87 .PHONY: syncweb chbar
88
89 # Build a changebar document from the files in doc.old and this directory.
90 chbar: lustre-chbar.pdf
91
92 # FIXME: Temporary rules until pdftex displays changebars correctly.
93 lustre-chbar.pdf: lustre-chbar-nopdf.ps
94         $(PS2PDF) $< $@
95 lustre-chbar-nopdf.ps: lustre-chbar-nopdf.dvi
96         $(DVIPS) $< -o $@
97 lustre-chbar-nopdf.dvi: lustre-chbar-nopdf.tex
98         $(LATEX) $<
99         $(LATEX) $<
100 lustre-chbar-nopdf.tex: lustre-chbar.tex
101         sed -e 's/^\(.*usepackage.*pdftex\)/%\1/' $< > $@
102
103 %-chbar.tex: chbar.sh postbar doc.old/%-full.tex %-full.tex
104         $(SHELL) $(srcdir)/chbar.sh doc.old/$*-full.tex $*-full.tex | $(srcdir)/postbar > $@
105
106 doc.old/%-full.tex: doc.old/%.tex
107         cd doc.old && $(TEXEXPAND) -texinputs=. -output=$*-full.tex $*.tex
108
109 # This rule needs to come after the more specific doc.old rule.
110 %-full.tex: %.tex
111         $(TEXEXPAND) -texinputs=. -texinputs=$(srcdir) -output=$@ $<
112
113 # Check out the old directory if it doesn't exist.
114 doc.old/lustre.lin:
115         @if test "X$(OLD)" = X; then \
116           echo "You must populate doc.old or specify a CVS tag like OLD=v0_5_1"; \
117           exit 1; \
118         fi
119         rm -rf doc.old
120         mkdir doc.old
121         cvs checkout -r $(OLD) -d doc.old lustre/doc
122
123 dist-hook:
124         rm -rf $(distdir)/figs/CVS