glibc/Makefile.in
H.J. Lu b79f257533 Add TEST_CC and TEST_CXX support
Support testing glibc build with a different C compiler or a different
C++ compiler with

$ ../glibc-VERSION/configure TEST_CC="gcc-6.4.1" TEST_CXX="g++-6.4.1"

1. Add LIBC_TRY_CC_AND_TEST_CC_OPTION, LIBC_TRY_CC_AND_TEST_CC_COMMAND
and LIBC_TRY_CC_AND_TEST_LINK to test both CC and TEST_CC.
2. Add check and xcheck targets to Makefile.in and override build compiler
options with ones from TEST_CC and TEST_CXX.

Tested on Fedora 41/x86-64:

1. Building with GCC 14.2.1 and testing with GCC 6.4.1 and GCC 11.2.1.
2. Building with GCC 15 and testing with GCC 6.4.1.

Support for GCC versions older than GCC 6.2 may need to change the test
sources.  Other targets may need to update configure.ac under sysdeps and
modify Makefile.in to override target build compiler options.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
2024-12-11 18:31:00 +08:00

47 lines
1.8 KiB
Makefile

srcdir = @srcdir@
TEST_CC = @TEST_CC@
TEST_CXX = @TEST_CXX@
test-cc-option-wimplicit-fallthrough = @libc_cv_test_cc_wimplicit_fallthrough@
test-config-cflags-mprefer-vector-width = @libc_cv_test_cc_mprefer_vector_width@
test-config-cflags-signaling-nans = @libc_cv_test_cc_signaling_nans@
test-config-cflags-wno-ignored-attributes = @libc_cv_test_wno_ignored_attributes@
test-enable-cet = @test_enable_cet@
test-have-mamx-tile = @libc_cv_test_x86_have_amx_tile@
test-have-mtls-descriptor = @libc_cv_test_mtls_descriptor@
test-have-static-pie = @libc_cv_test_static_pie@
test-supported-fortify = @libc_cv_test_supported_fortify_source@
# Uncomment the line below if you want to do parallel build.
# PARALLELMFLAGS = -j 4
.PHONY: all install bench
all .DEFAULT:
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
check xcheck:
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) \
CC="$(TEST_CC)" CXX="$(TEST_CXX)" \
cc-option-wimplicit-fallthrough="$(test-cc-option-wimplicit-fallthrough)" \
config-cflags-mprefer-vector-width="$(test-config-cflags-mprefer-vector-width)" \
config-cflags-signaling-nans="$(test-config-cflags-signaling-nans)" \
config-cflags-wno-ignored-attributes="$(test-config-cflags-wno-ignored-attributes)" \
enable-cet="$(test-enable-cet)" \
have-mamx-tile="$(test-have-mamx-tile)" \
have-mtls-descriptor="$(test-have-mtls-descriptor)" \
have-static-pie="$(test-have-static-pie)" \
supported-fortify="$(test-supported-fortify)" \
objdir=`pwd` $@
install:
LC_ALL=C; export LC_ALL; \
$(MAKE) -r PARALLELMFLAGS="$(PARALLELMFLAGS)" -C $(srcdir) objdir=`pwd` $@
bench bench-clean bench-build:
$(MAKE) -C $(srcdir)/benchtests $(PARALLELMFLAGS) objdir=`pwd` $@
# Convenience target to rebuild ULPs for all math tests.
regen-ulps:
$(MAKE) -C $(srcdir)/math $(PARALLELMFLAGS) objdir=`pwd` $@