[Icc-mot] Build/Link time

Barry Callahan barryc at rjlsystems.com
Sat May 26 11:21:20 PDT 2007


End result is the same. If I tell ICC to automatically delete the .o 
file for me, it will only do it after a successful build.
IE: if *ALL* source files compiled successfully.

Consider this:
The  file with __DATE__ and __TIME__ is the fourth .c file to be 
compiled, and the ninth is the one that errors out.
You fix the ninth file and rebuild. Maybe it only takes you a few 
minutes to fix the file. Maybe it takes you hours or days. The point is, 
time passes.

Because the first build did not complete successfully, the .o file 
containing the timestamps was not removed. (or, using my existing 
solution, the .c file was not touched.) Once the ninth file has been 
fixed and the project built, the timestamp embedded in the .s19 does 
*NOT* reflect the time when the project was successfully built. -- It is 
the time when I attempted the first build.

If all I cared about was that I had a means to ensure that I have 
distinct version strings between successful builds, this would not be a 
problem. But I actually, specifically, want the timestamp of the 
successful compile.

If I could specify a command to be executed before the first file was 
compiled, or if I could alter the order in which files are compiled to 
force the file with the timestamp to always be the last file to 
compile,(something that didn't occur to me until just now to try to 
fiddle with) I'd be peachy-keen.

John Baraclough wrote:

> Hi Barry,
>
> Just put the __DATE__ & __TIME__ macros into a very small file as 
> below then delete the '.o' file after every build.
>
> HTH
>
> John
>
> /* 
> ************************************************************************ 
> *\
>   File: DateAndTime.c
>
>   Purpose: Creates a string containing the compilation date & time.
>
>   Revisions:
>   1.00 JNB 2006-10-18
>
>   Notes: The intermediate file 'DateAndTime.o' is deleted after every
>          compilation, so that it is recompiled each time with the new 
> date
>          and time.
>
> \* 
> ************************************************************************ 
> */
>
> #include <includes.h>
>
> void GetCompileDateAndTime(void)
> {
>   cstrcpy(MessageOut, "Build - ");
>   cstrcat(MessageOut, __DATE__);
>   cstrcat(MessageOut, " \100 ");
>   cstrcat(MessageOut, __TIME__);
> }
>
>
>
>
>
>
> At 22:10 25/05/2007, you wrote:
>
>> I want to keep a string that indicates the date and time that the 
>> firmware was built.
>>
>> Right now, I'm building a string with __DATE__ and __TIME__
>>
>> Problem is, those are evaluated by the preprocessor at compile time. 
>> If I modify a file which doesn't reference those macros and forget to 
>> do a "rebuild all", the version string doesn't get updated.
>>
>> In ICC12 (both v6 and v7) there's a text field under the "Compiler" 
>> tab of the "Compiler Options" dialog labeled "Execute Command After 
>> Successful Build:"
>>
>> Right now, I'm using this field to touch (update the modification 
>> time) on the file which builds the timestamp. That way, (assuming the 
>> build completed successfully) the next time I rebuild, that file will 
>> be guaranteed to recompile, regardless of whether I edit it or not.
>>
>> Ideally, I'd touch this file *before* building so I know that the 
>> string always accurately reflects the date and time of when the 
>> program was built, regardless of whether the previous compile was 
>> clean or not..
>>
>>
>> Any suggestions?
>> Thanks.
>>
>> Barry
>>
>> _______________________________________________
>> Icc-mot mailing list
>> Icc-mot at imagecraft.com
>> http://dragonsgate.net/mailman/listinfo/icc-mot
>>
>
>
> _______________________________________________
> Icc-mot mailing list
> Icc-mot at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-mot



More information about the Icc-mot mailing list