8 # Detect the system's endianness
9 from sys
import byteorder
10 if byteorder
== 'big':
11 endian
= '_NXT_BIG_ENDIAN'
13 endian
= '_NXT_LITTLE_ENDIAN'
15 soname
= environ
['_soname']
16 shname
= environ
['_shname']
19 environ
.get('CFLAGS', '').split() + ['-Wall', '-std=gnu99', '-D' + endian
]
20 SHLINKFLAGS
= '-Wl,-soname,' + soname
21 BuildEnv
= Environment(CCFLAGS
=CCFLAGS
)
22 BuildEnv
['SHLINKFLAGS'] += SCons
.Util
.CLVar(SHLINKFLAGS
)
25 BuildEnv
.ParseConfig('pkg-config --cflags --libs ' + auto_libs
)
27 BuildEnv
.Command('flash_routine.h',
28 'flash_routine.h.base',
29 'python2 make_flash_header.py')
31 library_files
= [x
for x
in glob('*.c')
32 if not x
.startswith('main_')]
34 Default(BuildEnv
.Library('nxt', library_files
, LIBS
='usb'))
36 Default(BuildEnv
.SharedLibrary(shname
, library_files
, LIBS
='usb',
39 Default(BuildEnv
.Program('fwflash', ['main_fwflash.c', shname
],
40 LIBS
=['usb'], LIBPATH
='.'))
42 Default(BuildEnv
.Program('fwexec', ['main_fwexec.c', shname
],
43 LIBS
=['usb'], LIBPATH
='.'))