From 2cd0265f7eab0cdaaf9facde40ffafade1b69ece Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Wed, 17 Jan 2024 12:05:18 +0800 Subject: [PATCH] samples: posix: uname: add Makefile to compile on POSIX OS Previously the sample was using some headers that aren't available to the host, now we can add a `Makefile.host` to compile the example on a POSIX OS like Linux: ``` # Go to the sample dir cd ${ZEPHYR_BASE}/samples/posix/uname # Compile the sample make -f Makefile.host # Run the binary ./build/uname sysname[65]: Linux nodename[65]: LAPTOP-YC release[65]: 5.10.16.3-microsoft-standard-WSL2 version[65]: #1 SMP Fri Apr 2 22:23:49 UTC 2021 machine[65]: x86_64 ``` Signed-off-by: Yong Cong Sin --- samples/posix/uname/Makefile.host | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 samples/posix/uname/Makefile.host diff --git a/samples/posix/uname/Makefile.host b/samples/posix/uname/Makefile.host new file mode 100644 index 00000000000..d5077cf0ec6 --- /dev/null +++ b/samples/posix/uname/Makefile.host @@ -0,0 +1,5 @@ +# This makefile builds the sample for a POSIX system, like Linux + +uname: src/main.c + mkdir -p build + $(CC) $^ -o build/$@