2 # Media build rules - Auto-generates media contents/indexes and *.h xml's
7 MEDIA_OBJ_DIR
=$(objtree
)/Documentation
/DocBook
/
8 MEDIA_SRC_DIR
=$(srctree
)/Documentation
/DocBook
/media
10 MEDIA_TEMP
= media-entities.tmpl \
16 IMGFILES
:= $(addprefix $(MEDIA_OBJ_DIR
)/media
/, $(notdir $(shell ls
$(MEDIA_SRC_DIR
)/*/*.gif
$(MEDIA_SRC_DIR
)/*/*.png
)))
17 GENFILES
:= $(addprefix $(MEDIA_OBJ_DIR
)/, $(MEDIA_TEMP
))
19 PHONY
+= cleanmediadocs mediaindexdocs
22 -@
rm `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES
) $(IMGFILES
)
24 $(obj
)/media_api.xml
: $(GENFILES
) FORCE
26 #$(MEDIA_OBJ_DIR)/media_api.html: $(MEDIA_OBJ_DIR)/media_api.xml
27 #$(MEDIA_OBJ_DIR)/media_api.pdf: $(MEDIA_OBJ_DIR)/media_api.xml
28 #$(MEDIA_OBJ_DIR)/media_api.ps: $(MEDIA_OBJ_DIR)/media_api.xml
31 $(shell ls
$(MEDIA_SRC_DIR
)/v4l
/*.xml|perl
-ne
'print "$$1 " if (m,.*/(.*)\n,)') \
37 $(shell ls
$(MEDIA_SRC_DIR
)/dvb
/*.xml|perl
-ne
'print "$$1 " if (m,.*/(.*)\n,)')
39 MEDIA_SGMLS
= $(addprefix .
/,$(V4L_SGMLS
)) $(addprefix .
/,$(DVB_SGMLS
)) $(addprefix .
/,$(MEDIA_TEMP
))
53 $(shell perl
-ne
'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree
)/include/linux
/videodev2.h
) \
54 $(shell perl
-ne
'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree
)/include/linux
/dvb
/frontend.h
) \
55 $(shell perl
-ne
'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree
)/include/linux
/media.h
) \
56 $(shell perl
-ne
'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree
)/include/linux
/v4l2-subdev.h
) \
57 VIDIOC_SUBDEV_G_FRAME_INTERVAL \
58 VIDIOC_SUBDEV_S_FRAME_INTERVAL \
59 VIDIOC_SUBDEV_ENUM_MBUS_CODE \
60 VIDIOC_SUBDEV_ENUM_FRAME_SIZE \
61 VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL \
64 $(shell perl
-ne
'print "$$1 " if /^typedef\s+[^\s]+\s+([^\s]+)\;/' $(srctree
)/include/linux
/videodev2.h
) \
65 $(shell perl
-ne
'print "$$1 " if /^}\s+([a-z0-9_]+_t)/' $(srctree
)/include/linux
/dvb
/frontend.h
)
68 $(shell perl
-ne
'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree
)/include/linux
/videodev2.h
) \
69 $(shell perl
-ne
'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree
)/include/linux
/dvb
/frontend.h
) \
70 $(shell perl
-ne
'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree
)/include/linux
/media.h
) \
71 $(shell perl
-ne
'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree
)/include/linux
/v4l2-mediabus.h
) \
72 $(shell perl
-ne
'print "$$1 " if /^enum\s+([^\s]+)\s+/' $(srctree
)/include/linux
/v4l2-subdev.h
)
75 $(shell perl
-ne
'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree
)/include/linux
/videodev2.h
) \
76 $(shell perl
-ne
'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree
)/include/linux
/dvb
/frontend.h
) \
77 $(shell perl
-ne
'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree
)/include/linux
/media.h
) \
78 $(shell perl
-ne
'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree
)/include/linux
/v4l2-subdev.h
) \
79 $(shell perl
-ne
'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree
)/include/linux
/v4l2-mediabus.h
)
114 # Generate references to these structs in videodev2.h.xml.
116 -e
"s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1<link linkend=\"\2\">v4l2_mpeg_cx2341x_video_\2<\/link>/g" \
117 -e
"s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1<link linkend=\"\3\">\3<\/link>/g" \
118 -e
"s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\) /<link linkend=\"\1\">\1<\/link> /g" \
119 -e
":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
120 -e
"s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g"
123 -e
"s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \
124 -e
"s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
125 -e
"s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\<link linkend=\"\2\">\2\<\/link\>,g" \
126 -e
"s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
127 -e
":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
128 -e
"s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \
129 -e
"s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
130 # -e "s,\(\s\+\)\(FE_[A-Z0-9_]\+\)\([\s\=\,]*\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
133 # Media targets and dependencies
136 $(MEDIA_OBJ_DIR
)/v4l2.xml
:
138 @
(mkdir
-p
$(MEDIA_OBJ_DIR
)/media
)
139 @
(cp
$(MEDIA_SRC_DIR
)/dvb
/*.png
$(MEDIA_SRC_DIR
)/v4l
/*.gif
$(MEDIA_OBJ_DIR
)/media
/)
140 @
(ln
-sf
$(MEDIA_SRC_DIR
)/v4l
/*xml
$(MEDIA_OBJ_DIR
)/)
141 @
(ln
-sf
$(MEDIA_SRC_DIR
)/dvb
/*xml
$(MEDIA_OBJ_DIR
)/)
143 $(MEDIA_OBJ_DIR
)/videodev2.h.xml
: $(srctree
)/include/linux
/videodev2.h
$(MEDIA_OBJ_DIR
)/v4l2.xml
146 echo
"<programlisting>") > $@
148 expand
--tabs
=8 < $< | \
149 sed
$(ESCAPE
) $(DOCUMENTED
) | \
150 sed
's/i\.e\./&ie;/') >> $@
152 echo
"</programlisting>") >> $@
154 $(MEDIA_OBJ_DIR
)/frontend.h.xml
: $(srctree
)/include/linux
/dvb
/frontend.h
$(MEDIA_OBJ_DIR
)/v4l2.xml
157 echo
"<programlisting>") > $@
159 expand
--tabs
=8 < $< | \
160 sed
$(ESCAPE
) $(DVB_DOCUMENTED
) | \
161 sed
's/i\.e\./&ie;/') >> $@
163 echo
"</programlisting>") >> $@
165 $(MEDIA_OBJ_DIR
)/media-entities.tmpl
: $(MEDIA_OBJ_DIR
)/v4l2.xml
168 echo
"<!-- Generated file! Do not edit. -->") >$@
170 echo
-e
"\n<!-- Functions -->") >>$@
172 for ident in
$(FUNCS
) ; do \
173 entity
=`echo $$ident | tr _ -` ; \
174 echo
"<!ENTITY func-$$entity \"<link" \
175 "linkend='func-$$entity'><function>$$ident()</function></link>\">" \
179 echo
-e
"\n<!-- Ioctls -->") >>$@
181 for ident in
$(IOCTLS
) ; do \
182 entity
=`echo $$ident | tr _ -` ; \
183 id
=`grep "<refname>$$ident" $(MEDIA_OBJ_DIR)/vidioc-*.xml | sed -r s,"^.*/(.*).xml.*","\1",` ; \
184 echo
"<!ENTITY $$entity \"<link" \
185 "linkend='$$id'><constant>$$ident</constant></link>\">" \
189 echo
-e
"\n<!-- Types -->") >>$@
191 for ident in
$(TYPES
) ; do \
192 entity
=`echo $$ident | tr _ -` ; \
193 echo
"<!ENTITY $$entity \"<link" \
194 "linkend='$$entity'>$$ident</link>\">" >>$@
; \
197 echo
-e
"\n<!-- Enums -->") >>$@
199 for ident in
$(ENUMS
) ; do \
200 entity
=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \
201 echo
"<!ENTITY $$entity \"enum <link" \
202 "linkend='$$entity'>$$ident</link>\">" >>$@
; \
205 echo
-e
"\n<!-- Structures -->") >>$@
207 for ident in
$(STRUCTS
) ; do \
208 entity
=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
209 echo
"<!ENTITY $$entity \"struct <link" \
210 "linkend='$$entity'>$$ident</link>\">" >>$@
; \
213 echo
-e
"\n<!-- Error Codes -->") >>$@
215 for ident in
$(ERRORS
) ; do \
216 echo
"<!ENTITY $$ident \"<errorcode>$$ident</errorcode>" \
217 "error code\">" >>$@
; \
220 echo
-e
"\n<!-- Subsections -->") >>$@
222 for file in
$(MEDIA_SGMLS
) ; do \
223 entity
=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \
224 if
! echo
"$$file" | \
225 grep
-q
-E
-e
'^(func|vidioc|pixfmt)-' ; then \
226 echo
"<!ENTITY sub-$$entity SYSTEM \"$$file\">" >>$@
; \
230 echo
-e
"\n<!-- Function Reference -->") >>$@
232 for file in
$(MEDIA_SGMLS
) ; do \
234 grep
-q
-E
-e
'(func|vidioc|pixfmt)-' ; then \
235 entity
=`echo "$$file" |sed $(FILENAME)` ; \
236 echo
"<!ENTITY $$entity SYSTEM \"$$file\">" >>$@
; \
240 # Jade can auto-generate a list-of-tables, which includes all structs,
241 # but we only want data types, all types, and sorted please.
242 $(MEDIA_OBJ_DIR
)/media-indices.tmpl
: $(MEDIA_OBJ_DIR
)/v4l2.xml
245 echo
"<!-- Generated file! Do not edit. -->") >$@
247 echo
-e
"\n<index><title>List of Types</title>") >>$@
249 for ident in
$(TYPES
) ; do \
250 id
=`echo $$ident | tr _ -` ; \
251 echo
"<indexentry><primaryie><link" \
252 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@
; \
255 for ident in
$(ENUMS
) ; do \
256 id
=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \
257 echo
"<indexentry><primaryie>enum <link" \
258 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@
; \
261 for ident in
$(STRUCTS
) ; do \
262 id
=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
263 echo
"<indexentry><primaryie>struct <link" \
264 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@
; \
267 echo
"</index>") >>$@