blob: d97e969c3ac03fdf88b6ef6038d0e8476324abbe [file] [log] [blame]
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -03001# Generate the *.h.rst files from uAPI headers
2
3PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
4UAPI = $(srctree)/include/uapi/linux
Mauro Carvalho Chehab96f69e02016-07-09 10:25:05 -03005KAPI = $(srctree)/include/linux
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -03006SRC_DIR=$(srctree)/Documentation/media
7
8FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
Mauro Carvalho Chehab68cd5e02016-07-10 07:18:52 -03009 videodev2.h.rst media.h.rst cec.h.rst lirc.h.rst
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030010
11TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
12
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020013IMAGES = \
14 typical_media_device.svg \
15 uapi/dvb/dvbstb.svg \
16 uapi/v4l/constraints.svg \
Mauro Carvalho Chehab76cf11a2016-11-30 08:00:11 -020017 uapi/v4l/crop.svg \
18 uapi/v4l/fieldseq_bt.svg \
19 uapi/v4l/fieldseq_tb.svg \
Mauro Carvalho Chehab2bd658d2016-11-30 08:00:13 -020020 uapi/v4l/nv12mt.svg \
21 uapi/v4l/nv12mt_example.svg \
Mauro Carvalho Chehab394709d2016-11-30 08:00:14 -020022 uapi/v4l/pipeline.svg \
Mauro Carvalho Chehab86e68082016-11-30 08:00:15 -020023 uapi/v4l/selection.svg \
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020024 uapi/v4l/subdev-image-processing-full.svg \
25 uapi/v4l/subdev-image-processing-scaling-multi-source.svg \
26 uapi/v4l/subdev-image-processing-crop.svg \
Mauro Carvalho Chehab76cf11a2016-11-30 08:00:11 -020027 uapi/v4l/vbi_525.svg \
28 uapi/v4l/vbi_625.svg \
29 uapi/v4l/vbi_hsync.svg \
30
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020031
32IMGTGT := $(patsubst %.png,%.pdf,$(patsubst %.svg,%.pdf,$(IMAGES)))
33IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))
34
35cmd = $(echo-cmd) $(cmd_$(1))
36
37quiet_cmd_genpdf = GENPDF $2
38 cmd_genpdf = convert $2 $3
39
40%.pdf: %.svg
41 @$(call cmd,genpdf,$<,$@)
42
43.PHONY: all html epub xml latex
44
Jani Nikula609afe62016-08-10 18:54:07 +030045all: $(BUILDDIR) ${TARGETS}
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020046html: all
47epub: all
48xml: all
49latex: $(IMGPDF) all
50
51clean:
Jonathan Corbetc54b6b32016-11-16 15:38:03 -070052 -rm -f $(IMGTGT) 2>/dev/null
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030053
54$(BUILDDIR):
55 $(Q)mkdir -p $@
56
57# Rule to convert a .h file to inline RST documentation
58
59gen_rst = \
60 echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
61 ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
62
63quiet_gen_rst = echo ' PARSE $(patsubst $(srctree)/%,%,$<)'; \
64 ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
65
66silent_gen_rst = ${gen_rst}
67
68$(BUILDDIR)/audio.h.rst: ${UAPI}/dvb/audio.h ${PARSER} $(SRC_DIR)/audio.h.rst.exceptions
69 @$($(quiet)gen_rst)
70
71$(BUILDDIR)/ca.h.rst: ${UAPI}/dvb/ca.h ${PARSER} $(SRC_DIR)/ca.h.rst.exceptions
72 @$($(quiet)gen_rst)
73
74$(BUILDDIR)/dmx.h.rst: ${UAPI}/dvb/dmx.h ${PARSER} $(SRC_DIR)/dmx.h.rst.exceptions
75 @$($(quiet)gen_rst)
76
77$(BUILDDIR)/frontend.h.rst: ${UAPI}/dvb/frontend.h ${PARSER} $(SRC_DIR)/frontend.h.rst.exceptions
78 @$($(quiet)gen_rst)
79
80$(BUILDDIR)/net.h.rst: ${UAPI}/dvb/net.h ${PARSER} $(SRC_DIR)/net.h.rst.exceptions
81 @$($(quiet)gen_rst)
82
83$(BUILDDIR)/video.h.rst: ${UAPI}/dvb/video.h ${PARSER} $(SRC_DIR)/video.h.rst.exceptions
84 @$($(quiet)gen_rst)
85
86$(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.h.rst.exceptions
87 @$($(quiet)gen_rst)
88
Mauro Carvalho Chehabd2c68152016-07-09 08:54:35 -030089$(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
90 @$($(quiet)gen_rst)
91
Mauro Carvalho Chehab96f69e02016-07-09 10:25:05 -030092$(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
93 @$($(quiet)gen_rst)
94
Mauro Carvalho Chehab68cd5e02016-07-10 07:18:52 -030095$(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
96 @$($(quiet)gen_rst)
97
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030098cleandocs:
Jonathan Corbetc54b6b32016-11-16 15:38:03 -070099 -rm -f ${TARGETS}