| abs_path_re = re.compile('[A-Za-z]:\\.*')
|
| contents = sys.stdin.readlines()
|
| contents = [line.rstrip() for line in contents]
|
| contents = [line.replace('"', '') for line in contents]
|
| _, first_dep_line = contents[0].split(':', 1)
|
| remaining_deps = [first_dep_line] + contents[1:]
|
| # Go through each line and split on whitespace.
|
| # There may be multiple deps on each line.
|
| for line in remaining_deps:
|
| line = line.strip(' \t\\')
|
| line = line.replace('\\', '/')
|
| # Strip out all absolute paths. Assume these are system includes
|
| # we don't care about. colons in the path confuse make.
|
| deps = filter(lambda d: not abs_path_re.match(d), deps)
|
| sys.stdout.write('%s %s: \\\n' % (deps[0] + '.d', deps[0] + '.o'))
|
| sys.stdout.write(' \\\n'.join([' %s' % d for d in deps]))
|