thunderace / Esp8266-Arduino-Makefile

Makefile to build arduino code for ESP8266/ESP32x under linux (tested on debian X64)
34 stars 20 forks source link

Concatenate ino files before building #5

Closed mmaret closed 7 years ago

mmaret commented 8 years ago

As describe in the Adruino Build process (https://www.arduino.cc/en/Hacking/BuildProcess) ino files are concateneted before building. So variable defined in a .ino are available in other one

thunderace commented 8 years ago

Hello, the Arduino build process is a little more complicated : cpp and ino files are concateneted (cpp first and ino file last) and you have to add the current directory to the INCLUDE . I think that only one ino file is supported (to be confirmed).

mmaret commented 8 years ago

The page linked in previous comment (https://www.arduino.cc/en/Hacking/BuildProcess) said in section Multi-file sketches: "When your sketch is compiled, all tabs with no extension are concatenated together to form the "main sketch file". Tabs with .c or .cpp extensions are compiled separately"

mmaret commented 8 years ago

The ino files are the one without extension

thunderace commented 8 years ago

You're right sorry. but you need to add sketch's directory to the include path(for sketch' include files).

mmaret commented 8 years ago

You are right ! I was planning another PR for that. I will do it here.

2016-06-21 14:58 GMT+02:00 thunder notifications@github.com:

You're right sorry. but you need to add sketch's directory to the include path(for sketch' include files).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thunderace/Esp8266-Arduino-Makefile/pull/5#issuecomment-227431550, or mute the thread https://github.com/notifications/unsubscribe/AAJE0HRewXolDEY6ErtLiJOL3FlV9O8bks5qN-APgaJpZM4I5qUx .

mmaret-geny commented 8 years ago

Btw, you did a great job with this project !

thunderace commented 8 years ago

Your PRs were manualy integrated (because i have made lots of change one hour ago).

I have to add some test sketch now.

Thank you.

mmaret-geny commented 8 years ago

Cool, I was looking for spiffs size too !

thunderace commented 8 years ago

Another problem : we have to concatenate ino files in the right order : the main ino file at the end no?

mmaret commented 8 years ago

I specially try to put the main one at the top. That's why it's "cat $(TARGET).ino $(filter-out $(TARGET).ino,$^) > $@" It looks like it's working like that on arduino.

2016-06-22 10:45 GMT+02:00 thunder notifications@github.com:

Reopened #5 https://github.com/thunderace/Esp8266-Arduino-Makefile/pull/5.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thunderace/Esp8266-Arduino-Makefile/pull/5#event-700161492, or mute the thread https://github.com/notifications/unsubscribe/AAJE0Kd633jF7k7W98UgCBNMzWjbqIl7ks5qOPZFgaJpZM4I5qUx .

thunderace commented 8 years ago

Yes, but it's not enough as we don't have the tool to create function definitions... so i think that concatenate is not enough.

mmaret commented 8 years ago

You are right. In my sketches I make sure that all my function have déclaration in the main sketch. But that's not require (anymore ?). I wonder if the tool to create function declaration from arduino could be reuse ...

2016-06-22 11:40 GMT+02:00 thunder notifications@github.com:

Yes, but it's not enough as we don't have the tool to create function definitions... so i think that concatenate is not enough.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thunderace/Esp8266-Arduino-Makefile/pull/5#issuecomment-227693789, or mute the thread https://github.com/notifications/unsubscribe/AAJE0O-YM0ViojCacbdSfGUbuATaSab-ks5qOQL8gaJpZM4I5qUx .

mmaret commented 8 years ago

We may have something here : https://github.com/michaelbaisch/uDino-Preprocessor but I cannot make it work on my computer

2016-06-22 12:03 GMT+02:00 Mathieu Maret mathieu.maret@gmail.com:

You are right. In my sketches I make sure that all my function have déclaration in the main sketch. But that's not require (anymore ?). I wonder if the tool to create function declaration from arduino could be reuse ...

2016-06-22 11:40 GMT+02:00 thunder notifications@github.com:

Yes, but it's not enough as we don't have the tool to create function definitions... so i think that concatenate is not enough.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/thunderace/Esp8266-Arduino-Makefile/pull/5#issuecomment-227693789, or mute the thread https://github.com/notifications/unsubscribe/AAJE0O-YM0ViojCacbdSfGUbuATaSab-ks5qOQL8gaJpZM4I5qUx .