3 "This tool is intended to be used from meson"
11 CURRENT_SOURCE_DIR = sys.argv[2]
13 # make sure input files are unique
14 sources = sorted(set(sys.argv[3:]))
16 with open (OUTPUT, "wb") as f:
17 f.write ("".join ('#include "{}"\n'.format (os.path.relpath (os.path.abspath (x), CURRENT_SOURCE_DIR)) for x in sources if x.endswith (".cc")).encode ())
19 # copy it also to the source tree, but only if it has changed
20 baseline_filename = os.path.join (CURRENT_SOURCE_DIR, os.path.basename (OUTPUT))
21 with open(baseline_filename, "rb") as baseline:
22 with open(OUTPUT, "rb") as generated:
23 if baseline.read() != generated.read():
24 shutil.copyfile (OUTPUT, baseline_filename)