blob: 0302fc2f87c51dc5513faee3289f9e61a19510c9 [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
Damjan Marion88b2e362021-04-29 18:47:25 +020021 # remove if there is no command
22 if obj["command"] == "":
23 objects.remove(obj)
24 continue
25
Damjan Marionf4ca4842020-10-23 17:20:32 +020026 # remove ccache prefix
27 s = str.split(obj["command"])
28 if s[0] == "ccache":
29 s.remove(s[0])
30 s[0] = s[0].split("/")[-1]
31 obj["command"] = " ".join(s)
32
33json.dump(objects, sys.stdout, indent=2)