From 93221839adb57ec10dd80f42be3963732cd2e236 Mon Sep 17 00:00:00 2001
From: Brian Norris <banorris@uci.edu>
Date: Tue, 28 May 2013 17:59:58 -0700
Subject: [PATCH] tests: Makefile: add dependency information

Now tests will be re-compiled whenever their include files are modified.
---
 test/Makefile | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/Makefile b/test/Makefile
index 5e5e76c..9d7acb0 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -8,15 +8,19 @@ include $(BASE)/common.mk
 DIR := litmus
 include $(DIR)/Makefile
 
+DEPS := $(join $(addsuffix ., $(dir $(OBJECTS))), $(addsuffix .d, $(notdir $(OBJECTS))))
+
 CPPFLAGS += -I$(BASE) -I$(BASE)/include
 
 all: $(OBJECTS)
 
+-include $(DEPS)
+
 %.o: %.c
-	$(CC) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
+	$(CC) -MMD -MF $(@D)/.$(@F).d -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
 
 %.o: %.cc
-	$(CXX) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
+	$(CXX) -MMD -MF $(@D)/.$(@F).d -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
 
 clean::
-	rm -f $(OBJECTS)
+	rm -f $(OBJECTS) $(DEPS)
-- 
2.34.1