I recently started wondering how to write a makefile to compile and upload code to the Arduino and I wrote the following makefile as an exercise:
It's pretty simple. I did it to try and decrypt make commands and thought it might be a good starting point for others that wanted to get their heads around make.
If you're interested there's some commentary/instructions below as an attempt to explain how it works. Perhaps someone somewhere will find it useful. Other makefiles that I found seemed quite dense and hard to understand.
Lastly, I wanted to say thanks to the Arduino contributors for building something so brilliant!