mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 462463 - Add missing add_phony_targets.py file. r=me
This commit is contained in:
parent
4580f726b8
commit
22ca629259
33
build/unix/add_phony_targets.py
Normal file
33
build/unix/add_phony_targets.py
Normal file
@ -0,0 +1,33 @@
|
||||
import pymake.data
|
||||
import pymake.parser
|
||||
import pymake.parserdata
|
||||
import sys
|
||||
|
||||
'''
|
||||
Modifies the output of Sun Studio's -xM to look more like the output
|
||||
of gcc's -MD -MP, adding phony targets for dependencies.
|
||||
'''
|
||||
|
||||
|
||||
def add_phony_targets(path):
|
||||
print path
|
||||
deps = set()
|
||||
targets = set()
|
||||
for stmt in pymake.parser.parsefile(path):
|
||||
if isinstance(stmt, pymake.parserdata.Rule):
|
||||
assert isinstance(stmt.depexp, pymake.data.StringExpansion)
|
||||
assert isinstance(stmt.targetexp, pymake.data.StringExpansion)
|
||||
for d in stmt.depexp.s.split():
|
||||
deps.add(d)
|
||||
for t in stmt.targetexp.s.split():
|
||||
targets.add(t)
|
||||
phony_targets = deps - targets
|
||||
if not phony_targets:
|
||||
return
|
||||
with open(path, 'a') as f:
|
||||
f.writelines('%s:\n' % d for d in phony_targets)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for f in sys.argv[1:]:
|
||||
add_phony_targets(f)
|
33
js/src/build/unix/add_phony_targets.py
Normal file
33
js/src/build/unix/add_phony_targets.py
Normal file
@ -0,0 +1,33 @@
|
||||
import pymake.data
|
||||
import pymake.parser
|
||||
import pymake.parserdata
|
||||
import sys
|
||||
|
||||
'''
|
||||
Modifies the output of Sun Studio's -xM to look more like the output
|
||||
of gcc's -MD -MP, adding phony targets for dependencies.
|
||||
'''
|
||||
|
||||
|
||||
def add_phony_targets(path):
|
||||
print path
|
||||
deps = set()
|
||||
targets = set()
|
||||
for stmt in pymake.parser.parsefile(path):
|
||||
if isinstance(stmt, pymake.parserdata.Rule):
|
||||
assert isinstance(stmt.depexp, pymake.data.StringExpansion)
|
||||
assert isinstance(stmt.targetexp, pymake.data.StringExpansion)
|
||||
for d in stmt.depexp.s.split():
|
||||
deps.add(d)
|
||||
for t in stmt.targetexp.s.split():
|
||||
targets.add(t)
|
||||
phony_targets = deps - targets
|
||||
if not phony_targets:
|
||||
return
|
||||
with open(path, 'a') as f:
|
||||
f.writelines('%s:\n' % d for d in phony_targets)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
for f in sys.argv[1:]:
|
||||
add_phony_targets(f)
|
Loading…
Reference in New Issue
Block a user