doc/Makefile.am : Fix broken build.
[platform/upstream/libvorbis.git] / doc / Makefile.am
1 ## Process this with automake to create Makefile.in
2
3 SUBDIRS = vorbisfile vorbisenc
4
5 docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION)
6
7 ### all of the static docs, commited to SVN and included as is
8 static_docs = \
9         draft-ietf-avt-rtp-vorbis-07.xml \
10         draft-ietf-avt-rtp-vorbis-07.txt \
11         eightphase.png \
12         evenlsp.png \
13         floor1_inverse_dB_table.html \
14         floorval.png \
15         fourphase.png \
16         framing.html \
17         helper.html \
18         index.html \
19         lspmap.png \
20         oddlsp.png \
21         oggstream.html \
22         programming.html \
23         squarepolar.png \
24         stereo.html \
25         stream.png \
26         v-comment.html \
27         vorbis-clip.txt \
28         vorbis-errors.txt \
29         vorbis-fidelity.html \
30         vorbis.html \
31         vorbisword2.png \
32         wait.png \
33         white-ogg.png \
34         white-xifish.png
35
36 ### FIXME: bits needed by the spec which lives in xml
37 SPEC_PNG = \
38         components.png \
39         floor1-1.png \
40         floor1-2.png \
41         floor1-3.png \
42         floor1-4.png \
43         hufftree.png \
44         hufftree-under.png \
45         residue-pack.png \
46         residue2.png \
47         white-xifish.png \
48         window1.png \
49         window2.png
50 SPEC_PDF = xifish.pdf
51
52 # FIXME: also needed here
53 #       white-xifish.png 
54
55 built_docs = Vorbis_I_spec.html Vorbis_I_spec.pdf
56
57 # conditionally make the generated documentation
58 if BUILD_DOCS
59 doc_DATA = $(static_docs) $(SPEC_PNG) $(built_docs)
60 else
61 doc_DATA = $(static_docs) $(SPEC_PNG)
62 endif
63
64 EXTRA_DIST = $(static_docs) $(doc_sources) \
65         $(SPEC_PNG) $(SPEC_PDF) $(built_docs)
66
67 doc_sources = xml/Vorbis_I_spec.xml \
68         xml/01-introduction.xml \
69         xml/02-bitpacking.xml \
70         xml/03-codebook.xml \
71         xml/04-codec.xml \
72         xml/05-comment.xml \
73         xml/06-floor0.xml \
74         xml/07-floor1.xml \
75         xml/08-residue.xml \
76         xml/09-helper.xml \
77         xml/10-tables.xml \
78         xml/a1-encapsulation_ogg.xml \
79         xml/a2-encapsulation_rtp.xml \
80         xml/footer.xml \
81         xml/spec-common.xsl \
82         xml/spec-fo.xsl \
83         xml/spec-html.xsl
84
85 # these are expensive; only remove if we have to
86 DISTCLEANFILES = $(built_docs)
87 CLEANFILES = Vorbis_I_spec.fo spec.aux spec.log spec.out
88
89 # rules for temporary build dir for spec
90 BUILDDIR = build
91 # how to copy images to build dir
92 SPEC_PNG_BUILD = $(foreach file, $(SPEC_PNG), $(BUILDDIR)/$(file))
93 SPEC_PDF_BUILD = $(foreach file, $(SPEC_PDF), $(BUILDDIR)/$(file))
94 $(BUILDDIR)/%: $(srcdir)/%
95         @echo "Copying $< to $@"
96         @mkdir -p $(BUILDDIR)
97         @cp $< $@
98
99 # how to copy the xml to build dir; cheat by only targeting the main one
100 $(BUILDDIR)/Vorbis_I_spec.xml: $(doc_sources)
101         @mkdir -p $(BUILDDIR)
102         @for file in $(doc_sources); do cp $(srcdir)/$$file $(BUILDDIR); done
103 # translate the draft rtp.txt to .xml in the BUILDDIR
104 $(BUILDDIR)/draft-rtp.xml: draft-ietf-avt-rtp-vorbis-05.txt
105         cat $< | sed 's/\f//g' > $@
106 # cat $< | sed 's/\f//g' | sed 's/</\&lt;/g' | sed 's/>/\&gt;/g' > $@
107
108 # explicit rules for generating docs
109 if BUILD_DOCS
110 Vorbis_I_spec.html: $(SPEC_PNG_BUILD) $(BUILDDIR)/Vorbis_I_spec.xml
111         cd build; xsltproc --xinclude --output Vorbis_I_spec.html spec-html.xsl Vorbis_I_spec.xml && mv $@ ..
112
113 Vorbis_I_spec.fo: $(BUILDDIR)/Vorbis_I_spec.xml
114         cd build; xsltproc --xinclude --output $@ spec-fo.xsl Vorbis_I_spec.xml && mv $@ ..
115
116 # we add the two newlines to pdfxmltex because this entire XML
117 # toolchain is built from wishful thinking and bonghits and the
118 # default supplied passivetex config files are buggy.
119 Vorbis_I_spec.pdf: Vorbis_I_spec.fo $(SPEC_PNG_BUILD) $(SPEC_PDF_BUILD)
120         cp $< build/spec.fo # work around a passivetex bug
121         -cd build; echo -e -n "\n\n" | pdfxmltex spec.fo
122         -cd build; echo -e -n "\n\n" | pdfxmltex spec.fo
123         rm build/spec.fo
124         mv build/spec.pdf $@
125 else
126 Vorbis_I_spec.html: NO_DOCS_ERROR
127 Vorbis_I_spec.pdf: NO_DOCS_ERROR
128 NO_DOCS_ERROR:
129         @echo
130         @echo "*** Documentation has not been built! ***"
131         @echo "Try re-running after passing --enable-docs to configure."
132         @echo
133 endif
134
135 # clean up build dir
136 clean-local:
137         -$(RM) -r $(BUILDDIR)