/* Subversion doesn't make it easy to get the checkout revision into an about box in the final build product. With GNU make, set a CPPFLAGS macro that gets the checkout rev number: CPPFLAGS = -DSVN_REVISION="`svnversion .`" Use the macro in the c code to set the rev number. Test this code with the following compile line: gcc -o svn_checkout_number svn_checkout_number.c -DSVN_REVISION=1234 */ #include /* C Preprocessor has a special "#" operator that you can use to turn things into strings, but it only works in macros with variables. The macros with variables don't expand out my macro variable. so, I have two #defines for macros with variables, The first one expands out my macro variable. The second one stringifies it. It's a common hack around this problem, */ #define STRINGIFY(x) STRINGIFY2(x) // #define STRINGIFY2(x) #x int main(int argc, char** argv) { const char* svn_revision = "$CheckoutRevision: " STRINGIFY(SVN_REVISION) "$"; printf("%s\n", svn_revision); return 0; }