^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) # Rules to convert a .h file to inline RST documentation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) SRC_DIR=$(srctree)/Documentation/userspace-api/media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) PARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) UAPI = $(srctree)/include/uapi/linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) KAPI = $(srctree)/include/linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) FILES = audio.h.rst ca.h.rst dmx.h.rst frontend.h.rst net.h.rst video.h.rst \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) videodev2.h.rst media.h.rst cec.h.rst lirc.h.rst
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) TARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) gen_rst = \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) quiet_gen_rst = echo ' PARSE $(patsubst $(srctree)/%,%,$<)'; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) silent_gen_rst = ${gen_rst}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) $(BUILDDIR)/audio.h.rst: ${UAPI}/dvb/audio.h ${PARSER} $(SRC_DIR)/audio.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) $(BUILDDIR)/ca.h.rst: ${UAPI}/dvb/ca.h ${PARSER} $(SRC_DIR)/ca.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) $(BUILDDIR)/dmx.h.rst: ${UAPI}/dvb/dmx.h ${PARSER} $(SRC_DIR)/dmx.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) $(BUILDDIR)/frontend.h.rst: ${UAPI}/dvb/frontend.h ${PARSER} $(SRC_DIR)/frontend.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) $(BUILDDIR)/net.h.rst: ${UAPI}/dvb/net.h ${PARSER} $(SRC_DIR)/net.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) $(BUILDDIR)/video.h.rst: ${UAPI}/dvb/video.h ${PARSER} $(SRC_DIR)/video.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) $(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) $(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) $(BUILDDIR)/cec.h.rst: ${UAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) $(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) @$($(quiet)gen_rst)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) # Media build rules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) .PHONY: all html epub xml latex
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) all: $(IMGDOT) $(BUILDDIR) ${TARGETS}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) html: all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) epub: all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) xml: all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) latex: $(IMGPDF) all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) linkcheck:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) clean:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) -rm -f $(DOTTGT) $(IMGTGT) ${TARGETS} 2>/dev/null
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) $(BUILDDIR):
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) $(Q)mkdir -p $@