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