Mauro Carvalho Chehab | 60c2820 | 2016-07-08 11:40:06 -0300 | [diff] [blame] | 1 | # Generate the *.h.rst files from uAPI headers |
| 2 | |
| 3 | PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl |
| 4 | UAPI = $(srctree)/include/uapi/linux |
Mauro Carvalho Chehab | 96f69e0 | 2016-07-09 10:25:05 -0300 | [diff] [blame] | 5 | KAPI = $(srctree)/include/linux |
Mauro Carvalho Chehab | 60c2820 | 2016-07-08 11:40:06 -0300 | [diff] [blame] | 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 \ |
Mauro Carvalho Chehab | 68cd5e0 | 2016-07-10 07:18:52 -0300 | [diff] [blame] | 9 | videodev2.h.rst media.h.rst cec.h.rst lirc.h.rst |
Mauro Carvalho Chehab | 60c2820 | 2016-07-08 11:40:06 -0300 | [diff] [blame] | 10 | |
| 11 | TARGETS := $(addprefix $(BUILDDIR)/, $(FILES)) |
| 12 | |
Mauro Carvalho Chehab | 15a04d4 | 2016-11-14 14:32:32 -0200 | [diff] [blame] | 13 | IMAGES = \ |
| 14 | typical_media_device.svg \ |
| 15 | uapi/dvb/dvbstb.svg \ |
| 16 | uapi/v4l/constraints.svg \ |
Mauro Carvalho Chehab | 76cf11a | 2016-11-30 08:00:11 -0200 | [diff] [blame] | 17 | uapi/v4l/crop.svg \ |
| 18 | uapi/v4l/fieldseq_bt.svg \ |
| 19 | uapi/v4l/fieldseq_tb.svg \ |
Mauro Carvalho Chehab | 2bd658d | 2016-11-30 08:00:13 -0200 | [diff] [blame] | 20 | uapi/v4l/nv12mt.svg \ |
| 21 | uapi/v4l/nv12mt_example.svg \ |
Mauro Carvalho Chehab | 394709d | 2016-11-30 08:00:14 -0200 | [diff] [blame] | 22 | uapi/v4l/pipeline.svg \ |
Mauro Carvalho Chehab | 86e6808 | 2016-11-30 08:00:15 -0200 | [diff] [blame^] | 23 | uapi/v4l/selection.svg \ |
Mauro Carvalho Chehab | 15a04d4 | 2016-11-14 14:32:32 -0200 | [diff] [blame] | 24 | 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 Chehab | 76cf11a | 2016-11-30 08:00:11 -0200 | [diff] [blame] | 27 | uapi/v4l/vbi_525.svg \ |
| 28 | uapi/v4l/vbi_625.svg \ |
| 29 | uapi/v4l/vbi_hsync.svg \ |
| 30 | |
Mauro Carvalho Chehab | 15a04d4 | 2016-11-14 14:32:32 -0200 | [diff] [blame] | 31 | |
| 32 | IMGTGT := $(patsubst %.png,%.pdf,$(patsubst %.svg,%.pdf,$(IMAGES))) |
| 33 | IMGPDF := $(patsubst %,$(SRC_DIR)/%,$(IMGTGT)) |
| 34 | |
| 35 | cmd = $(echo-cmd) $(cmd_$(1)) |
| 36 | |
| 37 | quiet_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 Nikula | 609afe6 | 2016-08-10 18:54:07 +0300 | [diff] [blame] | 45 | all: $(BUILDDIR) ${TARGETS} |
Mauro Carvalho Chehab | 15a04d4 | 2016-11-14 14:32:32 -0200 | [diff] [blame] | 46 | html: all |
| 47 | epub: all |
| 48 | xml: all |
| 49 | latex: $(IMGPDF) all |
| 50 | |
| 51 | clean: |
Jonathan Corbet | c54b6b3 | 2016-11-16 15:38:03 -0700 | [diff] [blame] | 52 | -rm -f $(IMGTGT) 2>/dev/null |
Mauro Carvalho Chehab | 60c2820 | 2016-07-08 11:40:06 -0300 | [diff] [blame] | 53 | |
| 54 | $(BUILDDIR): |
| 55 | $(Q)mkdir -p $@ |
| 56 | |
| 57 | # Rule to convert a .h file to inline RST documentation |
| 58 | |
| 59 | gen_rst = \ |
| 60 | echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \ |
| 61 | ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions |
| 62 | |
| 63 | quiet_gen_rst = echo ' PARSE $(patsubst $(srctree)/%,%,$<)'; \ |
| 64 | ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions |
| 65 | |
| 66 | silent_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 Chehab | d2c6815 | 2016-07-09 08:54:35 -0300 | [diff] [blame] | 89 | $(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions |
| 90 | @$($(quiet)gen_rst) |
| 91 | |
Mauro Carvalho Chehab | 96f69e0 | 2016-07-09 10:25:05 -0300 | [diff] [blame] | 92 | $(BUILDDIR)/cec.h.rst: ${KAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions |
| 93 | @$($(quiet)gen_rst) |
| 94 | |
Mauro Carvalho Chehab | 68cd5e0 | 2016-07-10 07:18:52 -0300 | [diff] [blame] | 95 | $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions |
| 96 | @$($(quiet)gen_rst) |
| 97 | |
Mauro Carvalho Chehab | 60c2820 | 2016-07-08 11:40:06 -0300 | [diff] [blame] | 98 | cleandocs: |
Jonathan Corbet | c54b6b3 | 2016-11-16 15:38:03 -0700 | [diff] [blame] | 99 | -rm -f ${TARGETS} |