| 1 |
srcs += files( |
| 2 |
('endian_' + host_machine.endian() + '.c'), |
| 3 |
'memaccess.c', |
| 4 |
) |
| 5 |
|
| 6 |
if host_machine.endian() == 'little' |
| 7 |
add_project_arguments('-D__FLASHROM_LITTLE_ENDIAN__=1', language : 'c') |
| 8 |
endif |
| 9 |
if host_machine.endian() == 'big' |
| 10 |
add_project_arguments('-D__FLASHROM_BIG_ENDIAN__=1', language : 'c') |
| 11 |
endif |
| 12 |
|
| 13 |
# Select an appropriate delay implementation for the target OS |
| 14 |
delay_src = files('udelay.c') |
| 15 |
if target_machine.system() == 'dos' |
| 16 |
delay_src = files('udelay_dos.c') |
| 17 |
endif |
| 18 |
srcs += delay_src |
| 19 |
cargs += ['-DCONFIG_DELAY_MINIMUM_SLEEP_US=@0@'.format( |
| 20 |
get_option('delay_minimum_sleep_us') |
| 21 |
)] |
| 22 |
|
| 23 |
# OpenBSD requires libi386 or libamd64 for I/O port handling |
| 24 |
if host_machine.system() == 'openbsd' |
| 25 |
if host_machine.cpu_family() == 'x86' |
| 26 |
libi386 = cc.find_library('i386') |
| 27 |
deps += libi386 |
| 28 |
elif host_machine.cpu_family() == 'x86_64' |
| 29 |
libamd64 = cc.find_library('amd64') |
| 30 |
deps += libamd64 |
| 31 |
endif |
| 32 |
endif |
| 33 |
|
| 34 |
# NetBSD requires libx86 or libx86_64 for I/O port handling |
| 35 |
if host_machine.system() == 'netbsd' |
| 36 |
if host_machine.cpu_family() == 'x86' |
| 37 |
libx86 = cc.find_library('x86') |
| 38 |
deps += libx86 |
| 39 |
elif host_machine.cpu_family() == 'x86_64' |
| 40 |
libx86_64 = cc.find_library('x86_64') |
| 41 |
deps += libx86_64 |
| 42 |
endif |
| 43 |
endif |
| 44 |
|
| 45 |
# SunOS requires external libraries for network sockets |
| 46 |
# they are used to support serial devices via network |
| 47 |
if host_machine.system() == 'sunos' |
| 48 |
libsocket = cc.find_library('socket') |
| 49 |
libnsl = cc.find_library('nsl') |
| 50 |
deps += [ libsocket, libnsl] |
| 51 |
endif |