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