[Top][All Lists]

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

Re: makefile question: always recompile a file

From: Scott Lurndal
Subject: Re: makefile question: always recompile a file
Date: 27 Aug 2009 01:03:11 GMT

Jim <> 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.
>Any ideas on how to do this?


all:    $(TARGET)

$(TARGET): vsim_built buildsubs $(OBJECTS) $(SIM_LIBS)
        $(CXX) $(DEBUGFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(SIM_LIBS) 

.PHONY: vsim_built
        @echo " VSIM_BUILT"
        @echo "static const char *vsim_built = \"VSIM built on $$(uname -n)\n   
        by $$(id -un)\n           at $$(date +"%Y-%m-%d %H:%M")\n           
from $$(pwd)\n           using $(CXXFLAGS)\";" > include/built.h
        @echo "static const unsigned int VSIM_VERSION_MAJOR=$(VSIM_VERS_MAJ);" 
>> include/built.h
        @echo "static const unsigned int VSIM_VERSION_MINOR=$(VSIM_VERS_MIN);" 
>> include/built.h
        @echo "static const unsigned int VSIM_BUILD_NUMBER=$(VSIM_BUILD_NUM);" 
>> include/built.h

if you use dependencies (makedepend or gcc built-in), the dependency on built.h 
will be
automatically picked up on every make.


reply via email to

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