[Top][All Lists]

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

make always builds, part 2

From: Edgar
Subject: make always builds, part 2
Date: Tue, 15 Nov 2011 00:24:25 -0600
User-agent: Thunderbird (Windows/20100228)

I can't get my makefile to work correctly. I have an .a file that depends on .o files that depend on .d files that depend on an output object directory existing. The problem is that the d files always build because make says the directory is newer than the d files, but it was created 8 days ago, and the d files were just created.

I tried to make a small example of it, but this just has problems of its own (doesn't make $(OBJDIRECTORY) or test.d even though they are prerequisites of test.o, or at least I think they should be, but if not, why not?)

OBJDIRECTORY = build\obj\Dynamic\Release

SRCFILES = test.cpp

test.exe : $(OBJFILES)
   g++ -o test.exe $(OBJFILES)

%.o : %.cpp %.d
   g++ -c -o $@ $<

%.d : %.cpp $(OBJDIRECTORY)
   g++ -MM -o $@ $<
   mkdir $(OBJDIRECTORY)

restart :
   del test.exe
   del *.o
   del *.d
   -rmdir $(OBJDIRECTORY)

Here is the output :
g++    -c -o test.o test.cpp
g++ -o test.exe test.o

make: `test.exe' is up to date.

So, can anyone tell me why my library's makefile always says the d files are out of date because the directory is newer (even though it is not), or why this small example makefile doesn't build the d file or make the directory?


reply via email to

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