This is the arduino core from the Arduino-0022 distribution. Please reference the liscencing (gpl2 i believe) from the arduino web site as the liscence file was not included in the core.
(I believe this is in violation of its own liscence and will put a liscence file in as soon as I find it)
In the arduino directory is a make include file (Arduino.mk) whick is a hack of the Makefile created by Martin Oldfield which can be found at https://github.com/mjoldfield/Arduino-Makefile
Between the core and the makefile is a usable library based system.
I have a trivial example and a not so trivial example in which 5 pdes were munged into a single source file (which once you have a sane editor is not so bad, mostly I needed to fix this program)