[PATCH] Fix build: don't recompile all C++ every time

Thiago Macieira thiago at macieira.org
Fri Oct 4 09:54:17 UTC 2013


This was caused by the %.o: %.cpp rule depending on "uicables". Since
it's a phony target, the file never exists, so make will always try to
rebuild it. Regardless of whether anything got run because of that,
the target will then be "newer" than the .o file that was being
considered. Therefore, make thought it had to recompile again.

Fix it by skipping the intermediate, phony target and telling make
that the C++ objects depend directly on the header files.

Signed-off-by: Thiago Macieira <thiago at macieira.org>
---
 Rules.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Rules.mk b/Rules.mk
index 30e2e21..ce1ba59 100644
--- a/Rules.mk
+++ b/Rules.mk
@@ -185,7 +185,7 @@ MOCFLAGS = $(filter -I%, $(CXXFLAGS) $(EXTRA_FLAGS)) $(filter -D%, $(CXXFLAGS) $
 	@mkdir -p .dep/$(@D)
 	$(COMPILE_PREFIX)$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MD -MF .dep/$@.dep -c -o $@ $<
 
-%.o: %.cpp uicables
+%.o: %.cpp $(UIC_HEADERS)
 	@$(PRETTYECHO) '    CXX' $<
 	@mkdir -p .dep/$(@D)
 	$(COMPILE_PREFIX)$(CXX) $(CXXFLAGS) $(EXTRA_FLAGS) -I.uic -Iqt-ui -MD -MF .dep/$@.dep -c -o $@ $<
-- 
1.7.11.7



More information about the subsurface mailing list