xref: /netbsd-src/external/lgpl3/mpfr/dist/src/Makefile.am (revision 9fd8799cb5ceb66c69f2eb1a6d26a1d587ba1f1e)
1# Copyright 2000-2020 Free Software Foundation, Inc.
2# This Makefile.am is free software; the Free Software Foundation
3# gives unlimited permission to copy and/or distribute it,
4# with or without modifications, as long as this notice is preserved.
5
6# This program is distributed in the hope that it will be useful,
7# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
8# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
9# PARTICULAR PURPOSE.
10
11
12# Since we do not require GNU "make", let's select the POSIX behavior to
13# uniformize the behavior a bit more with various "make" implementations
14# and ease maintenance. This target should be removed only if one day,
15# we need to require GNU "make".
16.POSIX:
17
18EXTRA_DIST = round_raw_generic.c jyn_asympt.c				\
19	add1sp1_extracted.c mul_1_extracted.c sub1sp1_extracted.c	\
20	amd/mparam.h arm/mparam.h					\
21	generic/coverage/mparam.h generic/mparam.h			\
22	mips/mparam.h powerpc64/mparam.h sparc64/mparam.h		\
23	x86/mparam.h x86_64/core2/mparam.h x86_64/mparam.h
24
25include_HEADERS = mpfr.h mpf2mpfr.h
26nodist_include_HEADERS =
27
28BUILT_SOURCES = get_patches.c mparam.h
29
30lib_LTLIBRARIES = libmpfr.la
31
32libmpfr_la_SOURCES = mpfr.h mpf2mpfr.h mpfr-cvers.h mpfr-gmp.h          \
33mpfr-impl.h mpfr-intmax.h mpfr-longlong.h mpfr-sassert.h mpfr-thread.h 	\
34exceptions.c extract.c uceil_exp2.c					\
35uceil_log2.c ufloor_log2.c add.c add1.c add_ui.c agm.c clear.c cmp.c	\
36cmpabs.c cmp_si.c cmp_ui.c comparisons.c div_2exp.c div_2si.c		\
37div_2ui.c div.c div_ui.c dot.c dump.c eq.c exp10.c exp2.c exp3.c exp.c	\
38frac.c frexp.c get_d.c get_exp.c get_str.c init.c inp_str.c isinteger.c	\
39isinf.c isnan.c isnum.c const_log2.c log.c modf.c mul_2exp.c mul_2si.c	\
40mul_2ui.c mul.c mul_ui.c neg.c next.c out_str.c printf.c vasprintf.c	\
41const_pi.c pow.c pow_si.c pow_ui.c print_raw.c print_rnd_mode.c		\
42reldiff.c round_prec.c set.c setmax.c setmin.c set_d.c set_dfl_prec.c	\
43set_exp.c set_rnd.c set_f.c set_prc_raw.c set_prec.c set_q.c set_si.c	\
44set_str.c set_str_raw.c set_ui.c set_z.c sqrt.c sqrt_ui.c sub.c sub1.c	\
45sub_ui.c rint.c ui_div.c ui_sub.c urandom.c urandomb.c get_z_exp.c	\
46swap.c factorial.c cosh.c sinh.c tanh.c sinh_cosh.c acosh.c asinh.c	\
47atanh.c atan.c cmp2.c exp_2.c asin.c const_euler.c cos.c sin.c tan.c	\
48fma.c fms.c hypot.c log1p.c expm1.c log2.c log10.c ui_pow.c		\
49ui_pow_ui.c minmax.c dim.c signbit.c copysign.c setsign.c gmp_op.c	\
50init2.c acos.c sin_cos.c set_nan.c set_inf.c set_zero.c powerof2.c	\
51gamma.c set_ld.c get_ld.c cbrt.c volatile.c fits_s.h fits_sshort.c	\
52fits_sint.c fits_slong.c fits_u.h fits_ushort.c fits_uint.c		\
53fits_ulong.c fits_uintmax.c fits_intmax.c get_si.c get_ui.c zeta.c	\
54cmp_d.c erf.c inits.c inits2.c clears.c sgn.c check.c sub1sp.c		\
55version.c mpn_exp.c mpfr-gmp.c mp_clz_tab.c sum.c add1sp.c		\
56free_cache.c si_op.c cmp_ld.c set_ui_2exp.c set_si_2exp.c set_uj.c	\
57set_sj.c get_sj.c get_uj.c get_z.c iszero.c cache.c sqr.c		\
58int_ceil_log2.c isqrt.c strtofr.c pow_z.c logging.c mulders.c get_f.c	\
59round_p.c erfc.c atan2.c subnormal.c const_catalan.c root.c		\
60gen_inverse.h sec.c csc.c cot.c eint.c sech.c csch.c coth.c		\
61round_near_x.c constant.c abort_prec_max.c stack_interface.c lngamma.c	\
62zeta_ui.c set_d64.c get_d64.c jn.c yn.c rem1.c add_d.c			\
63sub_d.c d_sub.c mul_d.c div_d.c d_div.c li2.c rec_sqrt.c min_prec.c	\
64buildopt.c digamma.c bernoulli.c isregular.c set_flt.c get_flt.c	\
65scale2.c set_z_exp.c ai.c gammaonethird.c ieee_floats.h			\
66grandom.c fpif.c set_float128.c get_float128.c rndna.c nrandom.c        \
67random_deviate.h random_deviate.c erandom.c mpfr-mini-gmp.c             \
68mpfr-mini-gmp.h fmma.c log_ui.c gamma_inc.c ubf.c invert_limb.h 	\
69invsqrt_limb.h beta.c odd_p.c get_q.c pool.c total_order.c set_d128.c   \
70get_d128.c nbits_ulong.c cmpabs_ui.c
71
72nodist_libmpfr_la_SOURCES = $(BUILT_SOURCES)
73
74libmpfr_la_LIBADD = @LIBOBJS@
75
76# Libtool -version-info CURRENT[:REVISION[:AGE]] for libmpfr.la
77#
78# 1. No interfaces changed, only implementations (good):
79#    ==> Increment REVISION.
80# 2. Interfaces added, none removed (good):
81#    ==> Increment CURRENT, increment AGE, set REVISION to 0.
82# 3. Interfaces removed or changed (BAD, breaks upward compatibility):
83#    ==> Increment CURRENT, set AGE and REVISION to 0.
84#
85# For each new MPFR major-minor version, add a new line below with the
86# corresponding -version-info CURRENT and AGE. This will be checked by
87# the tools/ck-version-info script.
88#
89#         MPFR     -version-info
90#        2.1.x      -
91#        2.2.x    1:x:0
92#        2.3.x    2:x:1
93#        2.4.x    3:x:2
94#        3.0.x    4:x:0
95#        3.1.x    5:x:1
96#        4.0.x    6:x:0
97#        4.1.x    7:x:1
98libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 7:0:1
99
100GET_PATCHES_SH = $(top_srcdir)/tools/get_patches.sh
101PATCHES = $(top_srcdir)/PATCHES
102get_patches.c: $(GET_PATCHES_SH) $(PATCHES)
103	$(GET_PATCHES_SH) $(PATCHES) > $@ || { rm -f $@; exit 1; }
104
105if MINI_GMP
106
107# The mini-gmp.{c,h} files are external files, not part of MPFR, thus they
108# must not be put in the tarballs by "make dist". Hence the use of nodist_
109# on the corresponding sources (this is needed even when --with-mini-gmp
110# has not been used).
111nodist_include_HEADERS += mini-gmp.h
112
113# The noinst_ below seems OK as libminigmp should be included in libmpfr,
114# and this is confirmed by ldd (replacing noinst_ by lib_ does not seem to
115# do this and makes linking of the test programs fail).
116noinst_LTLIBRARIES = libminigmp.la
117nodist_libminigmp_la_SOURCES = mini-gmp.h mini-gmp.c
118libmpfr_la_LIBADD += libminigmp.la
119
120DISTCLEANFILES = $(nodist_libminigmp_la_SOURCES)
121
122endif
123
124# For check-gmp-symbols
125GMPC = $(top_builddir)/src/gmp.c
126GMPI = $(top_builddir)/src/gmp.i
127
128# For check-gmp-symbols and check-exported-symbols (if the library does
129# not have this name, e.g. on some platforms or when the shared library
130# is disabled, these rules do nothing).
131LIBMPFRSO = $(top_builddir)/src/.libs/libmpfr.so
132
133# Check that MPFR does not use GMP internal symbols. Of course, do not run
134# this rule if you use --with-gmp-build or --enable-gmp-internals. This
135# test does nothing if --disable-shared has been used.
136# Note: we use a temporary file $(GMPC) instead of "| $(COMPILE) -E -"
137# because the latter is not supported by all compilers (at least under
138# MS Windows).
139check-gmp-symbols: $(LTLIBRARIES)
140	if [ -f "$(LIBMPFRSO)" ]; then \
141	  printf "#include <%s.h>\n" stdarg stdio gmp > $(GMPC) && \
142	  $(COMPILE) -E $(GMPC) > $(GMPI) || exit 1; \
143	  internals=`$(NM) -u "$(LIBMPFRSO)" | \
144	    $(SED) -n 's/^ *U \(__gmp.*\)/\1/p' | \
145	    while read s; \
146	    do \
147	      $(GREP) -q "$$s[ (;]" $(GMPI) || echo "$$s"; \
148	    done`; \
149	  if [ -n "$$internals" ]; then \
150	    echo "Internal GMP symbols:" $$internals; \
151	    exit 1; \
152	  fi; \
153	  rm $(GMPC) $(GMPI); \
154	fi
155
156# Check that MPFR does not define symbols with a GMP reserved prefix.
157# For instance, with r11968, and
158#   ./configure --with-gmp-build=... CC=tcc
159# the symbol __gmpn_clz_tab is defined, which is wrong.
160# Note: the "$(GREP) -v '@plt$$'" below is for tcc.
161check-exported-symbols: $(LTLIBRARIES)
162	if [ -f "$(LIBMPFRSO)" ]; then \
163	  gsymbols=`$(NM) -gP "$(LIBMPFRSO)" | perl -ne \
164	    '/^(__gmp[a-z]?_[_0-9A-Za-z]*) +[A-TV-Z]/ and print " $$1"' | \
165	    { $(GREP) -v '@plt$$' || true ; }`; \
166	  if [ -n "$$gsymbols" ]; then \
167	    echo "MPFR defines symbols with a GMP reserved prefix:$$gsymbols"; \
168	    exit 1; \
169	  fi; \
170	fi
171
172CLEANFILES = get_patches.c $(GMPC) $(GMPI)
173
174.PHONY: check-gmp-symbols check-exported-symbols
175