blob: 2840ff483d5a204db2e5e1c183ca143295f7ab20 [file] [log] [blame]
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -03001###
2# Media build rules - Auto-generates media contents/indexes and *.h xml's
3#
4
5SHELL=/bin/bash
6
7MEDIA_OBJ_DIR=$(objtree)/Documentation/DocBook/
8MEDIA_SRC_DIR=$(srctree)/Documentation/DocBook/media
9
10MEDIA_TEMP = media-entities.tmpl \
11 media-indices.tmpl \
12 videodev2.h.xml \
13 v4l2.xml \
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -030014 audio.h.xml \
15 ca.h.xml \
16 dmx.h.xml \
17 frontend.h.xml \
18 net.h.xml \
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -030019 video.h.xml \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030020
Mauro Carvalho Chehabbd7319d2011-06-15 23:13:19 -030021IMGFILES := $(patsubst %.b64,%, $(notdir $(shell ls $(MEDIA_SRC_DIR)/*.b64)))
22OBJIMGFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(IMGFILES))
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030023GENFILES := $(addprefix $(MEDIA_OBJ_DIR)/, $(MEDIA_TEMP))
24
Mauro Carvalho Chehaba012fb22011-06-09 16:34:29 -030025PHONY += cleanmediadocs
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030026
27cleanmediadocs:
Takashi Iwai0684d842014-10-21 18:18:12 +020028 -@rm -f `find $(MEDIA_OBJ_DIR) -type l` $(GENFILES) $(OBJIMGFILES) 2>/dev/null
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030029
30$(obj)/media_api.xml: $(GENFILES) FORCE
31
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
35
36V4L_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
41
42DVB_SGMLS = \
43 $(shell ls $(MEDIA_SRC_DIR)/dvb/*.xml|perl -ne 'print "$$1 " if (m,.*/(.*)\n,)')
44
45MEDIA_SGMLS = $(addprefix ./,$(V4L_SGMLS)) $(addprefix ./,$(DVB_SGMLS)) $(addprefix ./,$(MEDIA_TEMP))
46
47FUNCS = \
48 close \
49 ioctl \
50 mmap \
51 munmap \
52 open \
53 poll \
54 read \
55 select \
56 write \
57
58IOCTLS = \
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -030059 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/videodev2.h) \
60 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/audio.h) \
61 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/ca.h) \
62 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/dmx.h) \
63 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/frontend.h) \
64 $(shell perl -ne 'print "$$1 " if /\#define\s+([A-Z][^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/net.h) \
65 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/dvb/video.h) \
66 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/media.h) \
67 $(shell perl -ne 'print "$$1 " if /\#define\s+([^\s]+)\s+_IO/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030068
Mauro Carvalho Chehabc569eb72015-05-26 11:35:44 -030069DEFINES = \
70 $(shell perl -ne 'print "$$1 " if /\#define\s+(DTV_[^\s]+)\s+/' $(srctree)/include/uapi/linux/dvb/frontend.h) \
71
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030072TYPES = \
Mauro Carvalho Chehabedcf3cd2015-05-28 20:09:45 -030073 $(shell perl -ne 'print "$$1 " if /^typedef\s+.*\s+(\S+)\;/' $(srctree)/include/uapi/linux/videodev2.h) \
74 $(shell perl -ne 'print "$$1 " if /^typedef\s+.*\s+(\S+)\;/' $(srctree)/include/uapi/linux/dvb/frontend.h)
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030075
76ENUMS = \
Mauro Carvalho Chehab2695e662015-06-07 05:21:51 -030077 $(shell perl -ne 'print "$$1 " if /^enum\s+([^\s]+)\s+/' \
78 $(srctree)/include/uapi/linux/videodev2.h \
79 $(srctree)/include/uapi/linux/dvb/audio.h \
80 $(srctree)/include/uapi/linux/dvb/ca.h \
81 $(srctree)/include/uapi/linux/dvb/dmx.h \
82 $(srctree)/include/uapi/linux/dvb/frontend.h \
83 $(srctree)/include/uapi/linux/dvb/net.h \
84 $(srctree)/include/uapi/linux/dvb/video.h \
85 $(srctree)/include/uapi/linux/media.h \
86 $(srctree)/include/uapi/linux/v4l2-mediabus.h \
87 $(srctree)/include/uapi/linux/v4l2-subdev.h)
88
89ENUM_DEFS = \
Mauro Carvalho Chehab429c2022015-06-07 16:17:56 -030090 $(shell perl -e 'open IN,"cat @ARGV| cpp -fpreprocessed |"; while (<IN>) { if ($$enum) {print "$$1\n" if (/\s*([A-Z]\S+)\b/); } $$enum = 0 if ($$enum && /^\}/); $$enum = 1 if(/^\s*enum\s/); }; close IN;' \
Mauro Carvalho Chehab2695e662015-06-07 05:21:51 -030091 $(srctree)/include/uapi/linux/dvb/dmx.h \
Mauro Carvalho Chehab6eab8042015-06-07 19:29:43 -030092 $(srctree)/include/uapi/linux/dvb/frontend.h)
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -030093
94STRUCTS = \
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -030095 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/videodev2.h) \
96 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s\{]+)\s*/)' $(srctree)/include/uapi/linux/dvb/audio.h) \
97 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/ca.h) \
98 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/dmx.h) \
99 $(shell perl -ne 'print "$$1 " if (!/dtv\_cmds\_h/ && /^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/frontend.h) \
Mauro Carvalho Chehab315d27a2015-06-01 08:56:49 -0300100 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/ && !/_old/)' $(srctree)/include/uapi/linux/dvb/net.h) \
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300101 $(shell perl -ne 'print "$$1 " if (/^struct\s+([^\s]+)\s+/)' $(srctree)/include/uapi/linux/dvb/video.h) \
102 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/media.h) \
103 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-subdev.h) \
104 $(shell perl -ne 'print "$$1 " if /^struct\s+([^\s]+)\s+/' $(srctree)/include/uapi/linux/v4l2-mediabus.h)
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300105
106ERRORS = \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300107 E2BIG \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300108 EACCES \
109 EAGAIN \
110 EBADF \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300111 EBADFD \
112 EBADR \
113 EBADRQC \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300114 EBUSY \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300115 ECHILD \
116 ECONNRESET \
117 EDEADLK \
118 EDOM \
119 EEXIST \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300120 EFAULT \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300121 EFBIG \
122 EILSEQ \
123 EINIT \
124 EINPROGRESS \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300125 EINTR \
126 EINVAL \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300127 EIO \
128 EMFILE \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300129 ENFILE \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300130 ENOBUFS \
131 ENODATA \
132 ENODEV \
133 ENOENT \
134 ENOIOCTLCMD \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300135 ENOMEM \
136 ENOSPC \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300137 ENOSR \
138 ENOSYS \
139 ENOTSUP \
140 ENOTSUPP \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300141 ENOTTY \
142 ENXIO \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300143 EOPNOTSUPP \
144 EOVERFLOW \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300145 EPERM \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300146 EPIPE \
Mauro Carvalho Chehab6d172492011-07-05 10:07:37 -0300147 EPROTO \
148 ERANGE \
149 EREMOTE \
150 EREMOTEIO \
151 ERESTART \
152 ERESTARTSYS \
153 ESHUTDOWN \
154 ESPIPE \
155 ETIME \
156 ETIMEDOUT \
157 EUSERS \
158 EWOULDBLOCK \
159 EXDEV \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300160
161ESCAPE = \
162 -e "s/&/\\&amp;/g" \
163 -e "s/</\\&lt;/g" \
164 -e "s/>/\\&gt;/g"
165
166FILENAME = \
167 -e s,"^[^\/]*/",, \
168 -e s/"\\.xml"// \
169 -e s/"\\.tmpl"// \
170 -e s/\\\./-/g \
171 -e s/"^func-"// \
172 -e s/"^pixfmt-"// \
173 -e s/"^vidioc-"//
174
175# Generate references to these structs in videodev2.h.xml.
176DOCUMENTED = \
177 -e "s/\(enum *\)v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1<link linkend=\"\2\">v4l2_mpeg_cx2341x_video_\2<\/link>/g" \
178 -e "s/\(\(enum\|struct\) *\)\(v4l2_[a-zA-Z0-9_]*\)/\1<link linkend=\"\3\">\3<\/link>/g" \
Laurent Pinchartd52e2382014-05-27 09:41:05 -0300179 -e "s/\(V4L2_PIX_FMT_[A-Z0-9_]\+\)\(\s\+v4l2_fourcc\)/<link linkend=\"\1\">\1<\/link>\2/g" \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300180 -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
181 -e "s/v4l2\-mpeg\-vbi\-ITV0/v4l2-mpeg-vbi-itv0-1/g"
182
183DVB_DOCUMENTED = \
Mauro Carvalho Chehab98a2b602011-06-07 14:51:56 -0300184 -e "s,\(struct\s\+\)\([a-z0-9_]\+\)\(\s\+{\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
185 -e "s,\(}\s\+\)\([a-z0-9_]\+_t\+\),\1\<link linkend=\"\2\">\2\<\/link\>,g" \
Mauro Carvalho Chehab95e61e02011-06-07 16:58:00 -0300186 -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+[0-9]\+\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
Mauro Carvalho Chehabca5b2332011-06-08 15:08:57 -0300187 -e "s,<link\s\+linkend=\".*\">\(DTV_IOCTL_MAX_MSGS\|dtv_cmds_h\|__.*_old\)<\/link>,\1,g" \
Mauro Carvalho Chehabd5dc2de2011-06-07 16:17:00 -0300188 -e ":a;s/\(linkend=\".*\)_\(.*\">\)/\1-\2/;ta" \
Mauro Carvalho Chehabdc05e572011-06-08 15:39:05 -0300189 -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" \
Mauro Carvalho Chehab95e61e02011-06-07 16:58:00 -0300190 -e "s,DTV-ISDBT-LAYER[A-C],DTV-ISDBT-LAYER,g" \
Mauro Carvalho Chehab6cb77a82011-06-07 17:58:59 -0300191 -e "s,\(define\s\+\)\([A-Z0-9_]\+\)\(\s\+_IO\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
Mauro Carvalho Chehabc569eb72015-05-26 11:35:44 -0300192 -e "s,\(define\s\+\)\(DTV_[A-Z0-9_]\+\)\(\s\+\),\1\<link linkend=\"\2\">\2\<\/link\>\3,g" \
Mauro Carvalho Chehabca5b2332011-06-08 15:08:57 -0300193 -e "s,<link\s\+linkend=\".*\">\(__.*_OLD\)<\/link>,\1,g" \
Mauro Carvalho Chehab277dfcb2015-05-26 10:28:05 -0300194 -e "s/\(linkend\=\"\)FE_SET_PROPERTY/\1FE_GET_PROPERTY/g" \
Mauro Carvalho Chehabc569eb72015-05-26 11:35:44 -0300195 -e "s,<link\s\+linkend=\".*\">\(DTV_ISDBS_TS_ID_LEGACY\|DTV_MAX_COMMAND\|DTV_IOCTL_MAX_MSGS\)<\/link>,\1,g" \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300196
197#
198# Media targets and dependencies
199#
200
Mauro Carvalho Chehabbd7319d2011-06-15 23:13:19 -0300201install_media_images = \
Mauro Carvalho Chehabd01b2d52015-11-19 07:41:40 -0200202 $(Q)if [ "x$(findstring media_api.xml,$(DOCBOOKS))" != "x" ]; then \
203 mkdir -p $(MEDIA_OBJ_DIR)/media_api; \
204 cp $(OBJIMGFILES) $(MEDIA_SRC_DIR)/*.svg $(MEDIA_SRC_DIR)/v4l/*.svg $(MEDIA_OBJ_DIR)/media_api; \
205 fi
Mauro Carvalho Chehabbd7319d2011-06-15 23:13:19 -0300206
207$(MEDIA_OBJ_DIR)/%: $(MEDIA_SRC_DIR)/%.b64
208 $(Q)base64 -d $< >$@
209
210$(MEDIA_OBJ_DIR)/v4l2.xml: $(OBJIMGFILES)
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300211 @$($(quiet)gen_xml)
Michal Mareka9812962014-06-18 17:15:17 +0200212 @(ln -sf `cd $(MEDIA_SRC_DIR) && /bin/pwd`/v4l/*xml $(MEDIA_OBJ_DIR)/)
213 @(ln -sf `cd $(MEDIA_SRC_DIR) && /bin/pwd`/dvb/*xml $(MEDIA_OBJ_DIR)/)
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300214
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300215$(MEDIA_OBJ_DIR)/videodev2.h.xml: $(srctree)/include/uapi/linux/videodev2.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300216 @$($(quiet)gen_xml)
217 @( \
218 echo "<programlisting>") > $@
219 @( \
220 expand --tabs=8 < $< | \
221 sed $(ESCAPE) $(DOCUMENTED) | \
222 sed 's/i\.e\./&ie;/') >> $@
223 @( \
224 echo "</programlisting>") >> $@
225
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300226$(MEDIA_OBJ_DIR)/audio.h.xml: $(srctree)/include/uapi/linux/dvb/audio.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300227 @$($(quiet)gen_xml)
228 @( \
229 echo "<programlisting>") > $@
230 @( \
231 expand --tabs=8 < $< | \
232 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
233 sed 's/i\.e\./&ie;/') >> $@
234 @( \
235 echo "</programlisting>") >> $@
236
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300237$(MEDIA_OBJ_DIR)/ca.h.xml: $(srctree)/include/uapi/linux/dvb/ca.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300238 @$($(quiet)gen_xml)
239 @( \
240 echo "<programlisting>") > $@
241 @( \
242 expand --tabs=8 < $< | \
243 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
244 sed 's/i\.e\./&ie;/') >> $@
245 @( \
246 echo "</programlisting>") >> $@
247
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300248$(MEDIA_OBJ_DIR)/dmx.h.xml: $(srctree)/include/uapi/linux/dvb/dmx.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300249 @$($(quiet)gen_xml)
250 @( \
251 echo "<programlisting>") > $@
252 @( \
Mauro Carvalho Chehab6eab8042015-06-07 19:29:43 -0300253 for ident in $(ENUM_DEFS) ; do \
254 entity=`echo $$ident | tr _ -` ; \
255 r="$$r s/([^\w\-])$$ident([^\w\-])/\1\&$$entity\;\2/g;";\
256 done; \
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300257 expand --tabs=8 < $< | \
258 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
Mauro Carvalho Chehab6eab8042015-06-07 19:29:43 -0300259 sed 's/i\.e\./&ie;/' | \
260 perl -ne "$$r print $$_;") >> $@
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300261 @( \
262 echo "</programlisting>") >> $@
263
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300264$(MEDIA_OBJ_DIR)/frontend.h.xml: $(srctree)/include/uapi/linux/dvb/frontend.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300265 @$($(quiet)gen_xml)
266 @( \
267 echo "<programlisting>") > $@
268 @( \
Mauro Carvalho Chehab2695e662015-06-07 05:21:51 -0300269 for ident in $(ENUM_DEFS) ; do \
270 entity=`echo $$ident | tr _ -` ; \
271 r="$$r s/([^\w\-])$$ident([^\w\-])/\1\&$$entity\;\2/g;";\
272 done; \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300273 expand --tabs=8 < $< | \
274 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
Mauro Carvalho Chehab2695e662015-06-07 05:21:51 -0300275 sed 's/i\.e\./&ie;/' | \
276 perl -ne "$$r print $$_;") >> $@
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300277 @( \
278 echo "</programlisting>") >> $@
279
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300280$(MEDIA_OBJ_DIR)/net.h.xml: $(srctree)/include/uapi/linux/dvb/net.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300281 @$($(quiet)gen_xml)
282 @( \
283 echo "<programlisting>") > $@
284 @( \
285 expand --tabs=8 < $< | \
286 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
287 sed 's/i\.e\./&ie;/') >> $@
288 @( \
289 echo "</programlisting>") >> $@
290
Mauro Carvalho Chehabce3b5952012-10-17 10:05:09 -0300291$(MEDIA_OBJ_DIR)/video.h.xml: $(srctree)/include/uapi/linux/dvb/video.h $(MEDIA_OBJ_DIR)/v4l2.xml
Mauro Carvalho Chehabd9d73412011-06-08 10:23:34 -0300292 @$($(quiet)gen_xml)
293 @( \
294 echo "<programlisting>") > $@
295 @( \
296 expand --tabs=8 < $< | \
297 sed $(ESCAPE) $(DVB_DOCUMENTED) | \
298 sed 's/i\.e\./&ie;/') >> $@
299 @( \
300 echo "</programlisting>") >> $@
301
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300302$(MEDIA_OBJ_DIR)/media-entities.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml
303 @$($(quiet)gen_xml)
304 @( \
305 echo "<!-- Generated file! Do not edit. -->") >$@
306 @( \
307 echo -e "\n<!-- Functions -->") >>$@
308 @( \
309 for ident in $(FUNCS) ; do \
310 entity=`echo $$ident | tr _ -` ; \
311 echo "<!ENTITY func-$$entity \"<link" \
312 "linkend='func-$$entity'><function>$$ident()</function></link>\">" \
313 >>$@ ; \
314 done)
315 @( \
316 echo -e "\n<!-- Ioctls -->") >>$@
317 @( \
Mauro Carvalho Chehab55d44232015-05-26 17:29:22 -0300318 for ident in `echo $(IOCTLS) | sed -e "s,VIDIOC_RESERVED,,"`; do\
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300319 entity=`echo $$ident | tr _ -` ; \
Mauro Carvalho Chehab87e4d632015-05-26 12:42:08 -0300320 id=`grep -e "<refname>$$ident" -e "<section id=\"$$ident\"" $$(find $(MEDIA_SRC_DIR) -name *.xml -type f)| sed -r s,"^.*/(.*).xml.*","\1",` ; \
321 if [ "$$id" != "" ]; then echo "<!ENTITY $$entity \"<link" \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300322 "linkend='$$id'><constant>$$ident</constant></link>\">" \
Mauro Carvalho Chehab87e4d632015-05-26 12:42:08 -0300323 >>$@ ; else \
324 echo "Warning: undocumented ioctl: $$ident. Please document it at the media DocBook!" >&2; \
325 fi; \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300326 done)
327 @( \
Mauro Carvalho Chehabc569eb72015-05-26 11:35:44 -0300328 echo -e "\n<!-- Defines -->") >>$@
329 @( \
330 for ident in $(DEFINES) ; do \
331 entity=`echo $$ident | tr _ -` ; \
332 echo "<!ENTITY $$entity \"<link" \
333 "linkend='$$entity'><constant>$$ident</constant></link>\">" \
334 >>$@ ; \
335 done)
336 @( \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300337 echo -e "\n<!-- Types -->") >>$@
338 @( \
339 for ident in $(TYPES) ; do \
340 entity=`echo $$ident | tr _ -` ; \
341 echo "<!ENTITY $$entity \"<link" \
342 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
343 done)
344 @( \
345 echo -e "\n<!-- Enums -->") >>$@
346 @( \
347 for ident in $(ENUMS) ; do \
348 entity=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -` ; \
349 echo "<!ENTITY $$entity \"enum&nbsp;<link" \
350 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
351 done)
352 @( \
Mauro Carvalho Chehab2695e662015-06-07 05:21:51 -0300353 echo -e "\n<!-- Enum definitions -->") >>$@
354 @( \
355 for ident in $(ENUM_DEFS) ; do \
356 entity=`echo $$ident | tr _ -` ; \
357 echo "<!ENTITY $$entity \"<link" \
358 "linkend='$$entity'><constant>$$ident</constant></link>\">" \
359 >>$@ ; \
360 done)
361 @( \
Mauro Carvalho Chehab42661292011-05-31 16:27:44 -0300362 echo -e "\n<!-- Structures -->") >>$@
363 @( \
364 for ident in $(STRUCTS) ; do \
365 entity=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
366 echo "<!ENTITY $$entity \"struct&nbsp;<link" \
367 "linkend='$$entity'>$$ident</link>\">" >>$@ ; \
368 done)
369 @( \
370 echo -e "\n<!-- Error Codes -->") >>$@
371 @( \
372 for ident in $(ERRORS) ; do \
373 echo "<!ENTITY $$ident \"<errorcode>$$ident</errorcode>" \
374 "error code\">" >>$@ ; \
375 done)
376 @( \
377 echo -e "\n<!-- Subsections -->") >>$@
378 @( \
379 for file in $(MEDIA_SGMLS) ; do \
380 entity=`echo "$$file" | sed $(FILENAME) -e s/"^([^-]*)"/sub\1/` ; \
381 if ! echo "$$file" | \
382 grep -q -E -e '^(func|vidioc|pixfmt)-' ; then \
383 echo "<!ENTITY sub-$$entity SYSTEM \"$$file\">" >>$@ ; \
384 fi ; \
385 done)
386 @( \
387 echo -e "\n<!-- Function Reference -->") >>$@
388 @( \
389 for file in $(MEDIA_SGMLS) ; do \
390 if echo "$$file" | \
391 grep -q -E -e '(func|vidioc|pixfmt)-' ; then \
392 entity=`echo "$$file" |sed $(FILENAME)` ; \
393 echo "<!ENTITY $$entity SYSTEM \"$$file\">" >>$@ ; \
394 fi ; \
395 done)
396
397# Jade can auto-generate a list-of-tables, which includes all structs,
398# but we only want data types, all types, and sorted please.
399$(MEDIA_OBJ_DIR)/media-indices.tmpl: $(MEDIA_OBJ_DIR)/v4l2.xml
400 @$($(quiet)gen_xml)
401 @( \
402 echo "<!-- Generated file! Do not edit. -->") >$@
403 @( \
404 echo -e "\n<index><title>List of Types</title>") >>$@
405 @( \
406 for ident in $(TYPES) ; do \
407 id=`echo $$ident | tr _ -` ; \
408 echo "<indexentry><primaryie><link" \
409 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
410 done)
411 @( \
412 for ident in $(ENUMS) ; do \
413 id=`echo $$ident | sed -e "s/v4l2_mpeg_cx2341x_video_\([a-z]*_spatial_filter_type\)/\1/" | tr _ -`; \
414 echo "<indexentry><primaryie>enum&nbsp;<link" \
415 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
416 done)
417 @( \
418 for ident in $(STRUCTS) ; do \
419 id=`echo $$ident | tr _ - | sed s/v4l2-mpeg-vbi-ITV0/v4l2-mpeg-vbi-itv0-1/g` ; \
420 echo "<indexentry><primaryie>struct&nbsp;<link" \
421 "linkend='$$id'>$$ident</link></primaryie></indexentry>" >>$@ ; \
422 done)
423 @( \
424 echo "</index>") >>$@
425