Skip to content

Made make vscode compatible with MSYS2 and added make clangd#36

Merged
evolentini merged 2 commits intolabmicro:mainfrom
fmirandabonomi:compatibility-and-clangd
Jul 8, 2025
Merged

Made make vscode compatible with MSYS2 and added make clangd#36
evolentini merged 2 commits intolabmicro:mainfrom
fmirandabonomi:compatibility-and-clangd

Conversation

@fmirandabonomi
Copy link
Contributor

The first version of make vscode relied on echo processing the \n escape sequence in single-quoted text. This happens in mac os and linux's default shell sh but not in MSYS2's default shell bash which requires a -e switch. This same switch is echoed unmodified by sh's version of echo, so it is not a viable solution.

As a workaround, newlines are replaced by >>>> (a sequence that shouldn't appear in text) and then filtering through awk reliably replaces the sequence by a newline before redirecting to create the configuration file.

To support users of the clangd LSP (for instance, vim users) a new target, make clangd was added. This target creates a compile_flags.txt file in the repository's root, with flags that setup clangd in a manner similar to vscode. This also requires newlines but here tr was used as a filter in place of awk because the input is a space-separated list and the only substitution necessary is space to newline

fmirandabonomi and others added 2 commits June 18, 2025 23:13
The first version of `make vscode` relied on echo processing the `\n`
escape sequence in single-quoted text. This happens in mac os and
linux's default shell *sh* but not in MSYS2's default shell *bash*
which requires a `-e` switch. This same switch is echoed unmodified by
sh's version of `echo`, so it is not a viable solution.

As a workaround, newlines are replaced by `>>>>` (a sequence that
shouldn't appear in text) and then filtering through awk to reliably
replace the sequence by a newline before redirecting to create the
configuration file.

To support users of the clangd LSP (for instance, vim users) a new
target, `make clangd` was added. This target creates a
`compile_flags.txt` file in the repository's root, with flags that setup
clangd in a manner similar to vscode. This also requires newlines but
here `tr` was used as a filter in place of `awk` because the input is
a space-separated list and the only substitution necessary is space to newline
@evolentini evolentini merged commit 76e8fb8 into labmicro:main Jul 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants