tests: Makefile: eliminate (some) recursive make
authorBrian Norris <banorris@uci.edu>
Wed, 29 May 2013 00:01:47 +0000 (17:01 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 29 May 2013 01:00:56 +0000 (18:00 -0700)
test/Makefile
test/litmus/Makefile

index f1ea5b295d110f81090bf2807b2aeb25c2b9f8bc..5e5e76c6c2b546e197ec3d32b220c6e20a32d857 100644 (file)
@@ -1,17 +1,16 @@
-BASE = ..
+BASE := ..
 
-include $(BASE)/common.mk
+OBJECTS := $(patsubst %.c, %.o, $(wildcard *.c))
+OBJECTS += $(patsubst %.cc, %.o, $(wildcard *.cc))
 
-CPPFLAGS += -I$(BASE) -I$(BASE)/include
+include $(BASE)/common.mk
 
-SRCS = $(wildcard *.c)
-CPSRCS = $(wildcard *.cc)
-OBJS = $(patsubst %.c,%.o,$(SRCS)) $(patsubst %.cc,%.o,$(CPSRCS))
+DIR := litmus
+include $(DIR)/Makefile
 
-all: $(OBJS) litmus-tests
+CPPFLAGS += -I$(BASE) -I$(BASE)/include
 
-litmus-tests::
-       $(MAKE) -C litmus
+all: $(OBJECTS)
 
 %.o: %.c
        $(CC) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
@@ -20,5 +19,4 @@ litmus-tests::
        $(CXX) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
 
 clean::
-       rm -f *.o
-       $(MAKE) -C litmus clean
+       rm -f $(OBJECTS)
index b4a1233d70685f895b7a4e07198bdaf7fee91f23..a4a19b7b6b5f714be633d4a8c6b5d0ad37c4b66d 100644 (file)
@@ -1,20 +1,4 @@
-BASE = ../..
+D := $(DIR)
 
-include $(BASE)/common.mk
-
-CPPFLAGS += -I$(BASE) -I$(BASE)/include
-
-SRCS = $(wildcard *.c)
-CPSRCS = $(wildcard *.cc)
-OBJS = $(patsubst %.c,%.o,$(SRCS)) $(patsubst %.cc,%.o,$(CPSRCS))
-
-all: $(OBJS)
-
-%.o: %.c
-       $(CC) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
-
-%.o: %.cc
-       $(CXX) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
-
-clean::
-       rm -f *.o
+OBJECTS += $(patsubst %.c, %.o, $(wildcard $(D)/*.c))
+OBJECTS += $(patsubst %.cc, %.o, $(wildcard $(D)/*.cc))