Work around changes in newer versions of glibc
[model-checker.git] / Makefile
index 0ad9fa66274e16cb68c5d495e8fd034bd54db04a..eb84076dcae075324dc3353d52d72617c578fcfe 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,12 +1,14 @@
 include common.mk
 
+SCFENCE_DIR := scfence
+
 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
+          context.o scanalysis.o execution.o plugins.o libannotate.o
 
-CPPFLAGS += -Iinclude -I.
+CPPFLAGS += -Iinclude -I. -I$(SCFENCE_DIR)
 LDFLAGS := -ldl -lrt -rdynamic
 SHARED := -shared
 
@@ -18,24 +20,34 @@ endif
 
 TESTS_DIR := test
 
-all: $(LIB_SO) tests
+MARKDOWN := doc/Markdown/Markdown.pl
+
+all: $(LIB_SO) tests README.html
 
 debug: CPPFLAGS += -DCONFIG_DEBUG
 debug: all
 
 PHONY += docs
-docs: *.c *.cc *.h
+docs: *.c *.cc *.h README.html
        doxygen
 
-$(LIB_SO): $(OBJECTS)
-       $(CXX) $(SHARED) -o $(LIB_SO) $+ $(LDFLAGS)
+README.html: README.md
+       $(MARKDOWN) $< > $@
+
 
 malloc.o: malloc.c
        $(CC) -fPIC -c malloc.c -DMSPACES -DONLY_MSPACES -DHAVE_MMAP=0 $(CPPFLAGS) -Wno-unused-variable
 
-%.o: %.cc
+%.o : %.cc
        $(CXX) -MMD -MF .$@.d -fPIC -c $< $(CPPFLAGS)
 
+include $(SCFENCE_DIR)/Makefile
+
+-include $(wildcard $(SCFENCE_DIR)/.*.d)
+
+$(LIB_SO): $(OBJECTS)
+       $(CXX) $(SHARED) -o $(LIB_SO) $+ $(LDFLAGS)
+
 %.pdf: %.dot
        dot -Tpdf $< -o $@
 
@@ -43,7 +55,7 @@ malloc.o: malloc.c
 
 PHONY += clean
 clean:
-       rm -f *.o *.so .*.d *.pdf *.dot
+       rm -f *.o *.so .*.d *.pdf *.dot $(SCFENCE_DIR)/.*.d $(SCFENCE_DIR)/*.o
        $(MAKE) -C $(TESTS_DIR) clean
 
 PHONY += mrclean
@@ -74,3 +86,7 @@ PHONY += pdfs
 pdfs: $(patsubst %.dot,%.pdf,$(wildcard *.dot))
 
 .PHONY: $(PHONY)
+
+# A 1-inch margin PDF generated by 'pandoc'
+%.pdf: %.md
+       pandoc -o $@ $< -V header-includes='\usepackage[margin=1in]{geometry}'