]> git.karo-electronics.de Git - karo-tx-linux.git/blob - Documentation/media/Makefile
docs-rst: auto-generate PDF image files
[karo-tx-linux.git] / Documentation / media / Makefile
1 # Generate the *.h.rst files from uAPI headers
2
3 PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
4 UAPI = $(srctree)/include/uapi/linux
5 KAPI = $(srctree)/include/linux
6 SRC_DIR=$(srctree)/Documentation/media
7
8 FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
9           videodev2.h.rst media.h.rst cec.h.rst lirc.h.rst
10
11 TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
12
13 IMAGES = \
14         typical_media_device.svg \
15         uapi/dvb/dvbstb.svg \
16         uapi/v4l/constraints.svg \
17         uapi/v4l/subdev-image-processing-full.svg \
18         uapi/v4l/subdev-image-processing-scaling-multi-source.svg \
19         uapi/v4l/subdev-image-processing-crop.svg \
20
21 IMGTGT := $(patsubst %.png,%.pdf,$(patsubst %.svg,%.pdf,$(IMAGES)))
22 IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT))
23
24 cmd = $(echo-cmd) $(cmd_$(1))
25
26 quiet_cmd_genpdf = GENPDF  $2
27       cmd_genpdf = convert $2 $3
28
29 %.pdf: %.svg
30         @$(call cmd,genpdf,$<,$@)
31
32 .PHONY: all html epub xml latex
33
34 all: $(BUILDDIR) ${TARGETS}
35 html: all
36 epub: all
37 xml: all
38 latex: $(IMGPDF) all
39
40 clean:
41         -rm $(IMGTGT) 2>/dev/null
42
43 $(BUILDDIR):
44         $(Q)mkdir -p $@
45
46 # Rule to convert a .h file to inline RST documentation
47
48 gen_rst = \
49         echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
50         ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
51
52 quiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
53         ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
54
55 silent_gen_rst = ${gen_rst}
56
57 $(BUILDDIR)/audio.h.rst: ${UAPI}/dvb/audio.h ${PARSER} $(SRC_DIR)/audio.h.rst.exceptions
58         @$($(quiet)gen_rst)
59
60 $(BUILDDIR)/ca.h.rst: ${UAPI}/dvb/ca.h ${PARSER} $(SRC_DIR)/ca.h.rst.exceptions
61         @$($(quiet)gen_rst)
62
63 $(BUILDDIR)/dmx.h.rst: ${UAPI}/dvb/dmx.h ${PARSER} $(SRC_DIR)/dmx.h.rst.exceptions
64         @$($(quiet)gen_rst)
65
66 $(BUILDDIR)/frontend.h.rst: ${UAPI}/dvb/frontend.h ${PARSER} $(SRC_DIR)/frontend.h.rst.exceptions
67         @$($(quiet)gen_rst)
68
69 $(BUILDDIR)/net.h.rst: ${UAPI}/dvb/net.h ${PARSER} $(SRC_DIR)/net.h.rst.exceptions
70         @$($(quiet)gen_rst)
71
72 $(BUILDDIR)/video.h.rst: ${UAPI}/dvb/video.h ${PARSER} $(SRC_DIR)/video.h.rst.exceptions
73         @$($(quiet)gen_rst)
74
75 $(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.h.rst.exceptions
76         @$($(quiet)gen_rst)
77
78 $(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
79         @$($(quiet)gen_rst)
80
81 $(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
82         @$($(quiet)gen_rst)
83
84 $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
85         @$($(quiet)gen_rst)
86
87 cleandocs:
88         -rm ${TARGETS}