summaryrefslogtreecommitdiff
path: root/benchtests
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-12 15:01:44 +0530
committerSiddhesh Poyarekar <siddhesh@redhat.com>2013-04-12 15:01:44 +0530
commit8fc1bee546c01b2b6975e4cb07be70cc531aa754 (patch)
treebc1d2e37911b6675cf2273abce1d3104e473eba6 /benchtests
parent0a033d342e102c92e638e2a9e97abbe8685c98d7 (diff)
Move bench target to benchtests
The bench target will only be used within the benchtests directory.
Diffstat (limited to 'benchtests')
-rw-r--r--benchtests/Makefile34
1 files changed, 34 insertions, 0 deletions
diff --git a/benchtests/Makefile b/benchtests/Makefile
index a6a92995a8..86d59057f2 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -104,5 +104,39 @@ slowatan-RET = double
slowatan-INCLUDE = slowatan.c
LDFLAGS-bench-slowatan = -lm
+
+
+# Rules to build and execute the benchmarks. Do not put any benchmark
+# parameters beyond this point.
+
include ../Makeconfig
include ../Rules
+
+binaries-bench := $(addprefix $(objpfx)bench-,$(bench))
+
+run-bench = $(test-wrapper-env) \
+ GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
+ $($*-ENV) $(rtld-prefix) $${run}
+
+bench: $(binaries-bench)
+ for run in $^; do \
+ echo "Running $${run}"; \
+ $(run-bench) >> $(objpfx)bench.out-tmp; \
+ done; \
+ if [ -f $(objpfx)bench.out ]; then \
+ mv -f $(objpfx)bench.out $(objpfx)bench.out.old; \
+ fi; \
+ mv -f $(objpfx)bench.out-tmp $(objpfx)bench.out
+
+$(binaries-bench): %: %.o \
+ $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+ $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
+ $(+link)
+
+$(objpfx)bench-%.c: %-inputs bench-skeleton.c
+ { if [ -n "$($*-INCLUDE)" ]; then \
+ cat $($*-INCLUDE); \
+ fi; \
+ $(..)scripts/bench.pl $(patsubst %-inputs,%,$<) \
+ $($*-ITER) $($*-ARGLIST) $($*-RET); } > $@-tmp
+ mv -f $@-tmp $@