diff --git a/tools/amalgamate.py b/tools/amalgamate.py index 97a4f4935c..724dac466f 100755 --- a/tools/amalgamate.py +++ b/tools/amalgamate.py @@ -47,7 +47,6 @@ class Amalgamator: self.output_c.write(open("upb/port_def.inc").read()) self.output_h.write("/* Amalgamated source file */\n") - self.output_h.write('#include ') self.output_h.write(open("upb/port_def.inc").read()) def add_include_path(self, path): @@ -69,7 +68,17 @@ class Amalgamator: if not file: raise RuntimeError("Couldn't open file " + infile_name) - for line in file: + lines = file.readlines() + + has_copyright = lines[1].startswith(" * Copyright") + if has_copyright: + while not lines[0].startswith(" */"): + lines.pop(0) + lines.pop(0) + + lines.insert(0, "\n/** " + infile_name + " " + ("*" * 60) +"/"); + + for line in lines: if not self._process_include(line, outfile): outfile.write(line)