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