Makefiles on Windows

Though the methods on this page work on both Linux and Windows, on Linux you may rely on the integrated Bear process to generate the compilation database and therefore use your usual build process flawlessly.

When using the make command to build your project, beLow can generate a compilation database file using the below-make-intercept tool (also available as a CLI tool when installing beLow).

A fake make command is injected while running your build script; it instruments calls to make to run them in dry-run mode, parses the log and injects a new log so a compilation database can be generated.

To work with make, give your make command as the Build script when asked.

Generating compile commands from a make command is only possible when run from a clean state. Always provide a Clean script if you can, or ensure your project is in a clean state before running the intercept.

As stated above, you can also directly use the below-make-intercept tool to generate a compilation database outside of beLow (in this case, use local mode). Use it to check whether beLow can generate a compilation database for your make command.

1

Run below-make-intercept

In a terminal in your project, run:

below-make-intercept "your-command"

The compilation database is printed to standard output.

2

Example: writing compile_commands.json

To generate a compile_commands.json file:

make clean
below-make-intercept "make all" > compile_commands.json

On Windows, to ensure compile_commands.json is encoded in a neutral encoding (not depending on system language), prefer this PowerShell form:

make clean
below-make-intercept "make all" | Out-File -Encoding ASCII -FilePath .\compile_commands.json

If beLow cannot generate compile_commands.json automatically from your build scripts for any reason, you may use below-make-intercept directly in the Configure script.