[media] DocBook: Don't be noisy at make cleanmediadocs
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / Documentation / DocBook / media / Makefile
blobb7627e18fcc90c699205360101b5ab5ccdf89995
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 video.h.xml \
21 IMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/media/, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*/*.gif $(MEDIA_SRC_DIR)/*/*.png)))
22 GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP))
24 PHONY += cleanmediadocs
26 cleanmediadocs:
27 -@rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(IMGFILES) 2>/dev/null
29 $(obj)/media_api.xml: $(GENFILES) FORCE
31 #$(MEDIA_OBJ_DIR)/media_api.html: $(MEDIA_OBJ_DIR)/media_api.xml
32 #$(MEDIA_OBJ_DIR)/media_api.pdf: $(MEDIA_OBJ_DIR)/media_api.xml
33 #$(MEDIA_OBJ_DIR)/media_api.ps: $(MEDIA_OBJ_DIR)/media_api.xml
35 V4L_SGMLS = \
36 $(shell ls $(MEDIA_SRC_DIR)/v4l/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)') \
37 capture.c.xml \
38 keytable.c.xml \
39 v4l2grab.c.xml
41 DVB_SGMLS = \
42 $(shell ls $(MEDIA_SRC_DIR)/dvb/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)')
44 MEDIA_SGMLS = $(addprefix ./,$(V4L_SGMLS)) $(addprefix ./,$(DVB_SGMLS)) $(addprefix ./,$(MEDIA_TEMP))
46 FUNCS = \
47 close \
48 ioctl \
49 mmap \
50 munmap \
51 open \
52 poll \
53 read \
54 select \
55 write \
57 IOCTLS = \
58 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/videodev2.h) \
59 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/audio.h) \
60 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/ca.h) \
61 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/dmx.h) \
62 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/frontend.h) \
63 $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/net.h) \
64 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/dvb/video.h) \
65 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/media.h) \
66 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/linux/v4l2-subdev.h) \
67 VIDIOC_SUBDEV_G_FRAME_INTERVAL \
68 VIDIOC_SUBDEV_S_FRAME_INTERVAL \
69 VIDIOC_SUBDEV_ENUM_MBUS_CODE \
70 VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
71 VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
73 TYPES = \
74 $(shell perl -ne 'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree)/include/linux/videodev2.h) \
75 $(shell perl -ne 'print "$$1 " if /^}\s+([a-z0-9_]+_t)/' $(srctree)/include/linux/dvb/frontend.h)
77 ENUMS = \
78 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \
79 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/audio.h) \
80 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/ca.h) \
81 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/dmx.h) \
82 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/frontend.h) \
83 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/net.h) \
84 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/dvb/video.h) \
85 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \
86 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h) \
87 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h)
89 STRUCTS = \
90 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/videodev2.h) \
91 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s\{]+)\s*/)' $(srctree)/include/linux/dvb/audio.h) \
92 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/ca.h) \
93 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/dmx.h) \
94 $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/frontend.h) \
95 $(shell perl -ne 'print "$$1 " if (/^struct\s+([A-Z][^\s]+)\s+/)' $(srctree)/include/linux/dvb/net.h) \
96 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/linux/dvb/video.h) \
97 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/media.h) \
98 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-subdev.h) \
99 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/linux/v4l2-mediabus.h)
101 ERRORS = \
102 EACCES \
103 EAGAIN \
104 EBADF \
105 EBUSY \
106 EFAULT \
107 EIO \
108 EINTR \
109 EINVAL \
110 ENFILE \
111 ENOMEM \
112 ENOSPC \
113 ENOTTY \
114 ENXIO \
115 EMFILE \
116 EPERM \
117 ERANGE \
118 EPIPE \
120 ESCAPE = \
121 -e "s/&/\\&/g" \
122 -e "s/</\\&lt;/g" \
123 -e "s/>/\\&gt;/g"
125 FILENAME = \
126 -e s,"^[^\/]*/",, \
127 -e s/"\\.xml"// \
128 -e s/"\\.tmpl"// \
129 -e s/\\\./-/g \
130 -e s/"^func-"// \
131 -e s/"^pixfmt-"// \
132 -e s/"^vidioc-"//
134 # Generate references to these structs in videodev2.h.xml.
135 DOCUMENTED = \
136 -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1<link linkend=\"\2\">v4l2_mpeg_cx2341x_video_\2<\/link>/g" \
137 -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1<link linkend=\"\3\">\3<\/link>/g" \
138 -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /<link linkend=\"\1\">\1<\/link> /g" \
139 -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
140 -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g"
142 DVB_DOCUMENTED = \
143 -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \
144 -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
145 -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\<link linkend=\"\2\">\2\<\/link\>,g" \
146 -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
147 -e "s,<link\s\+linkend=\".*\">\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\|__.*_old\)<\/link>,\1,g" \
148 -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
149 -e "s,\(audio-mixer\|audio-karaoke\|audio-status\|ca-slot-info\|ca-descr-info\|ca-caps\|ca-msg\|ca-descr\|ca-pid\|dmx-filter\|dmx-caps\|video-system\|video-highlight\|video-spu\|video-spu-palette\|video-navi-pack\)-t,\1,g" \
150 -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \
151 -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
152 -e "s,<link\s\+linkend=\".*\">\(__.*_OLD\)<\/link>,\1,g" \
155 # Media targets and dependencies
158 $(MEDIA_OBJ_DIR)/v4l2.xml:
159 @$($(quiet)gen_xml)
160 @(mkdir -p $(MEDIA_OBJ_DIR)/media)
161 @(cp $(MEDIA_SRC_DIR)/dvb/*.png $(MEDIA_SRC_DIR)/v4l/*.gif $(MEDIA_OBJ_DIR)/media/)
162 @(ln -sf $(MEDIA_SRC_DIR)/v4l/*xml $(MEDIA_OBJ_DIR)/)
163 @(ln -sf $(MEDIA_SRC_DIR)/dvb/*xml $(MEDIA_OBJ_DIR)/)
165 $(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml
166 @$($(quiet)gen_xml)
167 @( \
168 echo "<programlisting>") > $@
169 @( \
170 expand --tabs=8 < $< | \
171 sed $(ESCAPE) $(DOCUMENTED) | \
172 sed 's/i\.e\./&ie;/') >> $@
173 @( \
174 echo "</programlisting>") >> $@
176 $(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/linux/dvb/audio.h $(MEDIA_OBJ_DIR)/v4l2.xml
177 @$($(quiet)gen_xml)
178 @( \
179 echo "<programlisting>") > $@
180 @( \
181 expand --tabs=8 < $< | \
182 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
183 sed 's/i\.e\./&ie;/') >> $@
184 @( \
185 echo "</programlisting>") >> $@
187 $(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4l2.xml
188 @$($(quiet)gen_xml)
189 @( \
190 echo "<programlisting>") > $@
191 @( \
192 expand --tabs=8 < $< | \
193 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
194 sed 's/i\.e\./&ie;/') >> $@
195 @( \
196 echo "</programlisting>") >> $@
198 $(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/v4l2.xml
199 @$($(quiet)gen_xml)
200 @( \
201 echo "<programlisting>") > $@
202 @( \
203 expand --tabs=8 < $< | \
204 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
205 sed 's/i\.e\./&ie;/') >> $@
206 @( \
207 echo "</programlisting>") >> $@
209 $(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml
210 @$($(quiet)gen_xml)
211 @( \
212 echo "<programlisting>") > $@
213 @( \
214 expand --tabs=8 < $< | \
215 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
216 sed 's/i\.e\./&ie;/') >> $@
217 @( \
218 echo "</programlisting>") >> $@
220 $(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/linux/dvb/net.h $(MEDIA_OBJ_DIR)/v4l2.xml
221 @$($(quiet)gen_xml)
222 @( \
223 echo "<programlisting>") > $@
224 @( \
225 expand --tabs=8 < $< | \
226 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
227 sed 's/i\.e\./&ie;/') >> $@
228 @( \
229 echo "</programlisting>") >> $@
231 $(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml
232 @$($(quiet)gen_xml)
233 @( \
234 echo "<programlisting>") > $@
235 @( \
236 expand --tabs=8 < $< | \
237 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
238 sed 's/i\.e\./&ie;/') >> $@
239 @( \
240 echo "</programlisting>") >> $@
242 $(MEDIA_OBJ_DIR)/media-entities.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml
243 @$($(quiet)gen_xml)
244 @( \
245 echo "<!-- Generated file! Do not edit. -->") >$@
246 @( \
247 echo -e "\n<!-- Functions -->") >>$@
248 @( \
249 for ident in $(FUNCS) ; do \
250 entity=`echo $$ident | tr _ -` ; \
251 echo "<!ENTITY func-$$entity \"<link" \
252 "linkend='func-$$entity'><function>$$ident()</function></link>\">" \
253 >>$@ ; \
254 done)
255 @( \
256 echo -e "\n<!-- Ioctls -->") >>$@
257 @( \
258 for ident in $(IOCTLS) ; do \
259 entity=`echo $$ident | tr _ -` ; \
260 id=`grep "<refname>$$ident" $(MEDIA_OBJ_DIR)/vidioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \
261 echo "<!ENTITY $$entity \"<link" \
262 "linkend='$$id'><constant>$$ident</constant></link>\">" \
263 >>$@ ; \
264 done)
265 @( \
266 echo -e "\n<!-- Types -->") >>$@
267 @( \
268 for ident in $(TYPES) ; do \
269 entity=`echo $$ident | tr _ -` ; \
270 echo "<!ENTITY $$entity \"<link" \
271 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
272 done)
273 @( \
274 echo -e "\n<!-- Enums -->") >>$@
275 @( \
276 for ident in $(ENUMS) ; do \
277 entity=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \
278 echo "<!ENTITY $$entity \"enum&nbsp;<link" \
279 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
280 done)
281 @( \
282 echo -e "\n<!-- Structures -->") >>$@
283 @( \
284 for ident in $(STRUCTS) ; do \
285 entity=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
286 echo "<!ENTITY $$entity \"struct&nbsp;<link" \
287 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
288 done)
289 @( \
290 echo -e "\n<!-- Error Codes -->") >>$@
291 @( \
292 for ident in $(ERRORS) ; do \
293 echo "<!ENTITY $$ident \"<errorcode>$$ident</errorcode>" \
294 "error code\">" >>$@ ; \
295 done)
296 @( \
297 echo -e "\n<!-- Subsections -->") >>$@
298 @( \
299 for file in $(MEDIA_SGMLS) ; do \
300 entity=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \
301 if ! echo "$$file" | \
302 grep -q -E -e '^(func|vidioc|pixfmt)-' ; then \
303 echo "<!ENTITY sub-$$entity SYSTEM \"$$file\">" >>$@ ; \
304 fi ; \
305 done)
306 @( \
307 echo -e "\n<!-- Function Reference -->") >>$@
308 @( \
309 for file in $(MEDIA_SGMLS) ; do \
310 if echo "$$file" | \
311 grep -q -E -e '(func|vidioc|pixfmt)-' ; then \
312 entity=`echo "$$file" |sed $(FILENAME)` ; \
313 echo "<!ENTITY $$entity SYSTEM \"$$file\">" >>$@ ; \
314 fi ; \
315 done)
317 # Jade can auto-generate a list-of-tables, which includes all structs,
318 # but we only want data types, all types, and sorted please.
319 $(MEDIA_OBJ_DIR)/media-indices.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml
320 @$($(quiet)gen_xml)
321 @( \
322 echo "<!-- Generated file! Do not edit. -->") >$@
323 @( \
324 echo -e "\n<index><title>List of Types</title>") >>$@
325 @( \
326 for ident in $(TYPES) ; do \
327 id=`echo $$ident | tr _ -` ; \
328 echo "<indexentry><primaryie><link" \
329 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
330 done)
331 @( \
332 for ident in $(ENUMS) ; do \
333 id=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \
334 echo "<indexentry><primaryie>enum&nbsp;<link" \
335 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
336 done)
337 @( \
338 for ident in $(STRUCTS) ; do \
339 id=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
340 echo "<indexentry><primaryie>struct&nbsp;<link" \
341 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
342 done)
343 @( \
344 echo "</index>") >>$@