-
Describe the bug |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
@wentongwu you can use the Enable: As example when running CMake:
and then you can produce files containing build setting as:
or
which will produce:
with content like:
|
Beta Was this translation helpful? Give feedback.
-
and I'm trying to make a patch like below for this sample, but is there a way to know the diff --git a/samples/application_development/external_lib/mylib/Makefile b/samples/application_development/external_lib/mylib/Makefile
index 846407cfdf..7654bde86c 100644
--- a/samples/application_development/external_lib/mylib/Makefile
+++ b/samples/application_development/external_lib/mylib/Makefile
@@ -7,11 +7,20 @@
PREFIX ?= .
OBJ_DIR ?= $(PREFIX)/obj
LIB_DIR ?= $(PREFIX)/lib
+TMP_DIR ?= $(PREFIX)/tmp
-all:
+include $(TMP_DIR)/Makefile.exports.C
+
+zephyr_headers:
+ rm -rf $(TMP_DIR) && mkdir -p $(TMP_DIR) && cd $(TMP_DIR)
+ cmake -DBOARD=board -DCONFIG_MAKEFILE_EXPORTS=y project_dir
+ make zephyr_generated_headers
+ cd -
+
+all: zephyr_headers
mkdir -p $(OBJ_DIR) $(LIB_DIR)
- $(CC) -c $(CFLAGS) -MD -Iinclude src/mylib.c -o $(OBJ_DIR)/mylib.o
+ $(CC) -c $(CFLAGS) $(Z_CFLAGS) -MD -Iinclude src/mylib.c -o $(OBJ_DIR)/mylib.o
$(AR) -rcs $(LIB_DIR)/libmylib.a $(OBJ_DIR)/mylib.o
clean:
- rm -rf $(OBJ_DIR) $(LIB_DIR)
+ rm -rf $(OBJ_DIR) $(LIB_DIR) $(TMP_DIR)
diff --git a/samples/application_development/external_lib/mylib/src/mylib.c b/samples/application_development/external_lib/mylib/src/mylib.c
index 3f18508c35..2dd6494605 100644
--- a/samples/application_development/external_lib/mylib/src/mylib.c
+++ b/samples/application_development/external_lib/mylib/src/mylib.c
@@ -6,6 +6,7 @@
#include "mylib.h"
#include <stdio.h>
+#include <zephyr.h>
int mylib_hello_world(void)
{ |
Beta Was this translation helpful? Give feedback.
@wentongwu you can use the
zephyr_generated_headers
build target.Enable:
CONFIG_MAKEFILE_EXPORTS=y
, and build your sample.As example when running CMake:
and then you can produce files containing build setting as:
or
which will produce:
with content like: