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:
@@ -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))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user