Index: native_client_sdk/src/build_tools/generate_make.py |
diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py |
index 8367bb3d5dc549d09b69c55741eb05791ef57b82..47bbd3609846790e25d222029aa863960efbe605 100755 |
--- a/native_client_sdk/src/build_tools/generate_make.py |
+++ b/native_client_sdk/src/build_tools/generate_make.py |
@@ -10,7 +10,7 @@ import os |
import sys |
from make_rules import BuildDefineList, BuildLibList, BuildToolDict |
-from make_rules import GetBuildRule, BUILD_RULES |
+from make_rules import BuildIncludeList, GetBuildRule, BUILD_RULES |
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) |
SDK_SRC_DIR = os.path.dirname(SCRIPT_DIR) |
@@ -145,17 +145,19 @@ def GenerateCompile(target, tool, arch, srcs): |
name = target['NAME'] |
object_sets = [] |
- defines = target.get('DEFINES', []) |
- defs = BuildDefineList(tool, defines) |
+ defs = BuildDefineList(tool, target.get('DEFINES', [])) |
+ includes = BuildIncludeList(tool, target.get('INCLUDES', [])) |
if srcs['.c']: |
- replace = BuildToolDict(tool, name, arch, 'c', DEFLIST=defs) |
+ replace = BuildToolDict(tool, name, arch, 'c', |
+ DEFLIST=defs, INCLUDELIST=includes) |
compile_rule = GetBuildRule(tool, 'CC') |
rules += Replace(compile_rule, replace) |
object_sets.append('$(%s)' % replace['<OBJS>']) |
if srcs['.cc']: |
- replace = BuildToolDict(tool, name, arch, 'cc', DEFLIST=defs) |
+ replace = BuildToolDict(tool, name, arch, 'cc', |
+ DEFLIST=defs, INCLUDELIST=includes) |
compile_rule = GetBuildRule(tool, 'CXX') |
rules += Replace(compile_rule, replace) |
object_sets.append('$(%s)' % replace['<OBJS>']) |
@@ -269,6 +271,7 @@ DSC_FORMAT = { |
'CCFLAGS': (list, '', False), |
'CXXFLAGS': (list, '', False), |
'LDFLAGS': (list, '', False), |
+ 'INCLUDES': (list, '', False), |
'LIBS' : (list, '', False) |
}, True), |
'HEADERS': (list, { |
@@ -278,7 +281,7 @@ DSC_FORMAT = { |
'SEARCH': (list, '', False), |
'POST': (str, '', False), |
'PRE': (str, '', False), |
- 'DEST': (str, ['examples', 'src'], True), |
+ 'DEST': (str, ['examples', 'src', 'testing'], True), |
'NAME': (str, '', False), |
'DATA': (list, '', False), |
'TITLE': (str, '', False), |
@@ -552,8 +555,7 @@ def main(argv): |
toolchains = ['newlib', 'glibc'] |
print 'Using default toolchains: ' + ' '.join(toolchains) |
- examples = [] |
- libs = [] |
+ master_projects = {} |
for filename in args: |
desc = LoadProject(filename, toolchains) |
if not desc: |
@@ -568,21 +570,19 @@ def main(argv): |
if not ProcessProject(srcroot, options.dstroot, desc, toolchains): |
ErrorExit('\n*** Failed to process project: %s ***' % filename) |
- # if this is an example add it to the master make and update the html |
+ # if this is an example update the html |
if desc['DEST'] == 'examples': |
- examples.append(desc['NAME']) |
ProcessHTML(srcroot, options.dstroot, desc, toolchains) |
- # if this is a library add it to the master make |
- if desc['DEST'] == 'src': |
- libs.append(desc['NAME']) |
+ # Create a list of projects for each DEST. This will be used to generate a |
+ # master makefile. |
+ master_projects.setdefault(desc['DEST'], []).append(desc['NAME']) |
if options.master: |
master_in = os.path.join(SDK_EXAMPLE_DIR, 'Makefile') |
- master_out = os.path.join(options.dstroot, 'examples', 'Makefile') |
- GenerateMasterMakefile(master_in, master_out, examples) |
- master_out = os.path.join(options.dstroot, 'src', 'Makefile') |
- GenerateMasterMakefile(master_in, master_out, libs) |
+ for dest, projects in master_projects.iteritems(): |
+ master_out = os.path.join(options.dstroot, dest, 'Makefile') |
+ GenerateMasterMakefile(master_in, master_out, projects) |
return 0 |