blob: ab05323b779b71c2616d9aa91d45ea3f659e8daa [file] [log] [blame]
Mauro Carvalho Chehabbf5bfe82016-11-30 08:00:18 -02001# Rules to convert DOT and SVG to Sphinx images
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -03002
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -03003SRC_DIR=$(srctree)/Documentation/media
4
Mauro Carvalho Chehabec868e42016-11-30 08:00:17 -02005DOTS = \
6 uapi/v4l/pipeline.dot \
7
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -02008IMAGES = \
9 typical_media_device.svg \
10 uapi/dvb/dvbstb.svg \
Mauro Carvalho Chehabffbdad92016-11-30 08:00:16 -020011 uapi/v4l/bayer.svg \
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020012 uapi/v4l/constraints.svg \
Mauro Carvalho Chehab76cf11a2016-11-30 08:00:11 -020013 uapi/v4l/crop.svg \
14 uapi/v4l/fieldseq_bt.svg \
15 uapi/v4l/fieldseq_tb.svg \
Mauro Carvalho Chehab2bd658d2016-11-30 08:00:13 -020016 uapi/v4l/nv12mt.svg \
17 uapi/v4l/nv12mt_example.svg \
Mauro Carvalho Chehab394709d2016-11-30 08:00:14 -020018 uapi/v4l/pipeline.svg \
Mauro Carvalho Chehab86e68082016-11-30 08:00:15 -020019 uapi/v4l/selection.svg \
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020020 uapi/v4l/subdev-image-processing-full.svg \
21 uapi/v4l/subdev-image-processing-scaling-multi-source.svg \
22 uapi/v4l/subdev-image-processing-crop.svg \
Mauro Carvalho Chehab76cf11a2016-11-30 08:00:11 -020023 uapi/v4l/vbi_525.svg \
24 uapi/v4l/vbi_625.svg \
25 uapi/v4l/vbi_hsync.svg \
26
Mauro Carvalho Chehabec868e42016-11-30 08:00:17 -020027DOTTGT := $(patsubst %.dot,%.svg,$(DOTS))
28IMGDOT := $(patsubst %,$(SRC_DIR)/%,$(DOTTGT))
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020029
Mauro Carvalho Chehabec868e42016-11-30 08:00:17 -020030IMGTGT := $(patsubst %.svg,%.pdf,$(IMAGES))
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020031IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))
32
33cmd = $(echo-cmd) $(cmd_$(1))
34
35quiet_cmd_genpdf = GENPDF $2
36 cmd_genpdf = convert $2 $3
37
Mauro Carvalho Chehabec868e42016-11-30 08:00:17 -020038quiet_cmd_gendot = DOT $2
39 cmd_gendot = dot -Tsvg $2 > $3
40
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020041%.pdf: %.svg
42 @$(call cmd,genpdf,$<,$@)
43
Mauro Carvalho Chehabec868e42016-11-30 08:00:17 -020044%.svg: %.dot
45 @$(call cmd,gendot,$<,$@)
46
Mauro Carvalho Chehabbf5bfe82016-11-30 08:00:18 -020047# Rules to convert a .h file to inline RST documentation
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020048
Mauro Carvalho Chehabbf5bfe82016-11-30 08:00:18 -020049PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
50UAPI = $(srctree)/include/uapi/linux
51KAPI = $(srctree)/include/linux
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020052
Mauro Carvalho Chehabbf5bfe82016-11-30 08:00:18 -020053FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
54 videodev2.h.rst media.h.rst cec.h.rst lirc.h.rst
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030055
Mauro Carvalho Chehabbf5bfe82016-11-30 08:00:18 -020056TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030057
58gen_rst = \
59 echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
60 ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
61
62quiet_gen_rst = echo ' PARSE $(patsubst $(srctree)/%,%,$<)'; \
63 ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
64
65silent_gen_rst = ${gen_rst}
66
67$(BUILDDIR)/audio.h.rst: ${UAPI}/dvb/audio.h ${PARSER} $(SRC_DIR)/audio.h.rst.exceptions
68 @$($(quiet)gen_rst)
69
70$(BUILDDIR)/ca.h.rst: ${UAPI}/dvb/ca.h ${PARSER} $(SRC_DIR)/ca.h.rst.exceptions
71 @$($(quiet)gen_rst)
72
73$(BUILDDIR)/dmx.h.rst: ${UAPI}/dvb/dmx.h ${PARSER} $(SRC_DIR)/dmx.h.rst.exceptions
74 @$($(quiet)gen_rst)
75
76$(BUILDDIR)/frontend.h.rst: ${UAPI}/dvb/frontend.h ${PARSER} $(SRC_DIR)/frontend.h.rst.exceptions
77 @$($(quiet)gen_rst)
78
79$(BUILDDIR)/net.h.rst: ${UAPI}/dvb/net.h ${PARSER} $(SRC_DIR)/net.h.rst.exceptions
80 @$($(quiet)gen_rst)
81
82$(BUILDDIR)/video.h.rst: ${UAPI}/dvb/video.h ${PARSER} $(SRC_DIR)/video.h.rst.exceptions
83 @$($(quiet)gen_rst)
84
85$(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.h.rst.exceptions
86 @$($(quiet)gen_rst)
87
Mauro Carvalho Chehabd2c68152016-07-09 08:54:35 -030088$(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
89 @$($(quiet)gen_rst)
90
Mauro Carvalho Chehab96f69e02016-07-09 10:25:05 -030091$(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
92 @$($(quiet)gen_rst)
93
Mauro Carvalho Chehab68cd5e02016-07-10 07:18:52 -030094$(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
95 @$($(quiet)gen_rst)
Mauro Carvalho Chehabbf5bfe82016-11-30 08:00:18 -020096
97# Media build rules
98
99.PHONY: all html epub xml latex
100
101all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
102html: all
103epub: all
104xml: all
105latex: $(IMGPDF) all
106
107clean:
108 -rm -f $(DOTTGT) $(IMGTGT) $(patsubst %,$(SRC_DIR)/%,${TARGETS}) 2>/dev/null
109
110$(BUILDDIR):
111 $(Q)mkdir -p $@