diff options
author | Jani Nikula <jani.nikula@intel.com> | 2019-06-04 08:42:48 -0400 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-06-15 06:57:02 -0400 |
commit | e846f0dc57f441e5e93194d39bc9b8ac2ab5e0a4 (patch) | |
tree | b58f3a2e11125b3ed4f35f0c0c14380e3374b9db /scripts | |
parent | 0315bb7a25267bfeee2a7aaed5d1b4ba915e0c53 (diff) |
kbuild: add support for ensuring headers are self-contained
Sometimes it's useful to be able to explicitly ensure certain headers
remain self-contained, i.e. that they are compilable as standalone
units, by including and/or forward declaring everything they depend on.
Add special target header-test-y where individual Makefiles can add
headers to be tested if CONFIG_HEADER_TEST is enabled. This will
generate a dummy C file per header that gets built as part of extra-y.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Makefile.build | 9 | ||||
-rw-r--r-- | scripts/Makefile.lib | 3 |
2 files changed, 12 insertions, 0 deletions
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index ae9cf740633e..ee0319560513 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -294,6 +294,15 @@ quiet_cmd_cc_lst_c = MKLST $@ | |||
294 | $(obj)/%.lst: $(src)/%.c FORCE | 294 | $(obj)/%.lst: $(src)/%.c FORCE |
295 | $(call if_changed_dep,cc_lst_c) | 295 | $(call if_changed_dep,cc_lst_c) |
296 | 296 | ||
297 | # Dummy C sources for header test (header-test-y target) | ||
298 | # --------------------------------------------------------------------------- | ||
299 | |||
300 | quiet_cmd_header_test = HDRTEST $@ | ||
301 | cmd_header_test = echo "\#include \"$*.h\"" > $@ | ||
302 | |||
303 | $(obj)/%.hdrtest.c: | ||
304 | $(call cmd,header_test) | ||
305 | |||
297 | # Compile assembler sources (.S) | 306 | # Compile assembler sources (.S) |
298 | # --------------------------------------------------------------------------- | 307 | # --------------------------------------------------------------------------- |
299 | 308 | ||
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index f1f38c8cdc74..3e630fcaffd1 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -66,6 +66,9 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y)) | |||
66 | extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) | 66 | extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-)) |
67 | endif | 67 | endif |
68 | 68 | ||
69 | # Test self-contained headers | ||
70 | extra-$(CONFIG_HEADER_TEST) += $(patsubst %.h,%.hdrtest.o,$(header-test-y)) | ||
71 | |||
69 | # Add subdir path | 72 | # Add subdir path |
70 | 73 | ||
71 | extra-y := $(addprefix $(obj)/,$(extra-y)) | 74 | extra-y := $(addprefix $(obj)/,$(extra-y)) |