Fix luprex Makefile so it emits full paths, and replace add-compile-commands.py with a better way to build compile_commands.json for luprex

This commit is contained in:
2026-02-27 15:29:44 -05:00
parent 1fa99bac3e
commit 0aea1e0798
3 changed files with 76 additions and 48 deletions

View File

@@ -3,7 +3,7 @@
import sys, os, json
from pathlib import Path
LUPREXDIR=os.path.dirname(os.path.abspath(sys.argv[0]))
BASEDIR=os.getcwd()
JSONFILE=sys.argv[1]
COMPILE=sys.argv[2]
@@ -16,11 +16,11 @@ OBJECTS=sys.argv[6:]
JSON = json.loads(Path(JSONFILE).read_text())
for base in OBJECTS:
obj = LUPREXDIR + "/" + OBJPAT.replace("FILE", base)
file = LUPREXDIR + "/" + CPAT.replace("FILE", base)
flags = FLAGS.replace("-I./", f"-I{LUPREXDIR}/")
obj = BASEDIR + "/" + OBJPAT.replace("FILE", base)
file = BASEDIR + "/" + CPAT.replace("FILE", base)
flags = FLAGS.replace("-I./", f"-I{BASEDIR}/")
command = f"{COMPILE} {obj} {flags} {file}"
JSON.append({"file": file, "command": command, "directory": LUPREXDIR })
JSON.append({"file": file, "command": command, "directory": BASEDIR })
Path(JSONFILE).write_text(json.dumps(JSON, indent=4))