1# Copyright 2000-2023 Free Software Foundation, Inc. 2# Contributed by the AriC and Caramba projects, INRIA. 3 4# This file is part of the GNU MPFR Library. 5 6# This Makefile.am is free software; the Free Software Foundation 7# gives unlimited permission to copy and/or distribute it, 8# with or without modifications, as long as this notice is preserved. 9 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY, to the extent permitted by law; without 12# even the implied warranty of MERCHANTABILITY or FITNESS FOR A 13# PARTICULAR PURPOSE. 14 15 16# The ".POSIX" line is needed in particular for GNU "make", so that 17# recipes are invoked as if the shell had been passed the -e flag. 18# But note that since GNU Automake adds non-comment lines before it 19# in its generated Makefile, this does not ensure POSIX behavior with 20# other "make" implementations. 21.POSIX: 22 23AUTOMAKE_OPTIONS = 1.6 gnu 24 25# For Git: 26# * To avoid escaping the MPFR source tree, we check whether 27# $(top_srcdir)/.git is readable (note that this is not 28# necessarily a directory: in case of a "linked worktree", 29# this is a file; see the git-worktree(1) man page). 30# In particular, if one extracts an MPFR tarball within a 31# Git working tree (e.g. after "make dist"), then running 32# "make check" in this extracted source tree will work as 33# expected, giving correct version information. 34# * Additional test with "git rev-parse ...", which should 35# silently fail if git is not installed. 36# * See version-ext.sh for information on its output. 37output_info = { \ 38 if [ -d $(top_srcdir)/.svn ]; then \ 39 output=`svnversion $(top_srcdir) 2> /dev/null`; \ 40 if [ -n "$$output" ]; then \ 41 echo "[svnversion] $$output"; \ 42 fi; \ 43 fi; \ 44 if [ -r $(top_srcdir)/.git ] && \ 45 [ "x`git rev-parse --is-inside-work-tree 2> /dev/null`" = xtrue ]; then \ 46 gitv=`GREP=$(GREP) SED=$(SED) $(top_srcdir)/version-ext.sh`; \ 47 echo "[git] $$gitv"; \ 48 fi; \ 49 $(GREP) -v '^\(PASS\|FAIL\) ' tversion.log 2> /dev/null || true; \ 50} 51 52TESTS_NO_TVERSION = tabort_prec_max tassert tabort_defalloc1 \ 53 tabort_defalloc2 talloc tinternals tinits tisqrt tsgn tcheck \ 54 tisnan texceptions tset_exp tset mpf_compat mpfr_compat reuse \ 55 tabs tacos tacosh tacosu tadd tadd1sp tadd_d tadd_ui tagm tai \ 56 talloc-cache tasin tasinh tasinu tatan tatanh tatanu tatan2u taway \ 57 tbeta tbuildopt tcan_round tcbrt tcmp tcmp2 tcmp_d tcmp_ld tcmp_ui \ 58 tcmpabs tcomparisons tcompound tconst_catalan tconst_euler \ 59 tconst_log2 tconst_pi \ 60 tcopysign tcos tcosh tcosu tcot tcoth tcsc tcsch td_div td_sub \ 61 tdigamma tdim tdiv tdiv_d tdiv_ui tdot teint teq terandom \ 62 terandom_chisq terf texp texp10 texp2 texpm1 texp10m1 texp2m1 \ 63 tfactorial tfits tfma tfmma tfmod tfms tfpif tfprintf tfrac tfrexp \ 64 tgamma tgamma_inc tget_d tget_d_2exp tget_f tget_flt tget_ld_2exp \ 65 tget_q tget_set_d64 tget_set_d128 tget_sj tget_str tget_z tgmpop \ 66 tgrandom thyperbolic thypot tinp_str \ 67 tj0 tj1 tjn tl2b tlgamma tli2 tlngamma tlog tlog10 tlog10p1 tlog1p \ 68 tlog2 tlog2p1 \ 69 tlog_ui tmin_prec tminmax tmodf tmul tmul_2exp tmul_d tmul_ui \ 70 tnext tnrandom tnrandom_chisq tout_str toutimpl tpow tpow3 tpowr \ 71 tpow_all tpow_z tprec_round tprintf trandom trandom_deviate \ 72 trec_sqrt tremquo trint trndna troot trootn_si trootn_ui \ 73 tsec tsech tset_d tset_f tset_float128 tset_ld tset_q \ 74 tset_si tset_sj tset_str tset_z tset_z_2exp tsi_op tsin tsin_cos \ 75 tsinh tsinh_cosh tsinu tsprintf tsqr tsqrt tsqrt_ui tstckintc \ 76 tstdint tstrtofr tsub tsub1sp tsub_d tsub_ui tsubnormal tsum tswap \ 77 ttan ttanh ttanu ttotal_order ttrunc tui_div tui_pow tui_sub \ 78 turandom tvalist ty0 ty1 tyn tzeta tzeta_ui 79 80check_PROGRAMS = tversion $(TESTS_NO_TVERSION) 81 82LOGS_NO_TVERSION = $(TESTS_NO_TVERSION:%=%.log) 83 84# Before Automake 1.13, we ran tversion at the beginning and at the end 85# of the tests, and output from tversion appeared at the same place as 86# the tests results (make output). With Automake 1.13+, the tests are 87# parallelized by default and their output is sent to log files instead 88# of the make output, so that the user could no longer see information 89# from tversion. To mimic the old behavior, we now run tversion at the 90# beginning and output the contents. Also output the contents after the 91# tests, but when a test fails, they will not be shown. 92tversion_special: tversion.log 93 @$(output_info) 94$(LOGS_NO_TVERSION): tversion_special 95check: 96 @$(output_info) 97 98AM_CPPFLAGS = -DSRCDIR='"$(srcdir)"' 99 100EXTRA_DIST = tgeneric.c tgeneric_ui.c mpf_compat.h inp_str.dat tmul.dat \ 101 tfpif_r1.dat tfpif_r2.dat 102 103CLEANFILES = tfpif_rw.dat tfprintf_out.txt tout_str_out.txt toutimpl_out.txt tprintf_out.txt 104 105LDADD = libfrtests.la $(MPFR_LIBM) $(MPFR_LIBQUADMATH) $(top_builddir)/src/libmpfr.la 106AM_CPPFLAGS += -I$(top_srcdir)/src -I$(top_builddir)/src 107 108# LOADLIBES (documented in the "GNU make" manual and equivalent to LDLIBS) 109# enables to compile a program foo.c in the test directory by simply doing 110# "make foo". 111# Warning! This is not guaranteed to work, as libtool is not used. In 112# particular, this may not work as expected under GNU/Linux if --with-gmp 113# has been used, unless the directory is in your $LD_LIBRARY_PATH. 114# Moreover, dependencies are not tracked. Thus you may want to run 115# "make tversion" (for instance) just before, to make sure that every 116# dependency has been rebuilt. 117LOADLIBES=$(DEFS) $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(top_builddir)/tests/.libs/libfrtests.a $(top_builddir)/src/.libs/libmpfr.a $(LIBS) $(MPFR_LIBM) 118 119check_LTLIBRARIES = libfrtests.la 120libfrtests_la_SOURCES = mpfr-test.h memory.c rnd_mode.c tests.c cmp_str.c random2.c 121 122$(top_builddir)/src/libmpfr.la: 123 cd $(top_builddir)/src && $(MAKE) $(AM_MAKEFLAGS) libmpfr.la 124 125TESTS = $(check_PROGRAMS) 126 127# Set DISPLAY='' as it is not needed and it can yield error messages when 128# running the tests with LOG_COMPILER=wine (for builds with MinGW). See: 129# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914822 130# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914949 131# $(VALGRIND) is still there to be able to use a wrapper such as valgrind 132# in case old Automake. With Automake 1.13+, where a parallel test harness 133# is generated, use LOG_COMPILER instead. For additional information, see: 134# https://www.gnu.org/software/automake/manual/automake.html#Parallel-Test-Harness 135# 136# Note: We do not use "env -u DISPLAY" as the -u option is a GNU extension 137# and not supported by NetBSD. Setting DISPLAY='' is not equivalent, but 138# it also avoids the bogus "Invalid MIT-MAGIC-COOKIE-1 key" error message 139# that can make the parsing of the output fail. 140TESTS_ENVIRONMENT = env DISPLAY='' MPFR_QUIET=1 $(VALGRIND) 141 142# The -no-install option prevents libtool from generating wrapper scripts 143# for the tests. 144# This is useful to easily run individual test scripts under valgrind or gdb. 145# See discussion 146# https://lists.gnu.org/archive/html/bug-gnulib/2011-08/msg00247.html 147# and 148# https://lists.gnu.org/archive/html/bug-gnulib/2011-09/msg00081.html 149# in particular. 150# 151# The -L$(top_builddir)/src/.libs option is necessary for some platforms, 152# such as HP-UX, when --with-gmp or --with-gmp-lib is used and an old MPFR 153# library is already installed in the corresponding lib directory: its 154# purpose is to make sure that the local .libs comes first in the library 155# search path (otherwise the tests are linked against the old MPFR library 156# by the LINK command -- see the generated Makefile). See: 157# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00042.html 158# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00043.html 159# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00044.html 160# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00066.html 161# https://sympa.inria.fr/sympa/arc/mpfr/2011-10/msg00065.html 162# and 163# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=9728 164# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=18662 165# 166AM_LDFLAGS = -no-install -L$(top_builddir)/src/.libs 167 168.PHONY: tversion_special 169