1## Process this file with automake to generate Makefile.in 2 3# Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 4# 2010, 2011 Free Software Foundation, Inc. 5# 6# This file is part of the GNU MP Library. 7# 8# The GNU MP Library is free software; you can redistribute it and/or modify 9# it under the terms of the GNU Lesser General Public License as published by 10# the Free Software Foundation; either version 3 of the License, or (at your 11# option) any later version. 12# 13# The GNU MP Library is distributed in the hope that it will be useful, but 14# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 15# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 16# License for more details. 17# 18# You should have received a copy of the GNU Lesser General Public License 19# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21 22AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests 23 24EXTRA_DIST = alpha.asm pentium.asm sparcv9.asm hppa.asm hppa2.asm hppa2w.asm \ 25 ia64.asm powerpc.asm powerpc64.asm x86_64.as many.pl 26noinst_HEADERS = speed.h 27 28# Prefer -static on the speed and tune programs, since that can avoid 29# overheads of shared library linkages on some systems. Libtool tends to 30# botch -static if configured with --disable-static, perhaps reasonably 31# enough. In any event under --disable-static the only choice is a dynamic 32# link so there's no point in -static. 33# 34if ENABLE_STATIC 35STATIC = -static 36else 37STATIC = 38endif 39 40 41EXTRA_LTLIBRARIES = libspeed.la 42 43libspeed_la_SOURCES = \ 44 common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.c \ 45 freq.c \ 46 gcdext_single.c gcdext_double.c gcdextod.c gcdextos.c \ 47 hgcd_lehmer.c hgcd_appr_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c \ 48 jacbase1.c jacbase2.c jacbase3.c jacbase4.c \ 49 mod_1_div.c mod_1_inv.c modlinv.c \ 50 noop.c powm_mod.c powm_redc.c preinv_divrem_1.c \ 51 fac_ui_large.c fac_ui_small.c \ 52 set_strb.c set_strs.c set_strp.c time.c 53 54libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJ) \ 55 $(top_builddir)/tests/libtests.la $(top_builddir)/libmpir.la 56libspeed_la_LIBADD = $(libspeed_la_DEPENDENCIES) $(LIBM) 57libspeed_la_LDFLAGS = $(STATIC) 58 59$(top_builddir)/tests/libtests.la: 60 cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la 61 62 63# The library code is faster static than shared on some systems, so do 64# tuning and measuring with static, since users who care about maximizing 65# speed will be using that. speed-dynamic exists to show the difference. 66# 67# On Solaris 8, gcc 2.95.2 -static is somehow broken (it creates executables 68# that immediately seg fault), so -all-static is not used. The only thing 69# -all-static does is make libc static linked as well as libmpir, and that 70# makes a difference only when measuring malloc and friends in the speed 71# program. This can always be forced with "make speed_LDFLAGS=-all-static 72# ..." if desired, see tune/README. 73 74EXTRA_PROGRAMS = speed speed-dynamic speed-ext tuneup 75 76DEPENDENCIES = libspeed.la 77LDADD = $(DEPENDENCIES) 78 79speed_SOURCES = speed.c 80speed_LDFLAGS = $(STATIC) 81 82speed_dynamic_SOURCES = speed.c 83 84speed_ext_SOURCES = speed-ext.c 85speed_ext_LDFLAGS = $(STATIC) 86 87tuneup_SOURCES = tuneup.c 88nodist_tuneup_SOURCES = sqr_basecase.c fac_ui.c $(TUNE_MPN_SRCS) 89tuneup_DEPENDENCIES = $(TUNE_SQR_OBJ) libspeed.la 90tuneup_LDADD = $(tuneup_DEPENDENCIES) 91tuneup_LDFLAGS = $(STATIC) 92 93 94tune: 95 $(MAKE) $(AM_MAKEFLAGS) tuneup$(EXEEXT) 96 ./tuneup 97 98allprogs: $(EXTRA_PROGRAMS) 99 100# $(MANY_CLEAN) and $(MANY_DISTCLEAN) are hooks for many.pl 101CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \ 102 $(TUNE_MPN_SRCS) sqr_asm.asm \ 103 stg.gnuplot stg.data \ 104 mtg.gnuplot mtg.data \ 105 fibg.gnuplot fibg.data \ 106 graph.gnuplot graph.data \ 107 $(MANY_CLEAN) 108DISTCLEANFILES = sqr_basecase.c fac_ui.c $(MANY_DISTCLEAN) 109 110 111# Generating these little files at build time seems better than including 112# them in the distribution, since the list can be changed more easily. 113# 114# mpn/generic/tdiv_qr.c uses mpn_divrem_1 and mpn_divrem_2, but only for 1 115# and 2 limb divisors, which are never used during tuning, so it doesn't 116# matter whether it picks up a tuned or untuned version of those. 117# 118# divrem_1 and mod_1 are recompiled renamed to "_tune" to avoid a linking 119# problem. If a native divrem_1 provides an mpn_divrem_1c entrypoint then 120# common.c will want that, but the generic divrem_1 doesn't provide it, 121# likewise for mod_1. The simplest way around this is to have the tune 122# build versions renamed suitably. 123# 124# FIXME: Would like say mul_n.c to depend on $(top_builddir)/mul_n.c so the 125# recompiled object will be rebuilt if that file changes. 126 127TUNE_MPN_SRCS = $(TUNE_MPN_SRCS_BASIC) $(TUNE_FFT_SRCS_BASIC) divrem_1.c mod_1.c 128TUNE_MPN_SRCS_BASIC = divrem_2.c gcd.c gcdext.c get_str.c set_str.c \ 129 matrix22_mul.c hgcd.c hgcd_appr.c hgcd_reduce.c \ 130 mul_n.c mullow_n.c mulhigh_n.c mul.c tdiv_qr.c \ 131 mulmid.c mulmid_n.c toom42_mulmid.c \ 132 toom4_mul_n.c toom4_mul.c toom3_mul.c toom3_mul_n.c \ 133 toom8h_mul.c toom8_sqr_n.c mulmod_2expm1.c mulmod_2expp1_basecase.c \ 134 rootrem.c divrem_euclidean_r_1.c \ 135 divrem_hensel_qr_1.c rsh_divrem_hensel_qr_1.c sb_divappr_q.c sb_div_qr.c \ 136 dc_divappr_q.c dc_div_qr.c dc_div_qr_n.c \ 137 inv_divappr_q.c inv_div_qr.c tdiv_q.c dc_bdiv_qr.c dc_bdiv_qr_n.c dc_bdiv_q.c 138TUNE_FFT_SRCS_BASIC = split_bits.c revbin.c normmod_2expp1.c mulmod_2expp1.c \ 139 mul_trunc_sqrt2.c mul_mfa_trunc_sqrt2.c mul_fft_main.c \ 140 mul_2expmod_2expp1.c ifft_trunc_sqrt2.c ifft_trunc.c ifft_radix2.c \ 141 ifft_negacyclic.c fft_trunc.c fft_radix2.c fft_negacyclic.c \ 142 fft_mfa_trunc_sqrt2.c fft_mfa_trunc_sqrt2_inner.c fermat_to_mpz.c \ 143 div_2expmod_2expp1.c combine_bits.c butterfly_rshB.c butterfly_lshB.c \ 144 adjust_sqrt2.c adjust.c 145 146$(TUNE_MPN_SRCS_BASIC): 147 for i in $(TUNE_MPN_SRCS_BASIC); do \ 148 echo "#define TUNE_PROGRAM_BUILD 1" >$$i; \ 149 echo "#include \"mpn/generic/$$i\"" >>$$i; \ 150 done 151 152$(TUNE_FFT_SRCS_BASIC): 153 for i in $(TUNE_FFT_SRCS_BASIC); do \ 154 echo "#define TUNE_PROGRAM_BUILD 1" >$$i; \ 155 echo "#include \"fft/$$i\"" >>$$i; \ 156 done 157 158divrem_1.c: 159 echo "#define TUNE_PROGRAM_BUILD 1" >divrem_1.c 160 echo "#define __gmpn_divrem_1 mpn_divrem_1_tune" >>divrem_1.c 161 echo "#include \"mpn/generic/divrem_1.c\"" >>divrem_1.c 162 163mod_1.c: 164 echo "#define TUNE_PROGRAM_BUILD 1" >mod_1.c 165 echo "#define __gmpn_mod_1 mpn_mod_1_tune" >>mod_1.c 166 echo "#include \"mpn/generic/mod_1.c\"" >>mod_1.c 167 168sqr_asm.asm: $(top_builddir)/mpn/sqr_basecase.asm 169 echo 'define(SQR_KARATSUBA_THRESHOLD_OVERRIDE,SQR_KARATSUBA_THRESHOLD_MAX)' >sqr_asm.asm 170 echo 'include(../mpn/sqr_basecase.asm)' >>sqr_asm.asm 171 172# FIXME: Should it depend on $(top_builddir)/fac_ui.h too? 173fac_ui.c: $(top_builddir)/mpz/fac_ui.c 174 echo "#define TUNE_PROGRAM_BUILD 1" >fac_ui.c 175 echo "#define __gmpz_fac_ui mpz_fac_ui_tune" >>fac_ui.c 176 echo "#define __gmpz_oddfac_1 mpz_oddfac_1_tune" >>fac_ui.c 177 echo "#include \"mpz/oddfac_1.c\"" >>fac_ui.c 178 echo "#include \"mpz/fac_ui.c\"" >>fac_ui.c 179 180include ../mpn/Makeasm.am 181