From: Brian Norris Date: Wed, 29 May 2013 00:01:47 +0000 (-0700) Subject: tests: Makefile: eliminate (some) recursive make X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=commitdiff_plain;h=8349c08d00575cdee39e94796d33fb4c44ddd50b;ds=sidebyside tests: Makefile: eliminate (some) recursive make --- 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))