How to add support to build with my own compiler

I’ve designed a language, written a compiler for it that outputs .S assembly language files. How do I hook my compiler in to platformio’s build system to compile my chosen extension .shla into .S and then have the .S assembled and linked in to the main project?

With advanced scripting, you can add a pre: script to the project that uses env.Execute() to convert your .shla into .S files using your compiler, the expected output paths of which you can feed into env.BuildSources() to trigger the assembly + link into the project.

I’ve read Advanced Scripting, I don’t see how to hook the new extension in so that it even notices the .shla files. The closes thing I could try was to set up middleware that pattern matches on *.shla and then substitutes the resulting .S file, but the middleware function never gets called.

Sounds like

that looks like a project where files need to be skipped. I need to configure .shla files to be passed to my compiler.

just to make it more clear. I already know how to use a pre script to compile all .shla files to .S before the build.
But I was looking for a way to link my compiler in as an actual compiler… that does an individual .shla at a time… just like gcc takes .c files