Code snippet paths in GCC
Background: Keil开发者_开发技巧 C51 on a PC, currently moving to GCC (CrossPack-AVR) on an iMac.
Since I write firmware for micro's I have a lot of 'driver' source files etc. that I need to include with my programs, e.g. a LCD driver, i.e. reusing code. These code snippets (.c and .h files) live sub folders in a /snippets/
folder, i.e. /snippets/lcd/
. My /snippets/
used to be in a folder that also had a /projects/
folder for, well, projects or applications. I had considered putting them in a library but I use various architectures so it would not always work.
The Question: How can one set that up in GCC without having to specify absolute paths to the snippets in, for example, the various #include
paths etc. so that the source file, of the included snippet, gets re-compiled along with the project that uses/includes it? Thus, if I improve on a snippet, it benefits all projects that is compiled/re-compiled subsequently?
I looked around on google but must be using the wrong search term.
Thanks!
I think make files will do the trick.
精彩评论