Hmmm... I tried this but it seems that the makefile is not called from within the Arduino IDE, rather it is for when you want to build from the command line.
I was hoping for a solution that would work for building within the IDE

An alternative is to be able to compile the source code in the Arduino IDE as a library. However it is using:
ENTER_CRITICAL_SECTION
LEAVE_CRITICAL_SECTION
from: #include <util/atomic.h>
which I think requires -std=c99 or -std=gnu99 to compile correctly. However the IDE does not include this flag...

Perhaps it would be useful if we could have some settings in the preferences file to add C and C++ compiler and linker flags so that we can modify the default behaviour without a rebuild of the IDE.
Comments?