This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit 564cabe9b1a9d37b058471b81480f7cb27632c8d Author: Acfboy <[email protected]> AuthorDate: Fri Aug 14 22:14:52 2026 +0800 build: introduce EXPORTED_INCLUDES machanism * Introduce EXPORTED_INCLUDES in apps/Make.defs; every entry is prefixed with INCDIR_PREFIX and added to CFLAGS/CXXFLAGS so it takes effect in the in-tree build as well * The export target in apps/Makefile copies the content of the listed directories into the include directory of the export package, so out-of-tree applications built from the package can still find the public headers Signed-off-by: Acfboy <[email protected]> --- Make.defs | 12 ++++++++++++ Makefile | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/Make.defs b/Make.defs index 416099d7a..c463006cb 100644 --- a/Make.defs +++ b/Make.defs @@ -145,6 +145,18 @@ endif CFLAGS += ${INCDIR_PREFIX}"$(APPDIR)$(DELIM)include" CXXFLAGS += ${INCDIR_PREFIX}"$(APPDIR)$(DELIM)include" +# EXPORTED_INCLUDES lists include directories that must be available to +# applications built out of tree from the NuttX export package. Each +# entry is prefixed with ${INCDIR_PREFIX} (i.e. -I<dir>) and is added +# to CFLAGS/CXXFLAGS so that it takes effect in the in-tree build as +# well. The content of the listed directories is copied to the include +# directory of the export package by the export target in apps/Makefile. +# Components should append their public include directories in their +# Make.defs. + +CFLAGS += $(EXPORTED_INCLUDES) +CXXFLAGS += $(EXPORTED_INCLUDES) + NUTTXLIB ?= $(call CONVERT_PATH,$(TOPDIR)$(DELIM)staging) # SPLITVARIABLE - Split long variables into specified batches diff --git a/Makefile b/Makefile index 5a3570538..74cb37da3 100644 --- a/Makefile +++ b/Makefile @@ -206,6 +206,13 @@ ifneq ($(BUILTIN_REGISTRY),) done endif endif + $(Q) for inc in $(EXPORTED_INCLUDES) ; do \ + inc=$${inc#"$(INCDIR_PREFIX)"}; \ + if [ -d "$${inc}" ]; then \ + mkdir -p "${EXPORTDIR}"$(DELIM)include || exit 1; \ + cp -Rf "$${inc}"$(DELIM). "${EXPORTDIR}"$(DELIM)include || exit 1; \ + fi \ + done endif .depdirs: $(foreach SDIR, $(CONFIGURED_APPS), $(SDIR)_depend)
