about summary refs log tree commit diff
path: root/benchtests/Makefile
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-07-30 12:15:27 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-10-04 10:09:13 -0700
commitde0a7c5a0b2061c86441a1822d6c3a898b0b6ba2 (patch)
tree9c3f2621a02bc24cb5a694b81fa1765a004e68c7 /benchtests/Makefile
parent83b5323261bb72313bffcf37476c1b8f0847c736 (diff)
downloadglibc-de0a7c5a0b2061c86441a1822d6c3a898b0b6ba2.tar.gz
glibc-de0a7c5a0b2061c86441a1822d6c3a898b0b6ba2.tar.xz
glibc-de0a7c5a0b2061c86441a1822d6c3a898b0b6ba2.zip
benchtests: Building benchmarks as static executables
Building benchmarks as static executables:
=========================================

To build benchmarks as static executables, on the build system, run:

  $ make STATIC-BENCHTESTS=yes bench-build

You can copy benchmark executables to another machine and run them
without copying the source nor build directories.
Diffstat (limited to 'benchtests/Makefile')
-rw-r--r--benchtests/Makefile26
1 files changed, 19 insertions, 7 deletions
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 1530939a8c..4fcd73131a 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -110,11 +110,23 @@ else
 bench-malloc := $(filter malloc-%,${BENCHSET})
 endif
 
-$(addprefix $(objpfx)bench-,$(bench-math)): $(libm)
-$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm)
-$(addprefix $(objpfx)bench-,$(bench-pthread)): $(shared-thread-library)
-$(addprefix $(objpfx)bench-,$(bench-malloc)): $(shared-thread-library)
-$(addprefix $(objpfx)bench-,pthread-locks): $(libm)
+ifeq (${STATIC-BENCHTESTS},yes)
++link-benchtests = $(+link-static-tests)
+link-libc-benchtests = $(link-libc-static)
+libm-benchtests = $(common-objpfx)math/libm.a
+thread-library-benchtests = $(static-thread-library)
+else
+link-libc-benchtests = $(link-libc)
++link-benchtests = $(+link-tests)
+thread-library-benchtests = $(shared-thread-library)
+libm-benchtests = $(libm)
+endif
+
+$(addprefix $(objpfx)bench-,$(bench-math)): $(libm-benchtests)
+$(addprefix $(objpfx)bench-,$(math-benchset)): $(libm-benchtests)
+$(addprefix $(objpfx)bench-,$(bench-pthread)): $(thread-library-benchtests)
+$(addprefix $(objpfx)bench-,$(bench-malloc)): $(thread-library-benchtests)
+$(addprefix $(objpfx)bench-,pthread-locks): $(libm-benchtests)
 
 
 
@@ -270,9 +282,9 @@ bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
 
 $(bench-link-targets): %: %.o $(objpfx)json-lib.o \
 	$(link-extra-libs-tests) \
-  $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
+  $(sort $(filter $(common-objpfx)lib%,$(link-libc-benchtests))) \
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
-	$(+link-tests)
+	$(+link-benchtests)
 
 $(bench-link-targets): LDFLAGS += $(link-bench-bind-now)