summaryrefslogtreecommitdiffstats
path: root/Makefile.d
diff options
context:
space:
mode:
authorThomas Heijligen <thomas.heijligen@secunet.de>2021-09-28 15:22:34 +0200
committerNico Huber <nico.h@gmx.de>2021-10-15 14:35:05 +0000
commitba275d8bdb1eacd357b942b0aa7df5612f751fc5 (patch)
treee6813932e37cb112167091345ed50a0bfced6251 /Makefile.d
parent8da9a9acdf5adadd39f1d5e03edd2e326823ef62 (diff)
downloadflashrom-ba275d8bdb1eacd357b942b0aa7df5612f751fc5.tar.gz
flashrom-ba275d8bdb1eacd357b942b0aa7df5612f751fc5.tar.bz2
flashrom-ba275d8bdb1eacd357b942b0aa7df5612f751fc5.zip
Makefile: move determination test for OS to Makefile.d
Move the test code for OS detection in a extra directory to split it from the main flashrom code. Change-Id: Id911f17f4100f242e1fde10d23a8459ddf38b369 Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.de> Reviewed-on: https://review.coreboot.org/c/flashrom/+/58015 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
Diffstat (limited to 'Makefile.d')
-rw-r--r--Makefile.d/os_test.h67
1 files changed, 67 insertions, 0 deletions
diff --git a/Makefile.d/os_test.h b/Makefile.d/os_test.h
new file mode 100644
index 000000000..17045b254
--- /dev/null
+++ b/Makefile.d/os_test.h
@@ -0,0 +1,67 @@
+/*
+ * This file is part of the flashrom project.
+ *
+ * Copyright (C) 2011 Carl-Daniel Hailfinger
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+/*
+ * This file determinate the target os. It should only be used my the Makefile
+ */
+
+// Solaris
+#if defined (__sun) && (defined(__i386) || defined(__amd64))
+#define __FLASHROM_OS__ "SunOS"
+// OS X
+#elif defined(__MACH__) && defined(__APPLE__)
+#define __FLASHROM_OS__ "Darwin"
+// FreeBSD
+#elif defined(__FreeBSD__)
+#define __FLASHROM_OS__ "FreeBSD"
+// FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD)
+#elif defined(__FreeBSD_kernel__) && defined(__GLIBC__)
+#define __FLASHROM_OS__ "FreeBSD-glibc"
+// DragonFlyBSD
+#elif defined(__DragonFly__)
+#define __FLASHROM_OS__ "DragonFlyBSD"
+// NetBSD
+#elif defined(__NetBSD__)
+#define __FLASHROM_OS__ "NetBSD"
+// OpenBSD
+#elif defined(__OpenBSD__)
+#define __FLASHROM_OS__ "OpenBSD"
+// DJGPP
+#elif defined(__DJGPP__)
+#define __FLASHROM_OS__ "DOS"
+// MinGW (always has _WIN32 available)
+#elif defined(__MINGW32__)
+#define __FLASHROM_OS__ "MinGW"
+// Cygwin (usually without _WIN32)
+#elif defined( __CYGWIN__)
+#define __FLASHROM_OS__ "Cygwin"
+// libpayload
+#elif defined(__LIBPAYLOAD__)
+#define __FLASHROM_OS__ "libpayload"
+// GNU Hurd
+#elif defined(__gnu_hurd__)
+#define __FLASHROM_OS__ "Hurd"
+// Linux
+#elif defined(__linux__)
+ // There are various flags in use on Android apparently. __ANDROID__ seems to be the most trustworthy.
+ #if defined(__ANDROID__)
+ #define __FLASHROM_OS__ "Android"
+ #else
+ #define __FLASHROM_OS__ "Linux"
+ #endif
+#else
+#define __FLASHROM_OS__ "unknown"
+#endif
+__FLASHROM_OS__