How would I include Arduino libraries using AVR-gcc without the IDE? I am writing my own code for the Arduino Uno. I compile my code with AVR-gcc, and then upload it with AVRdude. I am not using the Arduino software, but I do have it installed and working on my PC. I want to include some of the Arduino libraries in my project, like Wire.h for example. 

I realise that I could either copy the source file to my current working directory or include the entire path, like: #include "/usr/share/arduino/libraries/Wire/Wire.h" but the issue with that is Wire.h includes Stream.h which includes Print.h which includes...you get the idea. These different libraries are not kept in the same place either. I would have to hunt up and down chains of files, copy them and then use them locally. This does not seem like a good option to me.

Including them like I normally would using the IDE doesn't work at all, which is not surprising.

So, how can I use these libraries in my project without all the pain of finding them manually?
Since you will end up using a significant portion of the Arduino core
library, the easiest path is to accept the idea that you are now writing
“Arduino sketches” rather than plain C++ code. Don't resist, be
assimilated, fire the IDE and write setup() and loop(). ;-)

Once you have something working, the next step is to get rid of the IDE,
which is admittedly not very nice. A couple of ways to do that:


Use Arduino Builder, the command-line tool for building
Arduino sketches. The internals of this are the same as for the
Arduino IDE, but it works on the command line.
Use a Makefile, like Sudar Muthu's Arduino-Makefile. This
is a generic Makefile for building Arduino programs. It is not 100%
compatible with the IDE or Aduino builder, as it does not add function
declarations for you, but it may suit you better if you are used to a
more standard toolchain (it's just make + avr-gcc + avrdude).