No sub-Makefile.inc file should ever set CPPFLAGS directly. That is a global/common variable. Instead, ports should set the per-target CPPFLAGS to include what they need. Further, per-target CPPFLAGS should respect $(AM_CPPFLAGS).
Don't hardcode a custom rule for this -- reuse libobjs_a_SOURCES which was designed for this exact scenario.
Supported esp32 and esp32s2 boards: https://github.com/espressif/esp-toolchain-docs/blob/main/gcc/build-and-run-native-app.md