Skip to content

Commit

Permalink
samples: posix: uname: add Makefile to compile on POSIX OS
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
ycsin authored and carlescufi committed Jan 18, 2024
1 parent 635dabf commit 2cd0265
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions samples/posix/uname/Makefile.host
Original file line number Diff line number Diff line change
@@ -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/$@

0 comments on commit 2cd0265

Please sign in to comment.