help-gnu-utils
[Top][All Lists]
Advanced

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

Re: makefile question: always recompile a file


From: Gordon Burditt
Subject: Re: makefile question: always recompile a file
Date: Wed, 26 Aug 2009 16:21:50 -0500

>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.

I'm not sure I understand your requirements, but here is one way to
do it which I think meets them:

        Change the entry for the link step, so it always
compiles the global array.:

foo:    foo1.o foo2.o ... global_array.o
        cc -o foo foo1.o foo2.o .. global_array.o -lfoo -lbar

to:

foo:    foo1.o foo2.o ... global_array.c
        cc -c global_array.c
        cc -o foo foo1.o foo2.o .. global_array.o -lfoo -lbar

I presume it is not important to recompile global_array if you
recompile pieces of the program *WITHOUT* linking as you didn't
rebuild the whole thing, and it will be recompiled when you do
a full build.

>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.



reply via email to

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