# Makefiles on Windows

{% hint style="info" %}
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.
{% endhint %}

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.

{% hint style="warning" %}
If your call to make is wrapped by a script or a command that calls make by its absolute path or uses path injection, this method will not work.

Example: If you use STM32CubeIDE and build via the stm32cubeidec CLI tool, this method will not work because that tool calls make using its own injected make path. See the STM32CubeIDE compatibility page for more information: <https://docs.wedolow.com/below-technical-documentation/compatibility-guide/stm32cubeide-on-windows>
{% endhint %}

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.

{% stepper %}
{% step %}

### Run below-make-intercept

In a terminal in your project, run:

```bash
below-make-intercept "your-command"
```

The compilation database is printed to standard output.
{% endstep %}

{% step %}

### Example: writing compile\_commands.json

To generate a compile\_commands.json file:

```bash
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:

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

{% endstep %}
{% endstepper %}

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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wedolow.com/documentation/ressources/compatibility-guide/makefiles-on-windows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
