Nico Huber | 3458220 | 2024-04-21 15:39:45 +0200 | [diff] [blame] | 1 | fs = import('fs') |
| 2 | |
Thomas Heijligen | 328a64a | 2022-04-25 14:42:17 +0200 | [diff] [blame] | 3 | srcs += files( |
| 4 | ('endian_' + host_machine.endian() + '.c'), |
| 5 | 'memaccess.c', |
| 6 | ) |
| 7 | |
| 8 | if host_machine.endian() == 'little' |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 9 | add_project_arguments('-D__FLASHPROG_LITTLE_ENDIAN__=1', language : 'c') |
Thomas Heijligen | 328a64a | 2022-04-25 14:42:17 +0200 | [diff] [blame] | 10 | endif |
| 11 | if host_machine.endian() == 'big' |
Nico Huber | c3b02dc | 2023-08-12 01:13:45 +0200 | [diff] [blame] | 12 | add_project_arguments('-D__FLASHPROG_BIG_ENDIAN__=1', language : 'c') |
Thomas Heijligen | 328a64a | 2022-04-25 14:42:17 +0200 | [diff] [blame] | 13 | endif |
Thomas Heijligen | 3ecf0b6 | 2022-08-18 12:16:29 +0200 | [diff] [blame] | 14 | |
| 15 | # OpenBSD requires libi386 or libamd64 for I/O port handling |
| 16 | if host_machine.system() == 'openbsd' |
| 17 | if host_machine.cpu_family() == 'x86' |
| 18 | libi386 = cc.find_library('i386') |
| 19 | deps += libi386 |
| 20 | elif host_machine.cpu_family() == 'x86_64' |
| 21 | libamd64 = cc.find_library('amd64') |
| 22 | deps += libamd64 |
| 23 | endif |
| 24 | endif |
| 25 | |
Thomas Heijligen | 3ecf0b6 | 2022-08-18 12:16:29 +0200 | [diff] [blame] | 26 | if host_machine.system() == 'netbsd' |
Nico Huber | 3458220 | 2024-04-21 15:39:45 +0200 | [diff] [blame] | 27 | # NetBSD requires libi386 or libx86_64 for I/O port handling |
Thomas Heijligen | 3ecf0b6 | 2022-08-18 12:16:29 +0200 | [diff] [blame] | 28 | if host_machine.cpu_family() == 'x86' |
Nico Huber | f279762 | 2024-04-21 13:25:17 +0200 | [diff] [blame] | 29 | libi386 = cc.find_library('i386') |
| 30 | deps += libi386 |
Thomas Heijligen | 3ecf0b6 | 2022-08-18 12:16:29 +0200 | [diff] [blame] | 31 | elif host_machine.cpu_family() == 'x86_64' |
| 32 | libx86_64 = cc.find_library('x86_64') |
| 33 | deps += libx86_64 |
| 34 | endif |
Nico Huber | 3458220 | 2024-04-21 15:39:45 +0200 | [diff] [blame] | 35 | # and special handling for `pci.h` not being inside `pci/` |
| 36 | if fs.exists('/usr/pkg/include/pciutils/pci.h') |
| 37 | add_project_arguments('-DPCIUTILS_PCI_H', language : 'c') |
| 38 | endif |
Thomas Heijligen | 3ecf0b6 | 2022-08-18 12:16:29 +0200 | [diff] [blame] | 39 | endif |
| 40 | |
| 41 | |
| 42 | # SunOS requires external libraries for network sockets |
| 43 | # they are used to support serial devices via network |
| 44 | if host_machine.system() == 'sunos' |
| 45 | libsocket = cc.find_library('socket') |
| 46 | libnsl = cc.find_library('nsl') |
| 47 | deps += [ libsocket, libnsl] |
| 48 | endif |