Liudr and bill
Bill thanks for writing down the missing library part in Liudr's story. Liudr, thanks for writing the main part.
I can confirm this is exactly as the Arduino IDE is working. I know for sure as I reproduced this process in Eclipse with my eclipse plugin.
bperrybap:
Note that the core files are put into a real library while the "library" files are not.
The Arduino IDE does not treat the libraries and their module files like real library archive files.What would be better is if all the library .o modules were also put into a library archive and then the users
.o files linked against the "libraries" library as well as the core library and the math library.
I do not agree that it is better to treat all libraries as real libraries. The main reason is the extensive usage of defines. As the libraries in many cases can/will change (for instance because you select another arduino board.) rebuilding is the way to go.
Compiler optimizations that can be accomplished by using real libraries will be minimal as libraries in arduino are typically very dedicated. In other words: "If you use the library you need all of it".
This complexity has to be added for the arduino library or your project will literally explode. (It is hard to get something on a Uno)
So there is little benefit in adding this complexity dynamically for other libraries.
bperrybap:
In fact with proper compiler options, there is no need to do the silly file copying that the IDE is doing
for the library source files.
All compilers have a folder where you have your output files. In my humble opinion there are 2 reasons why the Arduino IDE uses temporary folders.
- to be able to separate output by build. In other words it is to much work to write code to manage the compile output. which is typically done by a compiler)
- Files can be build without saving. In other words you need 2 locations to save the file.
bperrybap:
The IDE is great example of why make and makefiles are so useful and better at doing builds.
The ideal would have been to build the IDE on top of make so that the all the IDE has to do is
build a stub sketch makefile and then let the make and a primary makefile handle all the rules for the actual build.
This would have allowed making tweaks to the build process without having to modify the actual JAVA code.
I agree on this. However I don't know how easy it would be to hide all the makefile complexity in the way the Arduino IDE does a great job now. I'm thinking about explaining "make clean" to a novice.
Best regards
Jantje