Whamcloud - gitweb
- landing of b_hd_cleanup_merge to HEAD.
[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 recovery-manual.pdf
19 else
20   DOCS =
21 endif
22
23 if UTILS
24 man_MANS = lfs.1 lmc.1 lwizard.1 lconf.8 lctl.8
25 endif
26
27
28 IMAGES := $(patsubst %.fig,%.eps,$(wildcard *.fig))
29 LYXFILES= $(filter-out $(patsubst %.lin,%.lyx,$(wildcard *.lin)),\
30         $(wildcard *.lin *.lyx))
31
32 MAINTAINERCLEANFILES =  $(IMAGES) $(DOCS) $(VERSIONED)
33 CLEANFILES = *.aux *.tex doc.old/*.aux doc.old/*.tex *.eps *.log *.pdf
34 VERSIONED = lustre.lyx doc.old/lustre.lyx
35 GENERATED = $(VERSIONED) lustre-full.tex lustre-chbar.tex
36
37 EXTRA_DIST = chbar.sh postbar tex2pdf $(DOCS) $(man_MANS) $(IMAGES)     \
38         $(LYXFILES) lustre.bib lfs.1 lmc.1 lwizard.1 lconf.8 lctl.8
39
40 all:
41 docs: $(DOCS)
42
43 # These variables are set by lbuild/check-build.
44 RPMRELEASE ?= RELEASE
45 KERNTYPE ?= chaos
46 KERNRPM ?= kernel-2.4.18lustre13-RELEASE.i386.rpm
47
48 # update date and version in document
49 date := $(shell date +%x)
50 tag := $(shell echo '$$Name:  $$' | sed -e 's/^\$$Na''me: *\$$$$/HEAD/; s/^\$$Na''me: \(.*\) \$$$$/\1/')
51 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'
52
53 # Regenerate when the $(VERSION) or $Name:  $ changes.
54 .INTERMEDIATE: $(GENERATED)
55 $(VERSIONED) : %.lyx: %.lin Makefile
56         $(addversion) $< > $@
57
58 .lyx.pdf:
59         @echo $(LYX2PDF) $< && $(LYX2PDF) $< || printf "\n*** Warning: not creating PDF docs; install lyx to rectify this\n"
60
61 .lyx.ps:
62         @echo $(LYX2PS) $< && $(LYX2PS) $< || printf "\n*** Warning: not creating PostScript docs; install lyx to rectify this\n"
63
64 .lyx.tex:
65         @echo $(LYX2TEX) $< && $(LYX2TEX) $< || printf "\n*** Warning: not creating LaTeX docs; install lyx to rectify this\n"
66
67 .lyx.txt:
68         @echo $(LYX2TXT) $< && $(LYX2TXT) $< || printf "\n*** Warning: not creating text docs; install lyx to rectify this\n"
69
70 .lyx.html:
71         @echo $(LYX2HTML) $< && $(LYX2HTML) $< || printf "\n*** Warning: not creating HTML docs; install lyx to rectify this\n"
72
73 .tex.pdf:
74         $(TEX2PDF) $<
75
76 .tex.dvi:
77         $(LATEX) $<
78         $(LATEX) $<
79
80 .dvi.ps:
81         $(DVIPS) $< -o $@
82
83 .ps.pdf:
84         $(PS2PDF) $< $@
85
86 lustre.tex recovery-manual.tex lustre.pdf recovery-manual.pdf lustre.txt lustre.html: $(IMAGES) $(LYXFILES)
87 .fig.eps:
88         -fig2dev -L eps $< > $@
89
90 syncweb: lustre.pdf
91         cp lustre.pdf /usr/src/www/content/lustre/docs/lustre.pdf
92         ( cd /usr/src/www ; make lustre ; make synclustre )
93 .PHONY: syncweb chbar
94
95 # Build a changebar document from the files in doc.old and this directory.
96 chbar: lustre-chbar.pdf
97
98 # FIXME: Temporary rules until pdftex displays changebars correctly.
99 lustre-chbar.pdf: lustre-chbar-nopdf.ps
100         $(PS2PDF) $< $@
101 lustre-chbar-nopdf.ps: lustre-chbar-nopdf.dvi
102         $(DVIPS) $< -o $@
103 lustre-chbar-nopdf.dvi: lustre-chbar-nopdf.tex
104         $(LATEX) $<
105         $(LATEX) $<
106 lustre-chbar-nopdf.tex: lustre-chbar.tex
107         sed -e 's/^\(.*usepackage.*pdftex\)/%\1/' $< > $@
108
109 %-chbar.tex: chbar.sh postbar doc.old/%-full.tex %-full.tex
110         $(SHELL) $(srcdir)/chbar.sh doc.old/$*-full.tex $*-full.tex | $(srcdir)/postbar > $@
111
112 doc.old/%-full.tex: doc.old/%.tex
113         cd doc.old && $(TEXEXPAND) -texinputs=. -output=$*-full.tex $*.tex
114
115 # This rule needs to come after the more specific doc.old rule.
116 %-full.tex: %.tex
117         $(TEXEXPAND) -texinputs=. -texinputs=$(srcdir) -output=$@ $<
118
119 # Check out the old directory if it doesn't exist.
120 doc.old/lustre.lin:
121         @if test "X$(OLD)" = X; then \
122           echo "You must populate doc.old or specify a CVS tag like OLD=v0_5_1"; \
123           exit 1; \
124         fi
125         rm -rf doc.old
126         mkdir doc.old
127         cvs checkout -r $(OLD) -d doc.old lustre/doc
128
129 dist-hook:
130         rm -rf $(distdir)/figs/CVS