Hi!

Does anyone have an elegant method to include the time of
build (really, time of final link stage) automatically into
a program target?
It would be easy to just prepend a phony target as prerequisite
which creates a build_time.h or so.

However, I want it to capture the time and re-link only when
any of the main target's prerequisites has changed.

What I have now is:

program: $(OBJECTS)
        echo "const char build_time[] = \"`date`\";" > build.c
        $(CC) -c build.c
        $(CC) -o $@ $(OBJECTS) build.o

However, with this approach, I have to use an explicit
compiler call to compile build.c - it would be nicer if I could
let a pattern rule force compilation of build.c.

Is there a better way to do this?

-- 
 Martin


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to