updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / libnxt / SConstruct
blob851aaa34c1022402677e062170cd86b6ee8fa5bb
1 from glob import glob
2 from os import environ
4 import SCons.Util
6 auto_libs = ''
8 # Detect the system's endianness
9 from sys import byteorder
10 if byteorder == 'big':
11 endian = '_NXT_BIG_ENDIAN'
12 else:
13 endian = '_NXT_LITTLE_ENDIAN'
15 soname = environ['_soname']
16 shname = environ['_shname']
18 CCFLAGS = \
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)
24 if auto_libs:
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',
37 SHLIBSUFFIX=''))
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='.'))