Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the flashrom project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Carl-Daniel Hailfinger |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | /* |
Thomas Heijligen | 1e76dc8 | 2021-09-28 15:22:34 +0200 | [diff] [blame] | 17 | * This file determines the target os. It should only be used by the Makefile |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | // Solaris |
| 21 | #if defined (__sun) && (defined(__i386) || defined(__amd64)) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 22 | #define __FLASHPROG_OS__ "SunOS" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 23 | // OS X |
| 24 | #elif defined(__MACH__) && defined(__APPLE__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 25 | #define __FLASHPROG_OS__ "Darwin" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 26 | // FreeBSD |
| 27 | #elif defined(__FreeBSD__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 28 | #define __FLASHPROG_OS__ "FreeBSD" |
Carl-Daniel Hailfinger | a5eecda | 2012-02-25 22:50:21 +0000 | [diff] [blame] | 29 | // FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD) |
| 30 | #elif defined(__FreeBSD_kernel__) && defined(__GLIBC__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 31 | #define __FLASHPROG_OS__ "FreeBSD-glibc" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 32 | // DragonFlyBSD |
| 33 | #elif defined(__DragonFly__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 34 | #define __FLASHPROG_OS__ "DragonFlyBSD" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 35 | // NetBSD |
| 36 | #elif defined(__NetBSD__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 37 | #define __FLASHPROG_OS__ "NetBSD" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 38 | // OpenBSD |
| 39 | #elif defined(__OpenBSD__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 40 | #define __FLASHPROG_OS__ "OpenBSD" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 41 | // DJGPP |
| 42 | #elif defined(__DJGPP__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 43 | #define __FLASHPROG_OS__ "DOS" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 44 | // MinGW (always has _WIN32 available) |
| 45 | #elif defined(__MINGW32__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 46 | #define __FLASHPROG_OS__ "MinGW" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 47 | // Cygwin (usually without _WIN32) |
| 48 | #elif defined( __CYGWIN__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 49 | #define __FLASHPROG_OS__ "Cygwin" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 50 | // libpayload |
| 51 | #elif defined(__LIBPAYLOAD__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 52 | #define __FLASHPROG_OS__ "libpayload" |
Stefan Tauner | 8e65654 | 2016-03-06 22:32:16 +0000 | [diff] [blame] | 53 | // GNU Hurd |
| 54 | #elif defined(__gnu_hurd__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 55 | #define __FLASHPROG_OS__ "Hurd" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 56 | // Linux |
| 57 | #elif defined(__linux__) |
Stefan Tauner | 23e10b8 | 2016-01-23 16:16:49 +0000 | [diff] [blame] | 58 | // There are various flags in use on Android apparently. __ANDROID__ seems to be the most trustworthy. |
| 59 | #if defined(__ANDROID__) |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 60 | #define __FLASHPROG_OS__ "Android" |
Stefan Tauner | 23e10b8 | 2016-01-23 16:16:49 +0000 | [diff] [blame] | 61 | #else |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 62 | #define __FLASHPROG_OS__ "Linux" |
Stefan Tauner | 23e10b8 | 2016-01-23 16:16:49 +0000 | [diff] [blame] | 63 | #endif |
Thomas Heijligen | 1e76dc8 | 2021-09-28 15:22:34 +0200 | [diff] [blame] | 64 | #else |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 65 | #define __FLASHPROG_OS__ "unknown" |
Carl-Daniel Hailfinger | 33a65a0 | 2011-12-20 00:51:44 +0000 | [diff] [blame] | 66 | #endif |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 67 | __FLASHPROG_OS__ |