diff mbox series

[v2] Kconfig: add HAVE_LINUX and HAVE_FREEBSD properties

Message ID 20180424144207.15320-1-christian.storm@siemens.com
State Accepted
Headers show
Series [v2] Kconfig: add HAVE_LINUX and HAVE_FREEBSD properties | expand

Commit Message

Storm, Christian April 24, 2018, 2:42 p.m. UTC
Introduce the HAVE_LINUX property to mark Linux-only
features such as, e.g., systemd and mtd support.
Alike, introduce the HAVE_FREEBSD property to mark
FreeBSD-supported features.

Signed-off-by: Christian Storm <christian.storm@siemens.com>
---
 Kconfig       | 11 ++++++++++-
 Makefile      | 11 +++++++++++
 Makefile.deps |  4 ++++
 3 files changed, 25 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Kconfig b/Kconfig
index 1bce6d4..39411c0 100644
--- a/Kconfig
+++ b/Kconfig
@@ -5,6 +5,14 @@ 
 
 mainmenu "Swupdate Configuration"
 
+config HAVE_LINUX
+	bool
+	option env="HAVE_LINUX"
+
+config HAVE_FREEBSD
+	bool
+	option env="HAVE_FREEBSD"
+
 config HAVE_DOT_CONFIG
 	bool
 	default y
@@ -75,6 +83,7 @@  config CURL_SSL
 
 config SYSTEMD
 	bool "enable systemd support"
+	depends on HAVE_LINUX
 	default n
 	help
 	  Enable support for systemd's start-up completion
@@ -160,7 +169,7 @@  config MTD
 	  Enable MTD support.
 
 comment "MTD support needs libmtd"
-	depends on !HAVE_LIBMTD
+	depends on !HAVE_LIBMTD && HAVE_LINUX
 
 config LUA
 	bool "lua"
diff --git a/Makefile b/Makefile
index 54af2a8..3b57639 100644
--- a/Makefile
+++ b/Makefile
@@ -16,6 +16,17 @@  NAME =
 # o  print "Entering directory ...";
 MAKEFLAGS += -r --no-print-directory
 
+OSNAME := $(shell uname -s)
+ifeq ($(OSNAME),Linux)
+export HAVE_LINUX = y
+else
+export HAVE_LINUX = n
+endif
+ifeq ($(OSNAME),FreeBSD)
+export HAVE_FREEBSD = y
+else
+export HAVE_FREEBSD = n
+endif
 
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
diff --git a/Makefile.deps b/Makefile.deps
index 1a01ca0..c49fe83 100644
--- a/Makefile.deps
+++ b/Makefile.deps
@@ -15,7 +15,11 @@  export HAVE_LIBCURL = y
 endif
 
 ifeq ($(HAVE_LIBMTD),)
+ifeq ($(HAVE_LINUX),y)
 export HAVE_LIBMTD = y
+else
+export HAVE_LIBMTD = n
+endif
 endif
 
 ifeq ($(HAVE_LIBUBI),)