154f38fcaSMauro Carvalho Chehab# SPDX-License-Identifier: GPL-2.0
254f38fcaSMauro Carvalho Chehab
354f38fcaSMauro Carvalho Chehab# Rules to convert a .h file to inline RST documentation
454f38fcaSMauro Carvalho Chehab
554f38fcaSMauro Carvalho ChehabSRC_DIR=$(srctree)/Documentation/userspace-api/media
654f38fcaSMauro Carvalho ChehabPARSER = $(srctree)/Documentation/sphinx/parse-headers.pl
754f38fcaSMauro Carvalho ChehabUAPI = $(srctree)/include/uapi/linux
854f38fcaSMauro Carvalho ChehabKAPI = $(srctree)/include/linux
954f38fcaSMauro Carvalho Chehab
10793e52d4SMauro Carvalho ChehabFILES = ca.h.rst dmx.h.rst frontend.h.rst net.h.rst \
1154f38fcaSMauro Carvalho Chehab	videodev2.h.rst media.h.rst cec.h.rst lirc.h.rst
1254f38fcaSMauro Carvalho Chehab
1354f38fcaSMauro Carvalho ChehabTARGETS := $(addprefix $(BUILDDIR)/, $(FILES))
1454f38fcaSMauro Carvalho Chehab
1554f38fcaSMauro Carvalho Chehabgen_rst = \
1654f38fcaSMauro Carvalho Chehab	echo ${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions; \
1754f38fcaSMauro Carvalho Chehab	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
1854f38fcaSMauro Carvalho Chehab
1954f38fcaSMauro Carvalho Chehabquiet_gen_rst = echo '  PARSE   $(patsubst $(srctree)/%,%,$<)'; \
2054f38fcaSMauro Carvalho Chehab	${PARSER} $< $@ $(SRC_DIR)/$(notdir $@).exceptions
2154f38fcaSMauro Carvalho Chehab
2254f38fcaSMauro Carvalho Chehabsilent_gen_rst = ${gen_rst}
2354f38fcaSMauro Carvalho Chehab
2454f38fcaSMauro Carvalho Chehab$(BUILDDIR)/ca.h.rst: ${UAPI}/dvb/ca.h ${PARSER} $(SRC_DIR)/ca.h.rst.exceptions
2554f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
2654f38fcaSMauro Carvalho Chehab
2754f38fcaSMauro Carvalho Chehab$(BUILDDIR)/dmx.h.rst: ${UAPI}/dvb/dmx.h ${PARSER} $(SRC_DIR)/dmx.h.rst.exceptions
2854f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
2954f38fcaSMauro Carvalho Chehab
3054f38fcaSMauro Carvalho Chehab$(BUILDDIR)/frontend.h.rst: ${UAPI}/dvb/frontend.h ${PARSER} $(SRC_DIR)/frontend.h.rst.exceptions
3154f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
3254f38fcaSMauro Carvalho Chehab
3354f38fcaSMauro Carvalho Chehab$(BUILDDIR)/net.h.rst: ${UAPI}/dvb/net.h ${PARSER} $(SRC_DIR)/net.h.rst.exceptions
3454f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
3554f38fcaSMauro Carvalho Chehab
3654f38fcaSMauro Carvalho Chehab$(BUILDDIR)/videodev2.h.rst: ${UAPI}/videodev2.h ${PARSER} $(SRC_DIR)/videodev2.h.rst.exceptions
3754f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
3854f38fcaSMauro Carvalho Chehab
3954f38fcaSMauro Carvalho Chehab$(BUILDDIR)/media.h.rst: ${UAPI}/media.h ${PARSER} $(SRC_DIR)/media.h.rst.exceptions
4054f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
4154f38fcaSMauro Carvalho Chehab
4254f38fcaSMauro Carvalho Chehab$(BUILDDIR)/cec.h.rst: ${UAPI}/cec.h ${PARSER} $(SRC_DIR)/cec.h.rst.exceptions
4354f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
4454f38fcaSMauro Carvalho Chehab
4554f38fcaSMauro Carvalho Chehab$(BUILDDIR)/lirc.h.rst: ${UAPI}/lirc.h ${PARSER} $(SRC_DIR)/lirc.h.rst.exceptions
4654f38fcaSMauro Carvalho Chehab	@$($(quiet)gen_rst)
4754f38fcaSMauro Carvalho Chehab
4854f38fcaSMauro Carvalho Chehab# Media build rules
4954f38fcaSMauro Carvalho Chehab
50*1f050e90SMaxim Cournoyer.PHONY: all html texinfo epub xml latex
5154f38fcaSMauro Carvalho Chehab
5254f38fcaSMauro Carvalho Chehaball: $(IMGDOT) $(BUILDDIR) ${TARGETS}
5354f38fcaSMauro Carvalho Chehabhtml: all
54*1f050e90SMaxim Cournoyertexinfo: all
5554f38fcaSMauro Carvalho Chehabepub: all
5654f38fcaSMauro Carvalho Chehabxml: all
5754f38fcaSMauro Carvalho Chehablatex: $(IMGPDF) all
5854f38fcaSMauro Carvalho Chehablinkcheck:
5954f38fcaSMauro Carvalho Chehab
6054f38fcaSMauro Carvalho Chehabclean:
6154f38fcaSMauro Carvalho Chehab	-rm -f $(DOTTGT) $(IMGTGT) ${TARGETS} 2>/dev/null
6254f38fcaSMauro Carvalho Chehab
6354f38fcaSMauro Carvalho Chehab$(BUILDDIR):
6454f38fcaSMauro Carvalho Chehab	$(Q)mkdir -p $@
65