Closed MerijnHendriks closed 2 years ago
A more clear example.
Folder structure:
project/
include/
ext.h
src/
main.c
obj/
main.c.o
makefile
The makefile:
analyze:
$(MAKE) -Bnwk debug | compiledb -o- | cat
Running through the make target:
$ make analyze
make -Bnwk debug | compiledb -o- | cat
[]
Running from the command line directly:
$ make -Bnwk debug | compiledb -o- | cat
[
{
"directory": "C:/Users/User/Documents/Projects/vscodellvm/projects/app",
"arguments": [
"clang",
"-Werror",
"-Wall",
"-Wextra",
"-Wpedantic",
"-Wdeprecated",
"-std=c99",
"-MMD",
"-MP",
"-Iinclude",
"-DDEBUG",
"-g",
"-Wno-unused",
"-c",
"src/main.c",
"-o",
"obj/src/main.c.o"
],
"file": "src/main.c"
}
]
Using the mingw32-make
package (https://packages.msys2.org/base/mingw-w64-make) instead solved my issue!
As the title says, when running from a make target using msys2's
make
package (https://packages.msys2.org/package/make), thecompile_commands.json
file is an empty array.But when I run it from terminal directly, it produces a correct
compile_commands.json
:I tried specifying the path directly (absolute, relative) and the file directly, but no dice.