Skip to content

Commit ecd77a3

Browse files
masahir0ygregkh
authored andcommitted
kbuild: move headers_check rule to usr/include/Makefile
commit 7ecaf06 upstream. Currently, some sanity checks for uapi headers are done by scripts/headers_check.pl, 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 headers_check.pl 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 <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ef134d8 commit ecd77a3

4 files changed

Lines changed: 9 additions & 40 deletions

File tree

‎Makefile‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,19 +1195,15 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
11951195
$(Q)$(MAKE) $(hdr-inst)=include/uapi
11961196
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
11971197

1198+
# Deprecated. It is no-op now.
11981199
PHONY += headers_check
1199-
headers_check: headers
1200-
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
1201-
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1
1200+
headers_check:
1201+
@:
12021202

12031203
ifdef CONFIG_HEADERS_INSTALL
12041204
prepare: headers
12051205
endif
12061206

1207-
ifdef CONFIG_HEADERS_CHECK
1208-
all: headers_check
1209-
endif
1210-
12111207
PHONY += scripts_unifdef
12121208
scripts_unifdef: scripts_basic
12131209
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
@@ -1475,7 +1471,6 @@ help:
14751471
@echo ' versioncheck - Sanity check on version.h usage'
14761472
@echo ' includecheck - Check for duplicate included header files'
14771473
@echo ' export_report - List the usages of all exported symbols'
1478-
@echo ' headers_check - Sanity check on exported headers'
14791474
@echo ' headerdep - Detect inclusion cycles in headers'
14801475
@echo ' coccicheck - Check with Coccinelle'
14811476
@echo ''

‎lib/Kconfig.debug‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -299,17 +299,6 @@ config HEADERS_INSTALL
299299
user-space program samples. It is also needed by some features such
300300
as uapi header sanity checks.
301301

302-
config HEADERS_CHECK
303-
bool "Run sanity checks on uapi headers when building 'all'"
304-
depends on HEADERS_INSTALL
305-
help
306-
This option will run basic sanity checks on uapi headers when
307-
building the 'all' target, for example, ensure that they do not
308-
attempt to include files which were not exported, etc.
309-
310-
If you're making modifications to header files which are
311-
relevant for userspace, say 'Y'.
312-
313302
config OPTIMIZE_INLINING
314303
def_bool y
315304
help

‎scripts/Makefile.headersinst‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs))
5656
$(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
5757

5858
# Rules
59-
60-
ifndef HDRCHECK
61-
6259
quiet_cmd_install = HDRINST $@
6360
cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
6461

@@ -81,21 +78,6 @@ existing-headers := $(filter $(old-headers), $(all-headers))
8178

8279
-include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
8380

84-
else
85-
86-
quiet_cmd_check = HDRCHK $<
87-
cmd_check = $(PERL) $(srctree)/scripts/headers_check.pl $(dst) $(SRCARCH) $<; touch $@
88-
89-
check-files := $(addsuffix .chk, $(all-headers))
90-
91-
$(check-files): $(dst)/%.chk : $(dst)/% $(srctree)/scripts/headers_check.pl
92-
$(call cmd,check)
93-
94-
__headers: $(check-files)
95-
@:
96-
97-
endif
98-
9981
PHONY += FORCE
10082
FORCE:
10183

‎usr/include/Makefile‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ endif
9999
# asm-generic/*.h is used by asm/*.h, and should not be included directly
100100
header-test- += asm-generic/%
101101

102-
extra-y := $(patsubst %.h,%.hdrtest, $(filter-out $(header-test-), \
103-
$(patsubst $(obj)/%,%, $(shell find $(obj) -name '*.h'))))
102+
extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h'))
104103

105104
quiet_cmd_hdrtest = HDRTEST $<
106-
cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include $<; touch $@
105+
cmd_hdrtest = \
106+
$(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
107+
$(if $(filter-out $(header-test-), $*.h), -include $<); \
108+
$(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \
109+
touch $@
107110

108111
$(obj)/%.hdrtest: $(obj)/%.h FORCE
109112
$(call if_changed_dep,hdrtest)

0 commit comments

Comments
 (0)