Update the things manager code not to produce warning messages in compilation
[platform/upstream/iotivity.git] / extlibs / expat / SConscript
1 ##
2 # build script for expat library
3 #
4 # Note:
5 #   1) Only a part of source code are required to be built.
6 #   2) Download code from https://android.googlesource.com/platform/external/expat.git
7 # otherwise, after code is downloaded, it's required to execute './configure' to
8 # generate expat_config.h
9 #
10 ##
11
12 import os
13
14 Import('env')
15
16 expat_env = env.Clone()
17 SConscript(env.get('SRC_DIR') + '/build_common/tools/UnpackAll.py')
18 ######################################################################
19 # Build flags
20 ######################################################################
21 src_dir = 'expat-2.1.0/'
22
23 if not os.path.exists(src_dir):
24         # Prepare source code (download / unpack / run configure)
25         env.Download('expat.tar.gz', 'http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download')
26         expat_src = env.UnpackAll(src_dir + '/Makefile', 'expat.tar.gz')
27         env.Configure(src_dir, './configure')
28
29 expat_env.AppendUnique(CPPPATH = [src_dir, src_dir + 'lib', src_dir + 'vms'])
30
31 target_os = env.get('TARGET_OS')
32 if target_os not in ['windows', 'winrt']:
33         expat_env.AppendUnique(CCFLAGS = ['-g', '-O2', '-Wall',
34                         '-Wmissing-prototypes', '-Wstrict-prototypes',
35                         '-fexceptions', '-fno-common'])
36         expat_env.AppendUnique(CPPDEFINES = ['HAVE_EXPAT_CONFIG_H'])
37
38 if target_os not in ['darwin', 'ios', 'windows', 'winrt']:
39         expat_env.AppendUnique(LINKFLAGS = ['-Wl,--no-undefined'])
40
41 ######################################################################
42 # Source files and Targets
43 ######################################################################
44 expat_src = [
45         src_dir + 'lib/xmlparse.c',
46         src_dir + 'lib/xmltok.c',
47         src_dir + 'lib/xmlrole.c',
48         ]
49
50 libexpat = expat_env.SharedLibrary('expat', expat_src)
51
52 ######################################################################
53 # Install header files and library binary
54 ######################################################################
55 h = expat_env.InstallHeadFile([src_dir + 'lib/expat.h', src_dir + 'lib/expat_external.h'])
56 lib = expat_env.InstallLib(libexpat)
57
58 expat_env.AppendTarget('libexpat', [h, lib])