Skip to content

Commit

Permalink
tools: teach gyp to write an 'all deps' rule
Browse files Browse the repository at this point in the history
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: #17407
Reviewed-By: Richard Lau <[email protected]>
  • Loading branch information
bnoordhuis authored and BridgeAR committed Jan 21, 2018
1 parent de4600e commit 920c132
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/gyp/pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -2136,6 +2136,7 @@ def CalculateMakefilePath(build_file, base_name):
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:
Expand Down Expand Up @@ -2184,6 +2185,12 @@ def CalculateMakefilePath(build_file, base_name):
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:
Expand Down Expand Up @@ -2227,3 +2234,10 @@ def CalculateMakefilePath(build_file, base_name):
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)))

0 comments on commit 920c132

Please sign in to comment.