[media] DocBook: Add the other DVB API header files
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / Documentation / DocBook / media / Makefile
bloba747f2a6c2c1f5d0f618d5b53116e46c6e76d4e5
1 ###
2 # Media build rules - Auto-generates media contents/indexes and *.h xml's
5 SHELL=/bin/bash
7 MEDIA_OBJ_DIR=$(objtree)/Documentation/DocBook/
8 MEDIA_SRC_DIR=$(srctree)/Documentation/DocBook/media
10 MEDIA_TEMP = media-entities.tmpl \
11 media-indices.tmpl \
12 videodev2.h.xml \
13 v4l2.xml \
14 audio.h.xml \
15 ca.h.xml \
16 dmx.h.xml \
17 frontend.h.xml \
18 net.h.xml \
19 osd.h.xml \
20 video.h.xml \
22 IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png)))
23 GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP))
25 PHONY += cleanmediadocs mediaindexdocs
27 cleanmediadocs:
28 -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES)
30 $(obj)/media_api.xml: $(GENFILES) FORCE
32 #$(MEDIA_OBJ_DIR)/media_api.html: $(MEDIA_OBJ_DIR)/media_api.xml
33 #$(MEDIA_OBJ_DIR)/media_api.pdf: $(MEDIA_OBJ_DIR)/media_api.xml
34 #$(MEDIA_OBJ_DIR)/media_api.ps: $(MEDIA_OBJ_DIR)/media_api.xml
36 V4L_SGMLS = \
37 $(shell ls $(MEDIA_SRC_DIR)/v4l/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') \
38 capture.c.xml \
39 keytable.c.xml \
40 v4l2grab.c.xml
42 DVB_SGMLS = \
43 $(shell ls $(MEDIA_SRC_DIR)/dvb/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)')
45 MEDIA_SGMLS = $(addprefix ./,$(V4L_SGMLS)) $(addprefix ./,$(DVB_SGMLS)) $(addprefix ./,$(MEDIA_TEMP))
47 FUNCS = \
48 close \
49 ioctl \
50 mmap \
51 munmap \
52 open \
53 poll \
54 read \
55 select \
56 write \
58 IOCTLS = \
59 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \
60 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/audio.h) \
61 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/ca.h) \
62 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/dmx.h) \
63 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/frontend.h) \
64 $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/net.h) \
65 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/osd.h) \
66 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/video.h) \
67 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \
68 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \
69 VIDIOC_SUBDEV_G_FRAME_INTERVAL \
70 VIDIOC_SUBDEV_S_FRAME_INTERVAL \
71 VIDIOC_SUBDEV_ENUM_MBUS_CODE \
72 VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
73 VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
75 TYPES = \
76 $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) \
77 $(shell perl -ne 'print "$$1 " if /^}\s+([a-z0-9_]+_t)/' $(srctree)/include/linux/dvb/frontend.h)
79 ENUMS = \
80 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \
81 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/audio.h) \
82 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/ca.h) \
83 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/dmx.h) \
84 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \
85 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/net.h) \
86 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/osd.h) \
87 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/video.h) \
88 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \
89 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \
90 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h)
92 STRUCTS = \
93 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \
94 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s\{]+)\s*/)' $(srctree)/include/linux/dvb/audio.h) \
95 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/ca.h) \
96 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/dmx.h) \
97 $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/frontend.h) \
98 $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/linux/dvb/net.h) \
99 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/osd.h) \
100 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/video.h) \
101 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \
102 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \
103 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h)
105 ERRORS = \
106 EACCES \
107 EAGAIN \
108 EBADF \
109 EBUSY \
110 EFAULT \
111 EIO \
112 EINTR \
113 EINVAL \
114 ENFILE \
115 ENOMEM \
116 ENOSPC \
117 ENOTTY \
118 ENXIO \
119 EMFILE \
120 EPERM \
121 ERANGE \
122 EPIPE \
124 ESCAPE = \
125 -e "s/&/\\&/g" \
126 -e "s/</\\&lt;/g" \
127 -e "s/>/\\&gt;/g"
129 FILENAME = \
130 -e s,"^[^\/]*/",, \
131 -e s/"\\.xml"// \
132 -e s/"\\.tmpl"// \
133 -e s/\\\./-/g \
134 -e s/"^func-"// \
135 -e s/"^pixfmt-"// \
136 -e s/"^vidioc-"//
138 # Generate references to these structs in videodev2.h.xml.
139 DOCUMENTED = \
140 -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1<link linkend=\"\2\">v4l2_mpeg_cx2341x_video_\2<\/link>/g" \
141 -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1<link linkend=\"\3\">\3<\/link>/g" \
142 -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /<link linkend=\"\1\">\1<\/link> /g" \
143 -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
144 -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g"
146 DVB_DOCUMENTED = \
147 -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \
148 -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
149 -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\<link linkend=\"\2\">\2\<\/link\>,g" \
150 -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
151 -e "s,<link linkend=\".*\">\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\)<\/link>,\1,g" \
152 -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
153 -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \
154 -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
157 # Media targets and dependencies
160 $(MEDIA_OBJ_DIR)/v4l2.xml:
161 @$($(quiet)gen_xml)
162 @(mkdir -p $(MEDIA_OBJ_DIR)/media)
163 @(cp $(MEDIA_SRC_DIR)/dvb/*.png $(MEDIA_SRC_DIR)/v4l/*.gif $(MEDIA_OBJ_DIR)/media/)
164 @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/)
165 @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/)
167 $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml
168 @$($(quiet)gen_xml)
169 @( \
170 echo "<programlisting>") > $@
171 @( \
172 expand --tabs=8 < $< | \
173 sed $(ESCAPE) $(DOCUMENTED) | \
174 sed 's/i\.e\./&ie;/') >> $@
175 @( \
176 echo "</programlisting>") >> $@
178 $(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/linux/dvb/audio.h $(MEDIA_OBJ_DIR)/v4l2.xml
179 @$($(quiet)gen_xml)
180 @( \
181 echo "<programlisting>") > $@
182 @( \
183 expand --tabs=8 < $< | \
184 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
185 sed 's/i\.e\./&ie;/') >> $@
186 @( \
187 echo "</programlisting>") >> $@
189 $(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4l2.xml
190 @$($(quiet)gen_xml)
191 @( \
192 echo "<programlisting>") > $@
193 @( \
194 expand --tabs=8 < $< | \
195 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
196 sed 's/i\.e\./&ie;/') >> $@
197 @( \
198 echo "</programlisting>") >> $@
200 $(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/v4l2.xml
201 @$($(quiet)gen_xml)
202 @( \
203 echo "<programlisting>") > $@
204 @( \
205 expand --tabs=8 < $< | \
206 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
207 sed 's/i\.e\./&ie;/') >> $@
208 @( \
209 echo "</programlisting>") >> $@
211 $(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml
212 @$($(quiet)gen_xml)
213 @( \
214 echo "<programlisting>") > $@
215 @( \
216 expand --tabs=8 < $< | \
217 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
218 sed 's/i\.e\./&ie;/') >> $@
219 @( \
220 echo "</programlisting>") >> $@
222 $(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/linux/dvb/net.h $(MEDIA_OBJ_DIR)/v4l2.xml
223 @$($(quiet)gen_xml)
224 @( \
225 echo "<programlisting>") > $@
226 @( \
227 expand --tabs=8 < $< | \
228 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
229 sed 's/i\.e\./&ie;/') >> $@
230 @( \
231 echo "</programlisting>") >> $@
233 $(MEDIA_OBJ_DIR)/osd.h.xml: $(srctree)/include/linux/dvb/osd.h $(MEDIA_OBJ_DIR)/v4l2.xml
234 @$($(quiet)gen_xml)
235 @( \
236 echo "<programlisting>") > $@
237 @( \
238 expand --tabs=8 < $< | \
239 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
240 sed 's/i\.e\./&ie;/') >> $@
241 @( \
242 echo "</programlisting>") >> $@
244 $(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml
245 @$($(quiet)gen_xml)
246 @( \
247 echo "<programlisting>") > $@
248 @( \
249 expand --tabs=8 < $< | \
250 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
251 sed 's/i\.e\./&ie;/') >> $@
252 @( \
253 echo "</programlisting>") >> $@
255 $(MEDIA_OBJ_DIR)/media-entities.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml
256 @$($(quiet)gen_xml)
257 @( \
258 echo "<!-- Generated file! Do not edit. -->") >$@
259 @( \
260 echo -e "\n<!-- Functions -->") >>$@
261 @( \
262 for ident in $(FUNCS) ; do \
263 entity=`echo $$ident | tr _ -` ; \
264 echo "<!ENTITY func-$$entity \"<link" \
265 "linkend='func-$$entity'><function>$$ident()</function></link>\">" \
266 >>$@ ; \
267 done)
268 @( \
269 echo -e "\n<!-- Ioctls -->") >>$@
270 @( \
271 for ident in $(IOCTLS) ; do \
272 entity=`echo $$ident | tr _ -` ; \
273 id=`grep "<refname>$$ident" $(MEDIA_OBJ_DIR)/vidioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \
274 echo "<!ENTITY $$entity \"<link" \
275 "linkend='$$id'><constant>$$ident</constant></link>\">" \
276 >>$@ ; \
277 done)
278 @( \
279 echo -e "\n<!-- Types -->") >>$@
280 @( \
281 for ident in $(TYPES) ; do \
282 entity=`echo $$ident | tr _ -` ; \
283 echo "<!ENTITY $$entity \"<link" \
284 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
285 done)
286 @( \
287 echo -e "\n<!-- Enums -->") >>$@
288 @( \
289 for ident in $(ENUMS) ; do \
290 entity=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \
291 echo "<!ENTITY $$entity \"enum&nbsp;<link" \
292 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
293 done)
294 @( \
295 echo -e "\n<!-- Structures -->") >>$@
296 @( \
297 for ident in $(STRUCTS) ; do \
298 entity=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
299 echo "<!ENTITY $$entity \"struct&nbsp;<link" \
300 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
301 done)
302 @( \
303 echo -e "\n<!-- Error Codes -->") >>$@
304 @( \
305 for ident in $(ERRORS) ; do \
306 echo "<!ENTITY $$ident \"<errorcode>$$ident</errorcode>" \
307 "error code\">" >>$@ ; \
308 done)
309 @( \
310 echo -e "\n<!-- Subsections -->") >>$@
311 @( \
312 for file in $(MEDIA_SGMLS) ; do \
313 entity=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \
314 if ! echo "$$file" | \
315 grep -q -E -e '^(func|vidioc|pixfmt)-' ; then \
316 echo "<!ENTITY sub-$$entity SYSTEM \"$$file\">" >>$@ ; \
317 fi ; \
318 done)
319 @( \
320 echo -e "\n<!-- Function Reference -->") >>$@
321 @( \
322 for file in $(MEDIA_SGMLS) ; do \
323 if echo "$$file" | \
324 grep -q -E -e '(func|vidioc|pixfmt)-' ; then \
325 entity=`echo "$$file" |sed $(FILENAME)` ; \
326 echo "<!ENTITY $$entity SYSTEM \"$$file\">" >>$@ ; \
327 fi ; \
328 done)
330 # Jade can auto-generate a list-of-tables, which includes all structs,
331 # but we only want data types, all types, and sorted please.
332 $(MEDIA_OBJ_DIR)/media-indices.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml
333 @$($(quiet)gen_xml)
334 @( \
335 echo "<!-- Generated file! Do not edit. -->") >$@
336 @( \
337 echo -e "\n<index><title>List of Types</title>") >>$@
338 @( \
339 for ident in $(TYPES) ; do \
340 id=`echo $$ident | tr _ -` ; \
341 echo "<indexentry><primaryie><link" \
342 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
343 done)
344 @( \
345 for ident in $(ENUMS) ; do \
346 id=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \
347 echo "<indexentry><primaryie>enum&nbsp;<link" \
348 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
349 done)
350 @( \
351 for ident in $(STRUCTS) ; do \
352 id=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
353 echo "<indexentry><primaryie>struct&nbsp;<link" \
354 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
355 done)
356 @( \
357 echo "</index>") >>$@