lkml.org 
[lkml]   [2019]   [Jun]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] kbuild: compile-test global headers to ensure they are self-contained
Hi Masahiro
> > ...
> On this level it would be better to do:
> header-test-y += $(call find_all_header_files)
>
> # drm files that are not self-contained
> header-test-n += drm_legacy.h

I made a quick hack on top of your patch to demonstrate
the ideas.
See patch below.

When all header files below include/drm are self-contained it will be a
single line:

header-test-y += $(all_headers_with_subdir)

But for now I skipped the subdirs as they was not in too good shape.

My gmake foo escapted me tonight, so $(call all_headers_with_subdir)
did not really do what I wanted. Which is why I use the macro direct.
The main part is that we have support in the generic part to find the
header files and to filter out header files we do not want to check.

Later we may extend the checking to something more than that they
can build. We could check for CONFIG_ symbols in uapi/ and more.

Another note. Maybe we should name the files Kbuild, as this is what we
usually do in include/*

But I also sometimes regret that I introduced this second name.
Back then the idea was to globally rename Makefile => Kbuild.
But I never advocated this, as the pain was much bigger than the gain.
Another thing to be cleaned up one day maybe...

Sam


diff --git a/include/Makefile b/include/Makefile
index 68a76ac732c3..09e854d504f6 100644
--- a/include/Makefile
+++ b/include/Makefile
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only

+subdir-y += drm
+
# extend the test coverage when existing errors are fixed

header-test += linux/w*.h
diff --git a/include/drm/Makefile b/include/drm/Makefile
new file mode 100644
index 000000000000..61a762964ef0
--- /dev/null
+++ b/include/drm/Makefile
@@ -0,0 +1,21 @@
+# Verify all header files
+
+header-test-y += $(all_headers)
+
+# Blacklist header files that do not yet pass the test
+# Keep list sorted
+header-test-n += ati_pcigart.h
+header-test-n += drm_audio_component.h
+header-test-n += drm_auth.h
+header-test-n += drm_debugfs.h
+header-test-n += drm_debugfs_crc.h
+header-test-n += drm_displayid.h
+header-test-n += drm_fb_cma_helper.h
+header-test-n += drm_fixed.h
+header-test-n += drm_format_helper.h
+header-test-n += drm_lease.h
+header-test-n += drm_legacy.h
+header-test-n += drm_plane_helper.h
+header-test-n += drm_rect.h
+header-test-n += i915_component.h
+header-test-n += intel-gtt.h
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index 0ae07e83d393..df29c65c6490 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -66,6 +66,20 @@ define filechk
fi
endef

+######
+# Support functions for header-test
+define all_headers
+ $(patsubst $(srctree)/$(src)/%,%, \
+ $(wildcard $(srctree)/$(src)/*.h))
+endef
+
+define all_headers_with_subdir
+ $(patsubst $(srctree)/$(src)/%,%, \
+ $(shell find $(srctree)/$(src)/ '*.h'))
+endef
+
+
+
######
# gcc support functions
# See documentation in Documentation/kbuild/makefiles.txt
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 3e630fcaffd1..e2f765e9d1e1 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -67,6 +67,7 @@ extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
endif

# Test self-contained headers
+header-test-y := $(filter-out $(header-test-n), $(header-test-y))
extra-$(CONFIG_HEADER_TEST) += $(patsubst %.h,%.hdrtest.o,$(header-test-y))

# Add subdir path
\
 
 \ /
  Last update: 2019-06-24 23:41    [W:0.070 / U:5.904 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site