Hello everyone,

I'm facing a problem whose solution is currently unknown to me. As I am
using the nuttx export in my development, I'd like to export external
libraries, which are, in my case, located in apps. As "make export" only
exports the headers located in nuttx/include, I'd want to ask you whether
there's already a way to propagate the header files of external libraries
into export/include, so that the API could be used by the export.

This also concerns the includes of external libraries in other locations,
such as arch. Also, many external libraries utilize the CFLAGS += -I hack
to include the external headers. Shouldn't there be a more unified way that
defines the external headers in a separate variable and the root apps
makefile just collects this and adds it to CFLAGS, and possibly into the
export/include directory. But also, there could be some headers that we
don't want to be visible in the export, but only visible in apps.

For the time being, I've solved this problem by utilizing a
EXTRA_APPS_INCPATHS Makefile variable, which can be filled with the
directories in Make.defs files, and the root apps Makefile just copies it
to export/include:

diff --git a/Makefile b/Makefile
index 5a3570538..d6e96b068 100644
--- a/Makefile
+++ b/Makefile
@@ -197,6 +197,12 @@ preconfig: Kconfig
 export:
 ifneq ($(EXPORTDIR),)
        $(Q) mkdir -p "${EXPORTDIR}"$(DELIM)registry || exit 1;
+       for d in ${EXTRA_APPS_INCPATHS}; do \
+               if [ -d "$${d}" ]; then \
+                       echo "CP: $${d}" ; \
+                       cp -r "$${d}" "${EXPORTDIR}"$(DELIM)include ; \
+               fi \
+       done
 ifneq ($(CONFIG_BUILD_KERNEL),y)
 ifneq ($(BUILTIN_REGISTRY),)
        for f in "${BUILTIN_REGISTRY}"$(DELIM)*.bdat
"${BUILTIN_REGISTRY}"$(DELIM)*.pdat ; do \

Please let me know and I'm looking forward to spark a debate.
BR,
Stepan Pressl

Reply via email to