Let me start this off by saying that I think the Arduino team has done a wonderful job lowering the bar to entry to microcontroller development for people with little to no software development experience. The IDE is impressively simple, streamlined, and user friendly and is a great way to get your foot in the door. As someone who’s been doing software development for at least 10 years, now, however, I quickly became frustrated with my persistent muscle memory when editing text in the IDE and found myself longing for my beloved TextMate editor. Within a day of receiving my Arduino board, I started trying to figure out how to use the Makefiles (a skill that I haven’t used since '97 or so) and break up the rust on the parts of my brain that used to know how to program in C. I started to dissect the Makefile today and realized that there’s a ton of reuse that can be achieved by making the build environment a little more (de-facto) standards-oriented.
To start with, I think that everything in hardware/cores/arduino could be packaged up into a single “libarduino.a” archive. By doing that, the entire Arduino core can be linked in to each sketch without having to recompile HardwareSerial.cpp, pins_arduino.c, etc. It would make the per-sketch build process simpler and faster, with fewer dependencies that probably won’t change at all for most people.
Similarly, I think each of the libraries in hardware/libraries could benefit from having their own Makefile that generates their own libWhatever.a archive. With a slight rejiggering of the Arduino conventions, we could either import libraries into a sketch by including, for example, “<EEPROM/EEPROM.h>”, thus minimizing the pre-compilation processing that has to be done to the .pde files.
With these two small(ish) changes, I think it’d be possible to move between the Arduino IDE and command-line Makefiles without having to modify the sketch code as is necessary today. It should be possible to link in the arduino core and EEPROM library with an appropriate -L flag and -larduino and -leeprom in the CFLAGS macro in the sketch’s Makefile. The way it stands today, it seems that you’re either using the IDE or you’re using Makefiles, but not both, since the .pde files need pre-compilation processing that exists only in the Java code. Furthermore, as mentioned in one of the tutorials, it seems that there’s a bug in the Arduino IDE code that prevents you from writing functions that take or return typdef’d types defined in a header file, since the function prototypes end up coming before the #include directive.
Is there sufficient interest to continue to pursue this publicly, or should I just keep tinkering with these for my own edification? I think I’m going to have some code that others will have interest in, but I dread having to maintain a version for myself alongside a version for the IDE.