Damjan Marion | f4ca484 | 2020-10-23 17:20:32 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
| 2 | |
| 3 | import sys |
| 4 | import json |
| 5 | |
| 6 | objects = json.load(sys.stdin) |
| 7 | |
| 8 | for 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 Marion | 88b2e36 | 2021-04-29 18:47:25 +0200 | [diff] [blame] | 21 | # remove if there is no command |
| 22 | if obj["command"] == "": |
| 23 | objects.remove(obj) |
| 24 | continue |
| 25 | |
Damjan Marion | f4ca484 | 2020-10-23 17:20:32 +0200 | [diff] [blame] | 26 | # 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 | |
| 33 | json.dump(objects, sys.stdout, indent=2) |