tests: Makefile: eliminate (some) recursive make
[model-checker.git] / test / Makefile
index 87893243ce83e32f9e27331ec8620de14c6bce2d..5e5e76c6c2b546e197ec3d32b220c6e20a32d857 100644 (file)
@@ -1,23 +1,22 @@
-include ../common.mk
+BASE := ..
 
-CPPFLAGS += -I.. -I../include
+OBJECTS := $(patsubst %.c, %.o, $(wildcard *.c))
+OBJECTS += $(patsubst %.cc, %.o, $(wildcard *.cc))
 
-# Mac OSX options
-ifeq ($(UNAME), Darwin)
-CPPFLAGS += -D_XOPEN_SOURCE -DMAC
-endif
+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)
+CPPFLAGS += -I$(BASE) -I$(BASE)/include
+
+all: $(OBJECTS)
 
 %.o: %.c
-       $(CC) -o $@ $< $(CPPFLAGS) -L.. -l$(LIB_NAME)
+       $(CC) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
 
 %.o: %.cc
-       $(CXX) -o $@ $< $(CPPFLAGS) -L.. -l$(LIB_NAME)
+       $(CXX) -o $@ $< $(CPPFLAGS) -L$(BASE) -l$(LIB_NAME)
 
 clean::
-       rm -f *.o
+       rm -f $(OBJECTS)