aboutsummaryrefslogtreecommitdiff
path: root/math/Makefile
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-08-09 15:34:12 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-08-09 15:34:12 +0000
commit2813e41e9049ccd0c75edc19c4fdefb21213b495 (patch)
tree1b60b7cd3434f9756b373963c5e249230bf3b7da /math/Makefile
parent8ac0f9e6f742dba698dc2ae0461f76a4b46a7971 (diff)
downloadglibc-2813e41e9049ccd0c75edc19c4fdefb21213b495.zip
glibc-2813e41e9049ccd0c75edc19c4fdefb21213b495.tar.gz
glibc-2813e41e9049ccd0c75edc19c4fdefb21213b495.tar.bz2
Replace gen-libm-test.pl with gen-libm-test.py.
Following the recent discussion of using Python instead of Perl and Awk for glibc build / test, this patch replaces gen-libm-test.pl with a new gen-libm-test.py script. This script should work with all Python versions supported by glibc (tested by hand with Python 2.7, tested in the build system with Python 3.5; configure prefers Python 3 if available). This script is designed to give identical output to gen-libm-test.pl for ease of verification of the change, except for generated comments referring to .py instead of .pl. (That is, identical for actual inputs passed to the script, not necessarily for all possible input; for example, this version more precisely follows the C standard syntax for floating-point constants when deciding when to add LIT macro calls.) In one place a comment notes that the generation of NON_FINITE flags is replicating a bug in the Perl script to assist in such comparisons (with the expectation that this bug can then be separately fixed in the Python script later). Tested for x86_64, including comparison of generated files (and hand testing of the case of generating a sorted libm-test-ulps file, which isn't covered by normal "make check"). I'd expect to follow this up by extending the new script to produce the ulps tables for the manual as well (replacing manual/libm-err-tab.pl, so that then we just have one ulps file parser) - at which point the manual build would depend on both Perl and Python (eliminating the Perl dependency would require someone to rewrite summary.pl in Python, and that would only eliminate the *direct* Perl dependency; current makeinfo is written in Perl so there would still be an indirect dependency). I think install.texi is more or less equally out-of-date regarding Perl and Python uses before and after this patch, so I don't think this patch depends on my patch <https://sourceware.org/ml/libc-alpha/2018-08/msg00133.html> to update install.texi regarding such uses (pending review). * math/gen-libm-test.py: New file. * math/gen-libm-test.pl: Remove. * math/Makefile [$(PERL) != no]: Change condition to [PYTHON]. ($(objpfx)libm-test-ulps.h): Use gen-libm-test.py instead of gen-libm-test.pl. ($(libm-test-c-noauto-obj)): Likewise. ($(libm-test-c-auto-obj)): Likewise. ($(libm-test-c-narrow-obj)): Likewise. (regen-ulps): Likewise. * math/README.libm-test: Update references to gen-libm-test.pl. * math/libm-test-driver.c (struct test_fj_f_data): Update comment referencing gen-libm-test.pl. * math/libm-test-nexttoward.inc (nexttoward_test_data): Likewise. * math/libm-test-support.c: Likewise. * math/libm-test-support.h: Likewise. * sysdeps/generic/libm-test-ulps: Likewise.
Diffstat (limited to 'math/Makefile')
-rw-r--r--math/Makefile26
1 files changed, 13 insertions, 13 deletions
diff --git a/math/Makefile b/math/Makefile
index 90b3b68..d78f40f 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -252,7 +252,7 @@ tests += test-math-isinff test-math-iszero test-math-issignaling \
test-math-iscanonical test-math-cxx11 test-math-iseqsig
endif
-ifneq (no,$(PERL))
+ifdef PYTHON
libm-vec-tests = $(addprefix test-,$(libmvec-tests))
libm-test-support = $(foreach t,$(test-types),libm-test-support-$(t))
test-extras += $(libm-test-support)
@@ -263,9 +263,9 @@ extra-test-objs += $(addsuffix .o, $(libm-vec-test-wrappers))
ulps-file = $(firstword $(wildcard $(sysdirs:%=%/libm-test-ulps)))
-$(objpfx)libm-test-ulps.h: $(ulps-file) gen-libm-test.pl
+$(objpfx)libm-test-ulps.h: $(ulps-file) gen-libm-test.py
$(make-target-directory)
- $(PERL) gen-libm-test.pl -u $< -H $@
+ $(PYTHON) gen-libm-test.py -u $< -H $@
libm-test-funcs-auto = acos acosh asin asinh atan atan2 atanh cabs cacos \
cacosh carg casin casinh catan catanh cbrt ccos ccosh \
@@ -333,21 +333,21 @@ libm-test-c-noauto-obj = $(addprefix $(objpfx),$(libm-test-c-noauto))
libm-test-c-narrow-obj = $(addprefix $(objpfx),$(libm-test-c-narrow))
$(libm-test-c-noauto-obj): $(objpfx)libm-test%.c: libm-test%.inc \
- gen-libm-test.pl
+ gen-libm-test.py
$(make-target-directory)
- $(PERL) gen-libm-test.pl -c $< -a /dev/null -C $@
+ $(PYTHON) gen-libm-test.py -c $< -a /dev/null -C $@
$(libm-test-c-auto-obj): $(objpfx)libm-test%.c: libm-test%.inc \
- gen-libm-test.pl \
+ gen-libm-test.py \
auto-libm-test-out%
$(make-target-directory)
- $(PERL) gen-libm-test.pl -c $< -a auto-libm-test-out$* -C $@
+ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
$(libm-test-c-narrow-obj): $(objpfx)libm-test%.c: libm-test%.inc \
- gen-libm-test.pl \
+ gen-libm-test.py \
auto-libm-test-out%
$(make-target-directory)
- $(PERL) gen-libm-test.pl -c $< -a auto-libm-test-out$* -C $@
+ $(PYTHON) gen-libm-test.py -c $< -a auto-libm-test-out$* -C $@
endif
ifdef PYTHON
@@ -473,7 +473,7 @@ $(objpfx)gen-libm-templates.stmp: Makefile
$(foreach t, $(call type-foreach, $(gen-all-calls)), \
$(objpfx)$(t).c): $(objpfx)gen-libm-templates.stmp
-ifneq (no,$(PERL))
+ifdef PYTHON
# This must come after the inclusion of sysdeps Makefiles via Rules.
$(foreach t,$(libm-tests-normal),$(objpfx)$(t).c): $(objpfx)test-%.c:
@@ -628,15 +628,15 @@ regen-ulps: $(addprefix $(objpfx),$(libm-tests))
cat $(objpfx)ULPs >> $(objpfx)libm-test-ulps; \
rm $(objpfx)ULPs; \
done; \
- $(PERL) gen-libm-test.pl -n $(objpfx)NewUlps \
- -u $(objpfx)libm-test-ulps; \
+ $(PYTHON) gen-libm-test.py -n $(objpfx)NewUlps \
+ -u $(objpfx)libm-test-ulps; \
echo "Automatic regeneration of ULPs complete."; \
echo "Difference between the current baseline and the new baseline is:";\
diff -urN $(ulps-file) $(objpfx)NewUlps; \
echo "Copy $(objpfx)NewUlps to $(ulps-file) (relative to source)."
else
regen-ulps:
- @echo "Automatic regeneration of ULPs requires perl."; \
+ @echo "Automatic regeneration of ULPs requires python."; \
exit 1;
endif