Make variable for the C preprocessor
- Dominant language
- Java
- Stars
- 25.8k
- Forks
- 4.6k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 75
Description
### Description of the feature request:
PostGIS has a Makefile recipe which runs the C preprocessor on [.sql.in](https://github.com/postgis/postgis/blob/master/postgis/postgis_brin.sql.in) files to generate .sql files. These input files contain `#define`s like .c files and they even `#include` some .h files.
In theory, we could support this with a rule dedicated to running the preprocessor. It can't employ the cc action/feature system yet because there is no action type for running the preprocessor by itself, but at least the executable is present in the cc_toolchain, giving us enough to do something basic. However, I think these are overkill.
This looks like a textbook use case for a genrule, where it would be handy to have a `CPP` [make variable](https://bazel.build/rules/lib/TemplateVariableInfo) for this so we can obtain the preprocessor from a cc toolchain rather than relying on one present on the host or trying to conjure up a binary rule for it.
### Which category does this issue belong to?
C++ Rules
### What underlying problem are you trying to solve with this feature?
See description
### Which operating system are you running Bazel on?
Ubuntu
### What is the output of `bazel info release`?
release 6.5.0
### If `bazel info release` returns `development version` or `(@non-git)`, tell us how you built Bazel.
_No response_
### What's the output of `git remote get-url origin; git rev-parse HEAD` ?
```text
```
### Have you found anything relevant by searching the web?
The [documentation](https://bazel.build/reference/be/make-variables#custom_variables) for make variables mentions what variables the cpp toolchain provides for this purpose, but also recommends contacting the rule maintainers to discuss the use case first. Perhaps we could do that here! 8^)
### Any other information, logs, or outputs that you want to share?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.