From: Brian Norris Date: Wed, 29 May 2013 02:03:14 +0000 (-0700) Subject: Merge remote-tracking branch 'origin/master' X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=commitdiff_plain;h=f2325500e8d1264ea811d5e68419b28d154b54ca;hp=5e2995c5fd6618092e98d47e2a47396b62942959 Merge remote-tracking branch 'origin/master' --- diff --git a/Makefile b/Makefile index acd281b..0ad9fa6 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,22 @@ include common.mk -OBJECTS = libthreads.o schedule.o model.o threads.o librace.o action.o \ - nodestack.o clockvector.o main.o snapshot-interface.o cyclegraph.o \ - datarace.o impatomic.o cmodelint.o \ - snapshot.o malloc.o mymemory.o common.o mutex.o promise.o conditionvariable.o \ - context.o scanalysis.o execution.o plugins.o +OBJECTS := libthreads.o schedule.o model.o threads.o librace.o action.o \ + nodestack.o clockvector.o main.o snapshot-interface.o cyclegraph.o \ + datarace.o impatomic.o cmodelint.o \ + snapshot.o malloc.o mymemory.o common.o mutex.o promise.o conditionvariable.o \ + context.o scanalysis.o execution.o plugins.o CPPFLAGS += -Iinclude -I. -LDFLAGS = -ldl -lrt -rdynamic -SHARED = -shared +LDFLAGS := -ldl -lrt -rdynamic +SHARED := -shared # Mac OSX options ifeq ($(UNAME), Darwin) -LDFLAGS = -ldl -SHARED = -Wl,-undefined,dynamic_lookup -dynamiclib +LDFLAGS := -ldl +SHARED := -Wl,-undefined,dynamic_lookup -dynamiclib endif -TESTS_DIR = test +TESTS_DIR := test all: $(LIB_SO) tests diff --git a/common.mk b/common.mk index 9fe9f09..bc068df 100644 --- a/common.mk +++ b/common.mk @@ -1,12 +1,12 @@ # A few common Makefile items -CC = gcc -CXX = g++ +CC := gcc +CXX := g++ -UNAME = $(shell uname) +UNAME := $(shell uname) -LIB_NAME = model -LIB_SO = lib$(LIB_NAME).so +LIB_NAME := model +LIB_SO := lib$(LIB_NAME).so CPPFLAGS += -Wall -g -O3 diff --git a/test/Makefile b/test/Makefile index f1ea5b2..9d7acb0 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,24 +1,26 @@ -BASE = .. +BASE := .. + +OBJECTS := $(patsubst %.c, %.o, $(wildcard *.c)) +OBJECTS += $(patsubst %.cc, %.o, $(wildcard *.cc)) include $(BASE)/common.mk -CPPFLAGS += -I$(BASE) -I$(BASE)/include +DIR := litmus +include $(DIR)/Makefile -SRCS = $(wildcard *.c) -CPSRCS = $(wildcard *.cc) -OBJS = $(patsubst %.c,%.o,$(SRCS)) $(patsubst %.cc,%.o,$(CPSRCS)) +DEPS := $(join $(addsuffix ., $(dir $(OBJECTS))), $(addsuffix .d, $(notdir $(OBJECTS)))) + +CPPFLAGS += -I$(BASE) -I$(BASE)/include -all: $(OBJS) litmus-tests +all: $(OBJECTS) -litmus-tests:: - $(MAKE) -C litmus +-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 *.o - $(MAKE) -C litmus clean + rm -f $(OBJECTS) $(DEPS) 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))