blob: d79afe4d27e9e5ee72347075820bfc228ce482d4 [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 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 Chehab15a04d42016-11-14 14:32:32 -020027
28IMGTGT := $(patsubst %.png,%.pdf,$(patsubst %.svg,%.pdf,$(IMAGES)))
29IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))
30
31cmd = $(echo-cmd) $(cmd_$(1))
32
33quiet_cmd_genpdf = GENPDF $2
34 cmd_genpdf = convert $2 $3
35
36%.pdf: %.svg
37 @$(call cmd,genpdf,$<,$@)
38
39.PHONY: all html epub xml latex
40
Jani Nikula609afe62016-08-10 18:54:07 +030041all: $(BUILDDIR) ${TARGETS}
Mauro Carvalho Chehab15a04d42016-11-14 14:32:32 -020042html: all
43epub: all
44xml: all
45latex: $(IMGPDF) all
46
47clean:
Jonathan Corbetc54b6b32016-11-16 15:38:03 -070048 -rm -f $(IMGTGT) 2>/dev/null
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030049
50$(BUILDDIR):
51 $(Q)mkdir -p $@
52
53# Rule to convert a .h file to inline RST documentation
54
55gen_rst = \
56 echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
57 ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
58
59quiet_gen_rst = echo ' PARSE $(patsubst $(srctree)/%,%,$<)'; \
60 ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
61
62silent_gen_rst = ${gen_rst}
63
64$(BUILDDIR)/audio.h.rst: ${UAPI}/dvb/audio.h ${PARSER} $(SRC_DIR)/audio.h.rst.exceptions
65 @$($(quiet)gen_rst)
66
67$(BUILDDIR)/ca.h.rst: ${UAPI}/dvb/ca.h ${PARSER} $(SRC_DIR)/ca.h.rst.exceptions
68 @$($(quiet)gen_rst)
69
70$(BUILDDIR)/dmx.h.rst: ${UAPI}/dvb/dmx.h ${PARSER} $(SRC_DIR)/dmx.h.rst.exceptions
71 @$($(quiet)gen_rst)
72
73$(BUILDDIR)/frontend.h.rst: ${UAPI}/dvb/frontend.h ${PARSER} $(SRC_DIR)/frontend.h.rst.exceptions
74 @$($(quiet)gen_rst)
75
76$(BUILDDIR)/net.h.rst: ${UAPI}/dvb/net.h ${PARSER} $(SRC_DIR)/net.h.rst.exceptions
77 @$($(quiet)gen_rst)
78
79$(BUILDDIR)/video.h.rst: ${UAPI}/dvb/video.h ${PARSER} $(SRC_DIR)/video.h.rst.exceptions
80 @$($(quiet)gen_rst)
81
82$(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.h.rst.exceptions
83 @$($(quiet)gen_rst)
84
Mauro Carvalho Chehabd2c68152016-07-09 08:54:35 -030085$(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
86 @$($(quiet)gen_rst)
87
Mauro Carvalho Chehab96f69e02016-07-09 10:25:05 -030088$(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
89 @$($(quiet)gen_rst)
90
Mauro Carvalho Chehab68cd5e02016-07-10 07:18:52 -030091$(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
92 @$($(quiet)gen_rst)
93
Mauro Carvalho Chehab60c28202016-07-08 11:40:06 -030094cleandocs:
Jonathan Corbetc54b6b32016-11-16 15:38:03 -070095 -rm -f ${TARGETS}