Compile .ino source file locally

so my project structure is like this
lib/
src/Firmware.ino

so when i compile using particle compile electron --target 1.0.0 it works perfectly i get this binaries its done.
now i want to compile my project using local gcc. so i did the setup and include project directory using APPDIR=“Firmware/”
and then from module i did whole make thing
make clean all PLATFORM=electron APPDIR=“Firmware/”
but here is the error.
build.mk:65: *** “No sources found in Firmware”.Stop.
and then i rename it to cpp so it got SparkJson.h not found but its because i added it for cloud compile to project.properties. so source file is there but only .cpp and .h files are recognize by offline compiler.
it seems like it does not recognize .ino file.
how can i compile .ino file because its a big firmware to convert from .ino to cpp i want to compile ino from local compiler.

i know about “particle preprocess” command but i want to add this functionality in makefile

Using Particle Workbench would make that much easier :wink:

1 Like

particle workbench doesn’t working it is giving me hard time.

Is there a reason you need to use a .ino file? You’re much better off converting your .ino into a .cpp file once using particle preprocess, then just maintain the .cpp file and use that in your local build.

Yes because the whole firmware is structured this way that we can also use the main ino file with samd21 so to maintain the firmware structure we really need this .
is particle compile is doing same thing in backend after uploading the code to cloud.?

The gcc-arm local Makefile does not know how to process .ino files.

The cloud build actually uses the same gcc-arm build system, and itself doesn’t know how to handle .ino files.

The preprocessor runs on your cloud uploaded source to convert the main .ino file to a .cpp file, then the normal gcc-arm build process builds the .cpp file.

You can do the same thing from your Makefile.

and then delete the processed cpp file manually right?

After compilation is complete you can delete the generated .cpp file.