Created
May 11, 2014 11:45
-
-
Save jwakely/4450be775abb8403eda9 to your computer and use it in GitHub Desktop.
Makefile for Howard's dining philosophers benchmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL := https://raw.githubusercontent.com/HowardHinnant/papers/master/dining_philosophers.html | |
ALGOS := SMART_POLITE SMART PERSISTENT ORDERED STD | |
TARGETS_ROUND := $(foreach algo,$(ALGOS),round-$(algo)) | |
TARGETS_3D := $(foreach algo,$(ALGOS),3d-$(algo)) | |
CXXFLAGS := -std=c++11 -O2 -pthread -Wall -Wno-sign-compare | |
# Define GCC_PATH to use a GCC from a non-standard path, | |
# this ensure the shared libraries will be found at run-time. | |
ifdef GCC_PATH | |
CXX := $(GCC_PATH)/bin/g++ -Wl,-rpath,$(GCC_PATH)/lib64 | |
endif | |
.PHONY: all | |
all: $(TARGETS_ROUND) $(TARGETS_3D) | |
@for i in $^ ; do time ./$$i ; done | |
$(TARGETS_ROUND): round.cc std.h | |
$(CXX) $(CXXFLAGS) -D$(patsubst round-%,%,$@) $< -o $@ | |
$(TARGETS_3D): 3d.cc std.h | |
$(CXX) $(CXXFLAGS) -D$(patsubst 3d-%,%,$@) $< -o $@ | |
$(TARGETS_3D): CXXFLAGS += -include algorithm | |
round-STD 3d-STD: CXXFLAGS += -include std.h | |
std.h: | |
@echo '#include <mutex>' > $@ | |
@echo 'using std::lock;' >> $@ | |
round.cc: dining_philosophers.html | |
w3m -dump $< | sed -e '1,/^Appendix A/d' -e '/^Appendix B/,$$d' > $@ | |
3d.cc: dining_philosophers.html | |
w3m -dump $< | sed -e '1,/^Appendix B/d' > $@ | |
dining_philosophers.html: | |
curl -O $(URL) | |
.PHONY: clean | |
clean: | |
rm -f *.html *.cc $(TARGETS_ROUND) $(TARGETS_3D) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment