summary refs log tree commit diff
path: root/benchtests/Makefile
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <sid@reserved-bit.com>2016-04-20 13:19:01 +0530
committerSiddhesh Poyarekar <sid@reserved-bit.com>2016-04-20 13:19:01 +0530
commit2d304f3c6f5c34b4dd34c7ab0663d93adec14c26 (patch)
tree70d1819bbf55ad7353ea296fc354fd0b48e06385 /benchtests/Makefile
parentd7aea0cf06a469dac56aee445ba089d61795fbdc (diff)
downloadglibc-2d304f3c6f5c34b4dd34c7ab0663d93adec14c26.tar.gz
glibc-2d304f3c6f5c34b4dd34c7ab0663d93adec14c26.tar.xz
glibc-2d304f3c6f5c34b4dd34c7ab0663d93adec14c26.zip
benchtests: Support for cross-building benchmarks
This patch adds full support for cross-building benchmarks.  Some
benchmarks like those that need locales to be generated cannot be
built and are hence skipped for cross builds.

Tested by cross building for aarch64 on x86_64 and then running the
generated benchmark on aarch64.

	* benchtests/Makefile (wcsmbs-benchset): Include only for
	native builds and runs.
	(LOCALES): Likewise.
	(bench-build): Build timing-type here instead of the bench
	target.  Generate locale only for native builds.
	* benchtests/README: Add note for cross-building.
Diffstat (limited to 'benchtests/Makefile')
-rw-r--r--benchtests/Makefile23
1 files changed, 19 insertions, 4 deletions
diff --git a/benchtests/Makefile b/benchtests/Makefile
index 779eb395d5..144b32ea38 100644
--- a/benchtests/Makefile
+++ b/benchtests/Makefile
@@ -39,11 +39,19 @@ string-benchset := bcopy bzero memccpy memchr memcmp memcpy memmem memmove \
 		   strncasecmp strncat strncmp strncpy strnlen strpbrk strrchr \
 		   strspn strstr strcpy_chk stpcpy_chk memrchr strsep strtok \
 		   strcoll memcpy-large memmove-large memset-large
+
+# Build and run locale-dependent benchmarks only if we're building natively.
+ifeq (no,$(cross-compiling))
 wcsmbs-benchset := wcslen wcsnlen wcscpy wcpcpy wcsncpy wcpncpy wcscat wcsncat \
 		   wcscmp wcsncmp wcschr wcschrnul wcsrchr wcsspn wcspbrk wcscspn \
 		   wmemchr wmemset wmemcmp
+else
+wcsmbs-benchset :=
+endif
+
 string-benchset-all := $(string-benchset) ${wcsmbs-benchset}
 
+ifeq (no,$(cross-compiling))
 # We have to generate locales
 LOCALES := en_US.UTF-8 tr_TR.UTF-8 cs_CZ.UTF-8 fa_IR.UTF-8 fr_FR.UTF-8 \
 	   ja_JP.UTF-8 si_LK.UTF-8 en_GB.UTF-8 vi_VN.UTF-8 ar_SA.UTF-8 \
@@ -51,6 +59,7 @@ LOCALES := en_US.UTF-8 tr_TR.UTF-8 cs_CZ.UTF-8 fa_IR.UTF-8 fr_FR.UTF-8 \
 	   he_IL.UTF-8 is_IS.UTF-8 es_ES.UTF-8 hi_IN.UTF-8 sv_SE.UTF-8 \
 	   hu_HU.UTF-8 it_IT.UTF-8 sr_RS.UTF-8 zh_CN.UTF-8
 include ../gen-locales.mk
+endif
 
 stdlib-benchset := strtod
 
@@ -131,10 +140,16 @@ bench-clean:
 	rm -f $(timing-type) $(addsuffix .o,$(timing-type))
 	rm -f $(addprefix $(objpfx),$(bench-extra-objs))
 
-bench: $(timing-type) $(gen-locales) bench-build bench-set bench-func \
-	bench-malloc
-# Target to only build the benchmark without running it.
-bench-build: $(binaries-bench) $(binaries-benchset) $(binaries-bench-malloc)
+bench: bench-build bench-set bench-func bench-malloc
+# Target to only build the benchmark without running it.  We generate locales
+# only if we're building natively.
+ifeq (no,$(cross-compiling))
+bench-build: $(gen-locales) $(timing-type) $(binaries-bench) \
+	$(binaries-benchset) $(binaries-bench-malloc)
+else
+bench-build: $(timing-type) $(binaries-bench) $(binaries-benchset) \
+	$(binaries-bench-malloc)
+endif
 
 bench-set: $(binaries-benchset)
 	for run in $^; do \