bug-make
[Top][All Lists]
Advanced

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

RE: Non existing target not marked as new


From: Raz Manor
Subject: RE: Non existing target not marked as new
Date: Sun, 12 Feb 2017 12:11:45 +0000

OK, I got it. I used .SECONDARY instead of .PRECIOUS to preserve the .d and .o 
files. I did it because I still wanted files to be deleted if they were stopped 
mid-build. Is there a way to get both of the behaviors?

Also, while debugging I made a mistake not to -include the .d files, but they 
were still a precious dependency of the .o files, and there was the %.d: ; rule 
to 'make' them. That made the .o to still not rebuild because the .d file was 
not built. Why was that?

Anyway, these are all nice-to-have problems. My main problem was solved. Thanks 
a lot for all your help.

Peace and love,
Raz

-----Original Message-----
From: Paul Smith [mailto:address@hidden 
Sent: Thursday, February 9, 2017 5:54 PM
To: Raz Manor <address@hidden>; address@hidden
Subject: Re: Non existing target not marked as new

On Thu, 2017-02-09 at 08:16 +0000, Raz Manor wrote:
> Unfortunately I can't send you my makefile as it gives up company IP.

I wasn't suggesting you send your makefile: we don't have the time or energy to 
understand and debug an entire make environment :).  I was suggesting you 
create a small sample that reproduces the problem you're seeing and send that.

I tried to create a repro case based on your description but it worked fine for 
me with both GNU make 4.1 and 4.2.1:

$ mkdir -p build/common/tests ../common/tests

$ echo 'int main() { return 0; }' > ../common/tests/timer_test.cpp

$ cat Makefile
all: build/common/tests/timer_test

build/common/tests/timer_test: build/common/tests/timer_test.o

# -----
DEPFLAGS = -MT $@ -MMD -MP -MF $(@:.o=.Td)

COMPILE.cc = $(CXX) $(DEPFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c 
POSTCOMPILE = mv -f $(@:.o=.Td) $(@:.o=.d)

build/% : build/%.o
        $(LINK.cc) -o $@ $^
build/common/%.o : ../common/%.cpp build/common/%.d
        $(COMPILE.cc) $(OUTPUT_OPTION) $<
        $(POSTCOMPILE)

build/common/%.d: ;
.PRECIOUS: build/common/%.d

-include build/common/tests/timer_test.d

$ make -r
g++ -MT build/common/tests/timer_test.o -MMD -MP -MF 
g++ build/common/tests/timer_test.Td \
  -c -o build/common/tests/timer_test.o ../common/tests/timer_test.cpp mv -f 
build/common/tests/timer_test.Td build/common/tests/timer_test.d
g++ -o build/common/tests/timer_test build/common/tests/timer_test.o

$ make -r
make: Nothing to be done for 'all'.

$ rm -f build/common/tests/timer_test.d

$ make -r
g++ -MT build/common/tests/timer_test.o -MMD -MP -MF 
g++ build/common/tests/timer_test.Td \
  -c -o build/common/tests/timer_test.o ../common/tests/timer_test.cpp mv -f 
build/common/tests/timer_test.Td build/common/tests/timer_test.d
g++ -o build/common/tests/timer_test build/common/tests/timer_test.o

reply via email to

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