1 ## Process this file with automake to generate Makefile.in
3 # Copyright 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009,
4 # 2010, 2011 Free Software Foundation, Inc.
6 # This file is part of the GNU MP Library.
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.
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.
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/.
22 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
24 EXTRA_DIST = alpha.asm pentium.asm sparcv9.asm hppa.asm hppa2.asm hppa2w.asm \
25 ia64.asm powerpc.asm powerpc64.asm x86_64.asm many.pl
26 noinst_HEADERS = speed.h
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.
41 EXTRA_LTLIBRARIES = libspeed.la
43 libspeed_la_SOURCES = \
44 common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.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 mod_1_1-1.c mod_1_1-2.c modlinv.c \
50 noop.c powm_mod.c powm_redc.c pre_divrem_1.c \
51 set_strb.c set_strs.c set_strp.c time.c
53 libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJ) \
54 $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
55 libspeed_la_LIBADD = $(libspeed_la_DEPENDENCIES) $(LIBM)
56 libspeed_la_LDFLAGS = $(STATIC)
58 $(top_builddir)/tests/libtests.la:
59 cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
62 # The library code is faster static than shared on some systems, so do
63 # tuning and measuring with static, since users who care about maximizing
64 # speed will be using that. speed-dynamic exists to show the difference.
66 # On Solaris 8, gcc 2.95.2 -static is somehow broken (it creates executables
67 # that immediately seg fault), so -all-static is not used. The only thing
68 # -all-static does is make libc static linked as well as libgmp, and that
69 # makes a difference only when measuring malloc and friends in the speed
70 # program. This can always be forced with "make speed_LDFLAGS=-all-static
71 # ..." if desired, see tune/README.
73 EXTRA_PROGRAMS = speed speed-dynamic speed-ext tuneup tune-gcd-p
75 DEPENDENCIES = libspeed.la
76 LDADD = $(DEPENDENCIES) $(TUNE_LIBS)
78 speed_SOURCES = speed.c
79 speed_LDFLAGS = $(STATIC)
81 speed_dynamic_SOURCES = speed.c
83 speed_ext_SOURCES = speed-ext.c
84 speed_ext_LDFLAGS = $(STATIC)
86 tuneup_SOURCES = tuneup.c
87 nodist_tuneup_SOURCES = sqr_basecase.c fac_ui.c $(TUNE_MPN_SRCS)
88 tuneup_DEPENDENCIES = $(TUNE_SQR_OBJ) libspeed.la
89 tuneup_LDADD = $(tuneup_DEPENDENCIES) $(TUNE_LIBS)
90 tuneup_LDFLAGS = $(STATIC)
92 tune_gcd_p_SOURCES = tune-gcd-p.c
93 tune_gcd_p_DEPENDENCIES = ../mpn/gcd.c
94 tune_gcd_p_LDFLAGS = $(STATIC)
98 $(MAKE) $(AM_MAKEFLAGS) tuneup$(EXEEXT)
101 allprogs: $(EXTRA_PROGRAMS)
103 # $(MANY_CLEAN) and $(MANY_DISTCLEAN) are hooks for many.pl
104 CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \
105 $(TUNE_MPN_SRCS) fac_ui.c sqr_asm.asm \
106 stg.gnuplot stg.data \
107 mtg.gnuplot mtg.data \
108 fibg.gnuplot fibg.data \
109 graph.gnuplot graph.data \
111 DISTCLEANFILES = sqr_basecase.c $(MANY_DISTCLEAN)
114 # Generating these little files at build time seems better than including
115 # them in the distribution, since the list can be changed more easily.
117 # mpn/generic/tdiv_qr.c uses mpn_divrem_1 and mpn_divrem_2, but only for 1
118 # and 2 limb divisors, which are never used during tuning, so it doesn't
119 # matter whether it picks up a tuned or untuned version of those.
121 # divrem_1 and mod_1 are recompiled renamed to "_tune" to avoid a linking
122 # problem. If a native divrem_1 provides an mpn_divrem_1c entrypoint then
123 # common.c will want that, but the generic divrem_1 doesn't provide it,
124 # likewise for mod_1. The simplest way around this is to have the tune
125 # build versions renamed suitably.
127 # FIXME: Would like say mul_n.c to depend on $(top_builddir)/mul_n.c so the
128 # recompiled object will be rebuilt if that file changes.
130 TUNE_MPN_SRCS = $(TUNE_MPN_SRCS_BASIC) divrem_1.c mod_1.c
131 TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c \
132 dcpi1_div_qr.c dcpi1_divappr_q.c dcpi1_bdiv_qr.c dcpi1_bdiv_q.c \
133 invertappr.c invert.c binvert.c divrem_2.c gcd.c gcdext.c \
134 get_str.c set_str.c matrix22_mul.c \
135 hgcd.c hgcd_appr.c hgcd_reduce.c \
136 mul_n.c sqr.c powm_sec.c \
137 mullo_n.c mul_fft.c mul.c tdiv_qr.c mulmod_bnm1.c sqrmod_bnm1.c \
138 mulmid.c mulmid_n.c toom42_mulmid.c \
139 nussbaumer_mul.c toom6h_mul.c toom8h_mul.c toom6_sqr.c toom8_sqr.c \
140 toom22_mul.c toom2_sqr.c toom33_mul.c toom3_sqr.c toom44_mul.c toom4_sqr.c
142 $(TUNE_MPN_SRCS_BASIC):
143 for i in $(TUNE_MPN_SRCS_BASIC); do \
144 echo "#define TUNE_PROGRAM_BUILD 1" >$$i; \
145 echo "#include \"mpn/generic/$$i\"" >>$$i; \
149 echo "#define TUNE_PROGRAM_BUILD 1" >divrem_1.c
150 echo "#define __gmpn_divrem_1 mpn_divrem_1_tune" >>divrem_1.c
151 echo "#include \"mpn/generic/divrem_1.c\"" >>divrem_1.c
154 echo "#define TUNE_PROGRAM_BUILD 1" >mod_1.c
155 echo "#define __gmpn_mod_1 mpn_mod_1_tune" >>mod_1.c
156 echo "#include \"mpn/generic/mod_1.c\"" >>mod_1.c
158 sqr_asm.asm: $(top_builddir)/mpn/sqr_basecase.asm
159 echo 'define(SQR_TOOM2_THRESHOLD_OVERRIDE,SQR_TOOM2_THRESHOLD_MAX)' >sqr_asm.asm
160 echo 'include(../mpn/sqr_basecase.asm)' >>sqr_asm.asm
162 # FIXME: Should it depend on $(top_builddir)/fac_ui.h too?
163 fac_ui.c: $(top_builddir)/mpz/fac_ui.c
164 echo "#define TUNE_PROGRAM_BUILD 1" >fac_ui.c
165 echo "#define __gmpz_fac_ui mpz_fac_ui_tune" >>fac_ui.c
166 echo "#define __gmpz_oddfac_1 mpz_oddfac_1_tune" >>fac_ui.c
167 echo "#include \"mpz/oddfac_1.c\"" >>fac_ui.c
168 echo "#include \"mpz/fac_ui.c\"" >>fac_ui.c
170 include ../mpn/Makeasm.am