summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2018-01-20 01:00:34 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-01-21 02:19:44 +0100
commit920c13203df434278eb7c34a485e89734a5fa62a (patch)
tree0c97f4a54ba30ec2dee6dc7a19a5bb8ce56b64ae
parentde4600ea2bf2eb5a1367825dc84ea7561b0c3529 (diff)
downloadandroid-node-v8-920c13203df434278eb7c34a485e89734a5fa62a.tar.gz
android-node-v8-920c13203df434278eb7c34a485e89734a5fa62a.tar.bz2
android-node-v8-920c13203df434278eb7c34a485e89734a5fa62a.zip
tools: teach gyp to write an 'all deps' rule
Make GYP write a .deps file in the top-level directory that we can use in the Makefile to get a proper dependency chain for the `node` target. Preparatory work for getting rid of recursive make invocations. PR-URL: https://github.com/nodejs/node/pull/17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
-rw-r--r--tools/gyp/pylib/gyp/generator/make.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py
index f7f519b3e6..eaf02ae734 100644
--- a/tools/gyp/pylib/gyp/generator/make.py
+++ b/tools/gyp/pylib/gyp/generator/make.py
@@ -2136,6 +2136,7 @@ def GenerateOutput(target_list, target_dicts, data, params):
for target in gyp.common.AllTargets(target_list, target_dicts, build_file):
needed_targets.add(target)
+ all_deps = set()
build_files = set()
include_list = set()
for qualified_target in target_list:
@@ -2184,6 +2185,12 @@ def GenerateOutput(target_list, target_dicts, data, params):
os.path.dirname(makefile_path))
include_list.add(mkfile_rel_path)
+ if 'actions' in spec:
+ for action in spec['actions']:
+ all_deps.update(map(writer.Absolutify, action['inputs']))
+ if 'sources' in spec:
+ all_deps.update(map(writer.Absolutify, spec['sources']))
+
# Write out per-gyp (sub-project) Makefiles.
depth_rel_path = gyp.common.RelativePath(options.depth, os.getcwd())
for build_file in build_files:
@@ -2227,3 +2234,10 @@ def GenerateOutput(target_list, target_dicts, data, params):
root_makefile.write(SHARED_FOOTER)
root_makefile.close()
+
+ # Hack to get rid of $(obj)/path/to/foo.o deps that node.gyp adds manually.
+ all_deps = [s for s in all_deps if not '$' in s]
+ all_deps_path = os.path.join(options.toplevel_dir, '.deps')
+ with open(all_deps_path, 'w') as f:
+ f.write('ALL_DEPS := \\\n\t')
+ f.write(' \\\n\t'.join(sorted(all_deps)))