X-Git-Url: http://plrg.eecs.uci.edu/git/?p=cdsspec-compiler.git;a=blobdiff_plain;f=Makefile;h=acd281b3b9c2162e974c6843ba37fa455eeeb59a;hp=bdd83482c4c8b699e3a7c6b83cdfc5f349f046d6;hb=b090a4abc4915a9aa2a29787f76a6add79f838e2;hpb=62329036957e44d4fa85a5461766679916a03f74 diff --git a/Makefile b/Makefile index bdd8348..acd281b 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,76 @@ -CC=g++ -BIN=libthreads -SOURCE=libthreads.cc schedule.cc libatomic.cc userprog.c model.cc malloc.c threads.cc -HEADERS=libthreads.h schedule.h common.h libatomic.h model.h threads_internal.h -FLAGS=-Wall -ldl -g +include common.mk -all: ${BIN} +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 -${BIN}: ${SOURCE} ${HEADERS} - ${CC} -o ${BIN} ${SOURCE} ${FLAGS} +CPPFLAGS += -Iinclude -I. +LDFLAGS = -ldl -lrt -rdynamic +SHARED = -shared +# Mac OSX options +ifeq ($(UNAME), Darwin) +LDFLAGS = -ldl +SHARED = -Wl,-undefined,dynamic_lookup -dynamiclib +endif + +TESTS_DIR = test + +all: $(LIB_SO) tests + +debug: CPPFLAGS += -DCONFIG_DEBUG +debug: all + +PHONY += docs +docs: *.c *.cc *.h + doxygen + +$(LIB_SO): $(OBJECTS) + $(CXX) $(SHARED) -o $(LIB_SO) $+ $(LDFLAGS) + +malloc.o: malloc.c + $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=0 $(CPPFLAGS) -Wno-unused-variable + +%.o: %.cc + $(CXX) -MMD -MF .$@.d -fPIC -c $< $(CPPFLAGS) + +%.pdf: %.dot + dot -Tpdf $< -o $@ + +-include $(OBJECTS:%=.%.d) + +PHONY += clean clean: - rm -f ${BIN} *.o + rm -f *.o *.so .*.d *.pdf *.dot + $(MAKE) -C $(TESTS_DIR) clean -tags:: +PHONY += mrclean +mrclean: clean + rm -rf docs + +PHONY += tags +tags: ctags -R + +PHONY += tests +tests: $(LIB_SO) + $(MAKE) -C $(TESTS_DIR) + +BENCH_DIR := benchmarks + +PHONY += benchmarks +benchmarks: $(LIB_SO) + @if ! test -d $(BENCH_DIR); then \ + echo "Directory $(BENCH_DIR) does not exist" && \ + echo "Please clone the benchmarks repository" && \ + echo && \ + exit 1; \ + fi + $(MAKE) -C $(BENCH_DIR) + +PHONY += pdfs +pdfs: $(patsubst %.dot,%.pdf,$(wildcard *.dot)) + +.PHONY: $(PHONY)