# vlibc — benchmark harnesses (musts/BENCHMARKING.md). # Build-dir include FIRST (generated features.h lives there in VPATH builds). AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include AM_CFLAGS = @VLIBC_CFLAGS@ # Built only on demand (via `make bench`), so `make all` does not need the # library to be built first. EXTRA_PROGRAMS = bench_vlibc bench_string bench_vlibc_SOURCES = bench_vlibc.c bench_string_SOURCES = bench_string.c # bench_string is a system-headers-only translation unit (it times whichever # libc it is linked against), so it must NOT inherit AM_CPPFLAGS: -I include # would pull vlibc's self-contained / into the same TU as # the system / and double-define size_t/NULL/offsetof. # bench_vlibc keeps the inherited -I include. bench_string_CPPFLAGS = # By default benchmarks link against vlibc itself. --with-libc=glibc links the # same harness against the system glibc; --with-libc=musl builds it with # musl-gcc for the musl reference. if BENCH_LINK_VLIBC bench_vlibc_LDADD = ../libvlibc.la bench_string_LDADD = ../libvlibc.la else bench_vlibc_LDADD = bench_string_LDADD = endif if BENCH_LINK_MUSL CC = $(MUSL_CC) endif # Relink whenever the configuration changes (autogen.sh reruns configure and # rewrites config.status). --with-libc only affects the link (LDADD), and the # objects are compile-time identical, so make would otherwise reuse a stale # binary from the previous configuration and the wrong libc would be measured. EXTRA_bench_string_DEPENDENCIES = $(top_builddir)/config.status EXTRA_bench_vlibc_DEPENDENCIES = $(top_builddir)/config.status # bench_vlibc.c calls vlibc_version(), which exists only in vlibc — under # --with-libc=glibc/musl it cannot link, so it is built and run only in the # vlibc build. bench_string links either way and runs always. if BENCH_LINK_VLIBC bench: bench_vlibc bench_string ./bench_vlibc ./bench_string else bench: bench_string ./bench_string endif .PHONY: bench