[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] __DATE__ constant, any way to format it differently
From: |
Dave Hylands |
Subject: |
Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ? |
Date: |
Wed, 28 Jan 2009 12:10:44 -0800 |
HI Vince,
...snip...
> While I am at it, in the same vein, has anybody a trick to retrieve
> the program revision number from subversion, so I can display that too
> along with the compilation date ?
This is really a make question and not a gcc question.
I created the following Makefile (which I called svn-version.mk), and
then in my normal Makefile (I use handcoded Makefiles), I put this:
all: svn-version.h
include ${PATH_TO_SVN_VERSION}/svn-version.mk
and make my code have
#include "svn-version.h"
My makefiles also do dependency generation, which will automatically
add the svn-version.h file as a dependent.
--
Dave Hylands
Shuswap, BC, Canada
http://www.DaveHylands.com/
###########################################################################
#
# svn-version.mk - Creates the svn-version.h file
#
###########################################################################
#--------------------------------------------------------------------------
#
# Rule to update svn-version.h file. If a C file includes this file then
# the dependcy generator will cause this file to be generated.
#
# To prevent unnecessary updates, a temporary file is created and compared
# to svn-version.h, so that svn-version.h is only touched if a change
# is detected.
#
svn-revision := $(subst Revision:,,$(shell svn info | grep Revision:))
ifeq ($(strip $(svn-revision)),)
svn-revision := 0
endif
svn-version.h: FORCE
@echo "Creating svn-version.h ..."
@echo "/*" > svn-version.tmp
@echo " * Generated file - Do NOT edit" >> svn-version.tmp
@echo " */" >> svn-version.tmp
@echo >> svn-version.tmp
@echo "#define SVN_REVISION $(svn-revision)" >> svn-version.tmp
@cmp --quiet svn-version.tmp svn-version.h || cp svn-version.tmp
svn-version.h
@rm svn-version.tmp
ifneq ($(wildcard svn-version.h),)
clean: clean-svn-version
clean-svn-version:
@echo "Removing svn-version.h ..."
@rm svn-version.h
endif
- Re: [avr-gcc-list] __DATE__ constant, any way to format itdifferently ?, (continued)
- Re: [avr-gcc-list] __DATE__ constant, any way to format itdifferently ?, Vincent Trouilliez, 2009/01/28
- Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, David Kelly, 2009/01/28
- Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, Vincent Trouilliez, 2009/01/28
- Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, Steven Michalske, 2009/01/28
- Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, Vincent Trouilliez, 2009/01/28
- Message not available
- Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, Vincent Trouilliez, 2009/01/28
- Message not available
- Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, Vincent Trouilliez, 2009/01/28
Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?,
Dave Hylands <=
Re: [avr-gcc-list] __DATE__ constant, any way to format it differently ?, Anton James Erasmus, 2009/01/29