Fix Landlock Make so it can read pattern rule vars

It turned out that specifying all SRCS and INCS as dependencies on the
pattern rules for all headers, caused `make` memory usage to skyrocket
from 40mb ot 160mb. This change also reduces the build graph another 4%.
This commit is contained in:
Justine Tunney 2022-08-13 17:20:50 -07:00
parent 62ca1b0902
commit ead3fc2b31
53 changed files with 105 additions and 93 deletions

View file

@ -5,17 +5,17 @@ import re
import sys
def GetDeps(path):
deps = set()
def Dive(path, depth):
if path in deps:
def Dive(path, depth, visited):
sys.stdout.write('%s%s' % ('\t' * depth, path))
if path in visited:
sys.stdout.write(' cycle\n')
return
deps.add(path)
sys.stdout.write('%s%s\n' % ('\t' * depth, path))
sys.stdout.write('\n')
with open(path) as f:
code = f.read()
for dep in re.findall(r'[.#]include "([^"]+)"', code):
Dive(dep, depth + 1)
Dive(path, 0)
Dive(dep, depth + 1, visited + [path])
Dive(path, 0, [])
sys.stdout.write('\n')
for arg in sys.argv[1:]: