build: add HOST_OS_LINUX and HOST_OS_MACOS config symbols
authorFelix Fietkau <nbd@nbd.name>
Wed, 27 Oct 2021 09:47:52 +0000 (11:47 +0200)
committerFelix Fietkau <nbd@nbd.name>
Mon, 1 Nov 2021 15:37:52 +0000 (16:37 +0100)
This can be used to simplify host os tests in various places

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Config.in
config/check-uname.sh [new file with mode: 0755]

index 546e8249ccb41a654f0093a83bf39bfc1ae3112f..65b6dd86aac2360a9c39ddbb65747e75185fa45f 100644 (file)
--- a/Config.in
+++ b/Config.in
@@ -13,6 +13,14 @@ config HAVE_DOT_CONFIG
        bool
        default y
 
+HOST_OS := $(shell, uname)
+
+config HOST_OS_LINUX
+       def_bool $(shell, ./config/check-uname.sh Linux)
+
+config HOST_OS_MACOS
+       def_bool $(shell, ./config/check-uname.sh Darwin)
+
 source "target/Config.in"
 
 source "config/Config-images.in"
diff --git a/config/check-uname.sh b/config/check-uname.sh
new file mode 100755 (executable)
index 0000000..1f1bf9e
--- /dev/null
@@ -0,0 +1 @@
+[ "$(uname)" = "$1" ] && echo y || echo n