Browse Source

build: add HOST_OS_LINUX and HOST_OS_MACOS config symbols

This can be used to simplify host os tests in various places

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 4 years ago
parent
commit
2d5b83197a
2 changed files with 9 additions and 0 deletions
  1. 8 0
      Config.in
  2. 1 0
      config/check-uname.sh

+ 8 - 0
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"

+ 1 - 0
config/check-uname.sh

@@ -0,0 +1 @@
+[ "$(uname)" = "$1" ] && echo y || echo n