blob: 0139b6bb6c51a793fc626d110f2a5e1bbfadbd40 [file] [log] [blame]
Damjan Marionf4ca4842020-10-23 17:20:32 +02001#!/usr/bin/env python3
2
3import sys
4import json
5
6objects = json.load(sys.stdin)
7
8for i in range(len(objects) - 1, -1, -1):
9 obj = objects[i]
10
11 # Remove everything except .c files
12 if not obj["file"].endswith(".c"):
13 objects.remove(obj)
14 continue
15
16 # remove duplicates introduced my multiarch
17 if "CLIB_MARCH_VARIANT" in obj["command"]:
18 objects.remove(obj)
19 continue
20
21 # remove ccache prefix
22 s = str.split(obj["command"])
23 if s[0] == "ccache":
24 s.remove(s[0])
25 s[0] = s[0].split("/")[-1]
26 obj["command"] = " ".join(s)
27
28json.dump(objects, sys.stdout, indent=2)