sandbox: Adjust how OS-interface files are built

The current mechanism uses a completely separate build rule for each
file which must be built with system headers.

Before adding any more files, adjust the scheme so that the flags are
handled in the common Makefile, with sandbox simply listing the files
affected.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-06-10 19:16:52 -06:00
parent b833ab6b79
commit 3b8ed0cebb
3 changed files with 16 additions and 25 deletions

View File

@@ -162,15 +162,21 @@ __cpp_flags = $(call flags,_cpp_flags)
endif
endif
# Modified for U-Boot: LINUXINCLUDE -> UBOOTINCLUDE
c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
$(__c_flags) $(modkern_cflags) \
# Handle special sandbox files which need to be built with system headers
use_syshdrs = $(filter $(basetarget).o, $(CFLAGS_USE_SYSHDRS))
nostdinc = $(if $(use_syshdrs),,$(NOSTDINC_FLAGS))
ubootinclude = $(if $(use_syshdrs),$(patsubst -I%,-idirafter%,\
$(UBOOTINCLUDE)),$(UBOOTINCLUDE))
# Modified for U-Boot: NOSTDINC_FLAGS -> nostdinc and LINUXINCLUDE -> ubootinclude
c_flags = -Wp,-MD,$(depfile) $(nostdinc) $(ubootinclude) \
$(__c_flags) $(modkern_cflags) \
$(basename_flags) $(modname_flags)
a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
a_flags = -Wp,-MD,$(depfile) $(nostdinc) $(ubootinclude) \
$(__a_flags) $(modkern_aflags)
cpp_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(UBOOTINCLUDE) \
cpp_flags = -Wp,-MD,$(depfile) $(nostdinc) $(ubootinclude) \
$(__cpp_flags)
ld_flags = $(KBUILD_LDFLAGS) $(ldflags-y) $(LDFLAGS_$(@F))