[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: makefile question: always recompile a file
From: |
Chris McDonald |
Subject: |
Re: makefile question: always recompile a file |
Date: |
Wed, 26 Aug 2009 21:12:30 +0000 (UTC) |
User-agent: |
nn/6.6.3 |
Jim <james.ro123@yahoo.com> writes:
>I'm using a make program similar to gnu make. I'd like to always
>recompile a file whenever ANY file is compiled (or assembled).
>Preferably (but not absolutely necessary), I'd like the file to
>recompile if the linker runs as well, but this sounds really tough.
>In case you're wondering, this file contains a global array that has
>time and date stamp information in it so we can tell when the project
>was last built.
>Some engineers don't like a simple "delete the object file always when
>make runs" approach because if you inadvertently run make a second
>time, you get a recompile even if no sources changed.
As I'm sure you know, compiling the date into the program is the easy
part. In my Makefile I add these actions to the primary target:
@rm -f lastmod.c
@date '+char *LASTMODIFIED = "%l:%M%P %b %d %Y";' > lastmod.c
@$(CC) $(CFLAGS) -c lastmod.c
I have lastmod.c as one of the dependencies of my final target, so the
above is only executed and compiled (before linking) if any other the
other source file will also require compiling.
--
Chris.
- makefile question: always recompile a file, Jim, 2009/08/26
- Re: makefile question: always recompile a file,
Chris McDonald <=
- Re: makefile question: always recompile a file, Eric Sosman, 2009/08/26
- Re: makefile question: always recompile a file, Gordon Burditt, 2009/08/26
- Re: makefile question: always recompile a file, André Gillibert, 2009/08/26
- Re: makefile question: always recompile a file, Ahem A Rivet's Shot, 2009/08/26
- Re: makefile question: always recompile a file, Scott Lurndal, 2009/08/28
- Re: makefile question: always recompile a file, Rainer Weikusat, 2009/08/28
- Re: makefile question: always recompile a file, Jim, 2009/08/28