-
Notifications
You must be signed in to change notification settings - Fork 128
Description
Description
In my build environment, we use a customized make command (wrapper) in certain scenarios. This results in the standard "Entering directory" output being slightly modified.
Instead of the standard make prefix, our output looks like this:
Standard GNU Make:
make[1]: Entering directory '/home/xxx/yyy'
My Environment (Modified Make):
make_alt[1]: Entering directory '/home/xxx/yyy'
The Issue
Because the current parser uses a strict regex that expects the string make at the beginning, compiledb fails to capture directory changes in my environment. This results in incorrect relative paths in the generated compile_commands.json.
I located the relevant code in parser.py. The regex seems to be hardcoded:
# Leverage `make --print-directory` option
make_enter_dir = re.compile(r"^\s*make\[\d+\]: Entering directory [`\'\"](?P<dir>.*)[`\'\"]\s*$")
make_leave_dir = re.compile(r"^\s*make\[\d+\]: Leaving directory .*$")
Suggested Solution
Would it be possible to:
- Option A (Flexible): Provide a CLI option to allow users to define a custom regex pattern for directory parsing.
- Option B: Relax the hardcoded regex to accept any command name before the brackets, for example:
^\s*\w*make\w*\[\d+\]: ....
This would greatly help users working with wrapped build systems or non-standard make variants.
Thanks!