mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 13:52:28 +00:00
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:
parent
62ca1b0902
commit
ead3fc2b31
53 changed files with 105 additions and 93 deletions
|
@ -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:]:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue