path: root/usr
diff options
authorMasahiro Yamada <>2019-11-07 16:14:41 +0900
committerMasahiro Yamada <>2019-11-15 00:23:10 +0900
commit7ecaf069da52e472d393f03e79d721aabd724166 (patch)
tree0aabe2dfa13aca24aeca81dc652d0dbcada18658 /usr
parentfcbb8461fd2376ba3782b5b8bd440c929b8e4980 (diff)
kbuild: move headers_check rule to usr/include/Makefile
Currently, some sanity checks for uapi headers are done by scripts/, which is wired up to the 'headers_check' target in the top Makefile. It is true compiling headers has better test coverage, but there are still several headers excluded from the compile test. I like to keep for a while, but we can delete a lot of code by moving the build rule to usr/include/Makefile. Signed-off-by: Masahiro Yamada <>
Diffstat (limited to 'usr')
1 files changed, 6 insertions, 3 deletions
diff --git a/usr/include/Makefile b/usr/include/Makefile
index 325f4d0f2e73..24543a30b9f0 100644
--- a/usr/include/Makefile
+++ b/usr/include/Makefile
@@ -95,11 +95,14 @@ endif
# asm-generic/*.h is used by asm/*.h, and should not be included directly
header-test- += asm-generic/%
-extra-y := $(patsubst %.h,%.hdrtest, $(filter-out $(header-test-), \
- $(patsubst $(obj)/%,%, $(shell find $(obj) -name '*.h'))))
+extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h'))
quiet_cmd_hdrtest = HDRTEST $<
- cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include $<; touch $@
+ cmd_hdrtest = \
+ $(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
+ $(if $(filter-out $(header-test-), $*.h), -include $<); \
+ $(PERL) $(srctree)/scripts/ $(obj) $(SRCARCH) $<; \
+ touch $@
$(obj)/%.hdrtest: $(obj)/%.h FORCE
$(call if_changed_dep,hdrtest)