summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-02 21:10:50 +0000
committerbinji@chromium.org <binji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-02 21:10:50 +0000
commit4ed704901e8b622c536b4385e16055e0afcdbe41 (patch)
tree5928b090687735f03b0ea1507e2f9c75534e8767 /native_client_sdk
parent7098629a8339af67890c4841e039730cb6fa96c3 (diff)
downloadchromium_src-4ed704901e8b622c536b4385e16055e0afcdbe41.zip
chromium_src-4ed704901e8b622c536b4385e16055e0afcdbe41.tar.gz
chromium_src-4ed704901e8b622c536b4385e16055e0afcdbe41.tar.bz2
[NaCl SDK] Add support for project dependencies to master Makefile.
Needed because nacl_mounts_test depends on gtest, which are built with the same recursive Makefile. BUG=122229 R=noelallen@chromium.org Review URL: https://codereview.chromium.org/11028011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rwxr-xr-xnative_client_sdk/src/build_tools/generate_make.py30
-rw-r--r--native_client_sdk/src/examples/Makefile1
-rw-r--r--native_client_sdk/src/examples/Makefile_gyp1
3 files changed, 30 insertions, 2 deletions
diff --git a/native_client_sdk/src/build_tools/generate_make.py b/native_client_sdk/src/build_tools/generate_make.py
index 3e78365..0bb745c 100755
--- a/native_client_sdk/src/build_tools/generate_make.py
+++ b/native_client_sdk/src/build_tools/generate_make.py
@@ -485,7 +485,33 @@ def ProcessProject(srcroot, dstroot, desc, toolchains):
def GenerateMasterMakefile(in_path, out_path, projects):
"""Generate a Master Makefile that builds all examples. """
- replace = { '__PROJECT_LIST__' : SetVar('PROJECTS', projects) }
+ project_names = [project['NAME'] for project in projects]
+
+ # TODO(binji): This is kind of a hack; we use the target's LIBS to determine
+ # dependencies. This project-level dependency is then injected into the
+ # master Makefile.
+ dependencies = []
+ for project in projects:
+ project_deps_set = set()
+ for target in project['TARGETS']:
+ target_libs = target.get('LIBS', [])
+ dependent_libs = set(target_libs) & set(project_names)
+ project_deps_set.update(dependent_libs)
+
+ if project_deps_set:
+ # If project foo depends on projects bar and baz, generate:
+ # "foo_TARGET: bar_TARGET baz_TARGET"
+ # _TARGET is appended for all targets in the master makefile template.
+ project_deps = ' '.join(p + '_TARGET' for p in project_deps_set)
+ project_deps_string = '%s_TARGET: %s' % (project['NAME'], project_deps)
+ dependencies.append(project_deps_string)
+
+ dependencies_string = '\n'.join(dependencies)
+
+ replace = {
+ '__PROJECT_LIST__' : SetVar('PROJECTS', project_names),
+ '__DEPENDENCIES__': dependencies_string,
+ }
WriteReplaced(in_path, out_path, replace)
@@ -554,7 +580,7 @@ def main(argv):
# 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'])
+ master_projects.setdefault(desc['DEST'], []).append(desc)
if options.master:
if use_gyp:
diff --git a/native_client_sdk/src/examples/Makefile b/native_client_sdk/src/examples/Makefile
index ce0d7a2..fc9b787 100644
--- a/native_client_sdk/src/examples/Makefile
+++ b/native_client_sdk/src/examples/Makefile
@@ -34,6 +34,7 @@ endef
# Define the various targets via the Macro
$(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj))))
+__DEPENDENCIES__
all: $(TARGET_LIST)
echo "Done building targets."
diff --git a/native_client_sdk/src/examples/Makefile_gyp b/native_client_sdk/src/examples/Makefile_gyp
index 987375f..84b0cf4 100644
--- a/native_client_sdk/src/examples/Makefile_gyp
+++ b/native_client_sdk/src/examples/Makefile_gyp
@@ -38,6 +38,7 @@ endef
# Define the various targets via the Macro
$(foreach proj,$(PROJECTS),$(eval $(call TARGET,$(proj))))
+__DEPENDENCIES__
all: $(TARGET_LIST)
echo "Done building targets."