help-make
[Top][All Lists]
Advanced

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

print project compile date


From: Kevin
Subject: print project compile date
Date: Mon, 31 Aug 2009 21:09:05 -0400

Hi, all:

I have a question about print the project compile date.

I have a project which contains 2 files: "a.c" and "b.c". I want to print project compile date in one of these 2 files. I put it in a.c:
>>>>>>>>>>>>>>>>>>>>>>>
// This is a.c
#include <stdio.h>

int main()
{
printf("%s\n", __DATE__);
return 0;
}
<<<<<<<<<<<<<<<<<<<<<<<

And b.c looks like this:
>>>>>>>>>>>>>>>>>>>>>>>
// This is b.c
#include <stdio.h>

int do_something(void)
{
   //......;
}
<<<<<<<<<<<<<<<<<<<<<<<

If only "b.c" is modified, and no change in "a.c" at all, when I recompile the project, the printed date doesn't reflect the latest changes in project (in my case "b.c").

I am wondering how to print the project compile date/time to show the latest modification in project files?


I am using powerpc-eabi-gcc, and my Makefile looks like this:
>>>>>>>>>>>>>>>>>>>>>>>
APP = showdate

SRCS = a.c b.c
OBJS = $(SRCS:.c=.o)

$(APP): $(OBJS)
$(CC) $^ -o $@
<<<<<<<<<<<<<<<<<<<<<<<

Is there a mechanism in GNU tools to pass the compile date/time info and no need to change source file? Can I do it in Makefile? Or any other better choices?

Thanks


reply via email to

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