kbuild: add CONFIG_HEADERS_INSTALL and loosen the dependency of samples

Commit 5318321d36 ("samples: disable CONFIG_SAMPLES for UML") used
a big hammer to fix the build errors under the samples/ directory.
Only some samples actually include uapi headers from usr/include.

Introduce CONFIG_HEADERS_INSTALL since 'depends on HEADERS_INSTALL' is
clearer than 'depends on !UML'. If this option is enabled, uapi headers
are installed before starting directory descending.

I added 'depends on HEADERS_INSTALL' to per-sample CONFIG options.
This allows UML to compile some samples.

$ make ARCH=um allmodconfig samples/
  [ snip ]
  CC [M]  samples/configfs/configfs_sample.o
  CC [M]  samples/kfifo/bytestream-example.o
  CC [M]  samples/kfifo/dma-example.o
  CC [M]  samples/kfifo/inttype-example.o
  CC [M]  samples/kfifo/record-example.o
  CC [M]  samples/kobject/kobject-example.o
  CC [M]  samples/kobject/kset-example.o
  CC [M]  samples/trace_events/trace-events-sample.o
  CC [M]  samples/trace_printk/trace-printk.o
  AR      samples/vfio-mdev/built-in.a
  AR      samples/built-in.a

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
此提交包含在:
Masahiro Yamada
2019-06-04 19:13:59 +09:00
父節點 c6509a24d6
當前提交 e949f4c2d6
共有 12 個檔案被更改,包括 40 行新增15 行删除

查看文件

@@ -305,14 +305,23 @@ config DEBUG_FS
If unsure, say N.
config HEADERS_CHECK
bool "Run sanity checks on uapi headers when building 'all'"
config HEADERS_INSTALL
bool "Install uapi headers to usr/include"
depends on !UML
help
This option will extract the user-visible kernel headers when
building the 'all' target, and will run basic sanity checks on them to
ensure that exported files do not attempt to include files which
were not exported, etc.
This option will install uapi headers (headers exported to user-space)
into the usr/include directory for use during the kernel build.
This is unneeded for building the kernel itself, but needed for some
user-space program samples. It is also needed by some features such
as uapi header sanity checks.
config HEADERS_CHECK
bool "Run sanity checks on uapi headers when building 'all'"
depends on HEADERS_INSTALL
help
This option will run basic sanity checks on uapi headers when
building the 'all' target, for example, ensure that they do not
attempt to include files which were not exported, etc.
If you're making modifications to header files which are
relevant for userspace, say 'Y', and check the headers