xref: /linux/include/drm/Makefile (revision 3e443d167327b10966166c1953631936547b03d0)
1# SPDX-License-Identifier: GPL-2.0
2
3# Ensure drm headers are self-contained and pass kernel-doc
4hdrtest-files := \
5	$(shell cd $(src) && find * -name '*.h' 2>/dev/null)
6
7always-$(CONFIG_DRM_HEADER_TEST) += \
8	$(patsubst %.h,%.hdrtest, $(hdrtest-files))
9
10# Include the header twice to detect missing include guard.
11quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
12      cmd_hdrtest = \
13		$(CC) $(c_flags) -fsyntax-only -x c /dev/null -include $< -include $<; \
14		PYTHONDONTWRITEBYTECODE=1 $(KERNELDOC) -none $(if $(CONFIG_WERROR)$(CONFIG_DRM_WERROR),-Werror) $<; \
15		touch $@
16
17$(obj)/%.hdrtest: $(src)/%.h FORCE
18	$(call if_changed_dep,hdrtest)
19