[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Adding date/version information to project??

From: Anton Erasmus
Subject: Re: [avr-gcc-list] Adding date/version information to project??
Date: Tue, 29 Nov 2005 14:33:12 +0200

On 29 Nov 2005 at 14:20, address@hidden wrote:

> Hi all:
> I am looking for an automated way to update a static string in program
> space when my project is built. Is there an easy way to do this,
> either by adding an extra target to the makefile, or some other way?
> I'd prefer not to manually have to change the information, and I'd
> also prefer for it to NOT change when none of the other source files
> change. That is, the requirement is as follows:
> 1. The date/other information is changed when a build occurs, ie
> "make" or "make all" or "make target" - basically anything which calls
> the linker; maybe the clue is there. 2. The date/other info is NOT
> changed when a build does not occur. Eg, "make program" causes no
> change in the string if the linker is not called, nor does it change
> if the target is up to date already. 3. I know all this can be done
> using CVS/SVN $Id$ tags, but I don't have a cvs/svn server here at
> work, and I don't want to go through the hassle of setting one up in
> this windows-only shop. I also know that I should be using version
> control here...

One can check the arguments to make within make. You can have version.c
be a phony target only when the argument to make was not "program"

(warning: untested)
i.e. try something like

ifneq ($(MAKECMDGOALS),program)
.PHONY version.c

This should cause version.c to be compiled every time except when
you do a make program. version.c will be recompiled even if no other 
file needed to be recompiled.

  Anton Erasmus-- 
A J Erasmus

reply via email to

[Prev in Thread] Current Thread [Next in Thread]