From 8c12b0494aa241bb6ddf3779a99d2f5d6ededf73 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Sat, 2 Feb 2019 14:45:21 +0100 Subject: rework build system #2: call make before executing any benchmark Make scans the project directory for Makefiles and executes them. The targets should be build by the new targets/Makefile. All included Makefiles are now "quiet" by default. --- src/Makefile | 2 ++ src/benchmark.py | 6 +++++- src/benchmarks/dj_trace/Makefile | 3 ++- src/benchmarks/falsesharing/Makefile | 4 +++- src/benchmarks/larson/Makefile | 3 ++- src/benchmarks/loop/Makefile | 3 ++- 6 files changed, 16 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index 6b7b704..7173c99 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,9 +15,11 @@ LDFLAGS ?= -pthread -static-libgcc all: $(OBJDIR)/print_status_on_exit.so $(OBJDIR)/chattymalloc.so $(OBJDIR)/print_status_on_exit.so: print_status_on_exit.c | $(OBJDIR) + @echo "Compiling $@..."; $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $< $(OBJDIR)/chattymalloc.so: chattymalloc.c | $(OBJDIR) + @echo "Compiling $@..."; $(CC) $(LDFLAGS) -shared $(CFLAGS) -o $@ $< $(OBJDIR): diff --git a/src/benchmark.py b/src/benchmark.py index e4dbef2..67e8157 100644 --- a/src/benchmark.py +++ b/src/benchmark.py @@ -81,16 +81,20 @@ class Benchmark (object): self.results[target] = d def prepare(self, verbose=False): - os.environ["PATH"] += ":build/" + self.name def is_exe(fpath): return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + os.environ["PATH"] += ":" + os.path.join("build", "benchmarks", + self.name) + for r in self.requirements: fpath, fname = os.path.split(r) + # Search for file if fpath: if not is_exe(r): return False + # Search in PATH else: found = False for path in os.environ["PATH"].split(os.pathsep): diff --git a/src/benchmarks/dj_trace/Makefile b/src/benchmarks/dj_trace/Makefile index 14eca91..0b04678 100644 --- a/src/benchmarks/dj_trace/Makefile +++ b/src/benchmarks/dj_trace/Makefile @@ -15,10 +15,11 @@ LDFLAGS ?= -pthread -static-libgcc all: $(OBJDIR)/trace_run $(OBJDIR)/trace_run: trace_run.c | $(OBJDIR) + @echo compiling $@... $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(OBJDIR): - mkdir $@ + mkdir -p $@ clean: rm -rf $(OBJDIR) diff --git a/src/benchmarks/falsesharing/Makefile b/src/benchmarks/falsesharing/Makefile index 7dec230..763864a 100644 --- a/src/benchmarks/falsesharing/Makefile +++ b/src/benchmarks/falsesharing/Makefile @@ -17,13 +17,15 @@ HEADER = cpuinfo.h fred.h timer.h all: $(OBJDIR)/cache-thrash $(OBJDIR)/cache-scratch $(OBJDIR)/cache-thrash: cache-thrash.cc $(HEADER) | $(OBJDIR) + @echo compiling $@... $(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $< $(OBJDIR)/cache-scratch: cache-scratch.cc $(HEADER) | $(OBJDIR) + @echo compiling $@... $(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $< $(OBJDIR): - mkdir $@ + mkdir -p $@ clean: rm -rf $(OBJDIR) diff --git a/src/benchmarks/larson/Makefile b/src/benchmarks/larson/Makefile index 9ccce9f..0bb9a5b 100644 --- a/src/benchmarks/larson/Makefile +++ b/src/benchmarks/larson/Makefile @@ -15,10 +15,11 @@ LDXXFLAGS ?= -pthread -static-libgcc -static-libstdc++ all: $(OBJDIR)/larson $(OBJDIR)/larson: larson.cc | $(OBJDIR) + @echo compiling $@... $(CXX) $(LDXXFLAGS) $(CXXFLAGS) -o $@ $< $(OBJDIR): - mkdir $@ + mkdir -p $@ clean: rm -rf $(OBJDIR) diff --git a/src/benchmarks/loop/Makefile b/src/benchmarks/loop/Makefile index 89914b2..b297933 100644 --- a/src/benchmarks/loop/Makefile +++ b/src/benchmarks/loop/Makefile @@ -15,10 +15,11 @@ LDFLAGS ?= -pthread -static-libgcc all: $(OBJDIR)/loop $(OBJDIR)/loop: loop.c | $(OBJDIR) + @echo compiling $@... $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $< $(OBJDIR): - mkdir $@ + mkdir -p $@ clean: rm -rf $(OBJDIR) -- cgit v1.2.3