[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 <james.ro123@yahoo.com> writes:
>Hi,
>
>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)
$(HOST_LIBS)
.PHONY: vsim_built
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.
scott
- makefile question: always recompile a file, Jim, 2009/08/26
- Re: makefile question: always recompile a file, Chris McDonald, 2009/08/26
- 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, Rainer Weikusat, 2009/08/28
- Re: makefile question: always recompile a file,
Scott Lurndal <=
- Re: makefile question: always recompile a file, Jim, 2009/08/28