Skip to content

Commit 920c132

Browse files
bnoordhuisBridgeAR
authored andcommitted
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: #17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent de4600e commit 920c132

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

  • tools/gyp/pylib/gyp/generator

‎tools/gyp/pylib/gyp/generator/make.py‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,6 +2136,7 @@ def CalculateMakefilePath(build_file, base_name):
21362136
fortargetingyp.common.AllTargets(target_list, target_dicts, build_file):
21372137
needed_targets.add(target)
21382138

2139+
all_deps=set()
21392140
build_files=set()
21402141
include_list=set()
21412142
forqualified_targetintarget_list:
@@ -2184,6 +2185,12 @@ def CalculateMakefilePath(build_file, base_name):
21842185
os.path.dirname(makefile_path))
21852186
include_list.add(mkfile_rel_path)
21862187

2188+
if'actions'inspec:
2189+
foractioninspec['actions']:
2190+
all_deps.update(map(writer.Absolutify, action['inputs']))
2191+
if'sources'inspec:
2192+
all_deps.update(map(writer.Absolutify, spec['sources']))
2193+
21872194
# Write out per-gyp (sub-project) Makefiles.
21882195
depth_rel_path=gyp.common.RelativePath(options.depth, os.getcwd())
21892196
forbuild_fileinbuild_files:
@@ -2227,3 +2234,10 @@ def CalculateMakefilePath(build_file, base_name):
22272234
root_makefile.write(SHARED_FOOTER)
22282235

22292236
root_makefile.close()
2237+
2238+
# Hack to get rid of $(obj)/path/to/foo.o deps that node.gyp adds manually.
2239+
all_deps= [sforsinall_depsifnot'$'ins]
2240+
all_deps_path=os.path.join(options.toplevel_dir, '.deps')
2241+
withopen(all_deps_path, 'w') asf:
2242+
f.write('ALL_DEPS := \\\n\t')
2243+
f.write(' \\\n\t'.join(sorted(all_deps)))

0 commit comments

Comments
 (0)