From 8349c08d00575cdee39e94796d33fb4c44ddd50b Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 28 May 2013 17:01:47 -0700 Subject: [PATCH] tests: Makefile: eliminate (some) recursive make --- test/Makefile | 20 +++++++++----------- test/litmus/Makefile | 22 +++------------------- 2 files changed, 12 insertions(+), 30 deletions(-) diff --git a/test/Makefile b/test/Makefile index f1ea5b2..5e5e76c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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) diff --git a/test/litmus/Makefile b/test/litmus/Makefile index b4a1233..a4a19b7 100644 --- a/test/litmus/Makefile +++ b/test/litmus/Makefile @@ -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)) -- 2.34.1