Blame tune/Makefile.am

Packit 5c3484
## Process this file with automake to generate Makefile.in
Packit 5c3484
Packit 5c3484
# Copyright 2000-2003, 2005-2011 Free Software Foundation, Inc.
Packit 5c3484
#
Packit 5c3484
#  This file is part of the GNU MP Library.
Packit 5c3484
#
Packit 5c3484
#  The GNU MP Library is free software; you can redistribute it and/or modify
Packit 5c3484
#  it under the terms of either:
Packit 5c3484
#
Packit 5c3484
#    * the GNU Lesser General Public License as published by the Free
Packit 5c3484
#      Software Foundation; either version 3 of the License, or (at your
Packit 5c3484
#      option) any later version.
Packit 5c3484
#
Packit 5c3484
#  or
Packit 5c3484
#
Packit 5c3484
#    * the GNU General Public License as published by the Free Software
Packit 5c3484
#      Foundation; either version 2 of the License, or (at your option) any
Packit 5c3484
#      later version.
Packit 5c3484
#
Packit 5c3484
#  or both in parallel, as here.
Packit 5c3484
#
Packit 5c3484
#  The GNU MP Library is distributed in the hope that it will be useful, but
Packit 5c3484
#  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit 5c3484
#  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
Packit 5c3484
#  for more details.
Packit 5c3484
#
Packit 5c3484
#  You should have received copies of the GNU General Public License and the
Packit 5c3484
#  GNU Lesser General Public License along with the GNU MP Library.  If not,
Packit 5c3484
#  see https://www.gnu.org/licenses/.
Packit 5c3484
Packit 5c3484
Packit 5c3484
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/tests
Packit 5c3484
Packit 5c3484
EXTRA_DIST = alpha.asm pentium.asm sparcv9.asm hppa.asm hppa2.asm hppa2w.asm \
Packit 5c3484
  ia64.asm powerpc.asm powerpc64.asm x86_64.asm many.pl
Packit 5c3484
noinst_HEADERS = speed.h
Packit 5c3484
Packit 5c3484
# Prefer -static on the speed and tune programs, since that can avoid
Packit 5c3484
# overheads of shared library linkages on some systems.  Libtool tends to
Packit 5c3484
# botch -static if configured with --disable-static, perhaps reasonably
Packit 5c3484
# enough.  In any event under --disable-static the only choice is a dynamic
Packit 5c3484
# link so there's no point in -static.
Packit 5c3484
#
Packit 5c3484
if ENABLE_STATIC
Packit 5c3484
STATIC = -static
Packit 5c3484
else
Packit 5c3484
STATIC =
Packit 5c3484
endif
Packit 5c3484
Packit 5c3484
Packit 5c3484
EXTRA_LTLIBRARIES = libspeed.la
Packit 5c3484
Packit 5c3484
libspeed_la_SOURCES =							\
Packit 5c3484
  common.c divrem1div.c divrem1inv.c divrem2div.c divrem2inv.c		\
Packit 5c3484
  div_qr_1n_pi1_1.c div_qr_1n_pi1_2.c div_qr_1_tune.c			\
Packit 5c3484
  freq.c								\
Packit 5c3484
  gcdext_single.c gcdext_double.c gcdextod.c gcdextos.c			\
Packit 5c3484
  hgcd_lehmer.c hgcd_appr_lehmer.c hgcd_reduce_1.c hgcd_reduce_2.c	\
Packit 5c3484
  jacbase1.c jacbase2.c jacbase3.c jacbase4.c				\
Packit 5c3484
  mod_1_div.c mod_1_inv.c mod_1_1-1.c mod_1_1-2.c modlinv.c		\
Packit 5c3484
  noop.c powm_mod.c powm_redc.c pre_divrem_1.c				\
Packit 5c3484
  set_strb.c set_strs.c set_strp.c time.c
Packit 5c3484
Packit 5c3484
libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJ) \
Packit 5c3484
  $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
Packit 5c3484
libspeed_la_LIBADD = $(libspeed_la_DEPENDENCIES) $(LIBM)
Packit 5c3484
libspeed_la_LDFLAGS = $(STATIC)
Packit 5c3484
Packit 5c3484
$(top_builddir)/tests/libtests.la:
Packit 5c3484
	cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
Packit 5c3484
Packit 5c3484
Packit 5c3484
# The library code is faster static than shared on some systems, so do
Packit 5c3484
# tuning and measuring with static, since users who care about maximizing
Packit 5c3484
# speed will be using that.  speed-dynamic exists to show the difference.
Packit 5c3484
#
Packit 5c3484
# On Solaris 8, gcc 2.95.2 -static is somehow broken (it creates executables
Packit 5c3484
# that immediately seg fault), so -all-static is not used.  The only thing
Packit 5c3484
# -all-static does is make libc static linked as well as libgmp, and that
Packit 5c3484
# makes a difference only when measuring malloc and friends in the speed
Packit 5c3484
# program.  This can always be forced with "make speed_LDFLAGS=-all-static
Packit 5c3484
# ..." if desired, see tune/README.
Packit 5c3484
Packit 5c3484
EXTRA_PROGRAMS = speed speed-dynamic speed-ext tuneup tune-gcd-p
Packit 5c3484
Packit 5c3484
DEPENDENCIES = libspeed.la
Packit 5c3484
LDADD = $(DEPENDENCIES) $(TUNE_LIBS)
Packit 5c3484
Packit 5c3484
speed_SOURCES = speed.c
Packit 5c3484
speed_LDFLAGS = $(STATIC)
Packit 5c3484
Packit 5c3484
speed_dynamic_SOURCES = speed.c
Packit 5c3484
Packit 5c3484
speed_ext_SOURCES = speed-ext.c
Packit 5c3484
speed_ext_LDFLAGS = $(STATIC)
Packit 5c3484
Packit 5c3484
tuneup_SOURCES = tuneup.c
Packit 5c3484
nodist_tuneup_SOURCES = sqr_basecase.c fac_ui.c $(TUNE_MPN_SRCS)
Packit 5c3484
tuneup_DEPENDENCIES = $(TUNE_SQR_OBJ) libspeed.la
Packit 5c3484
tuneup_LDADD = $(tuneup_DEPENDENCIES) $(TUNE_LIBS)
Packit 5c3484
tuneup_LDFLAGS = $(STATIC)
Packit 5c3484
Packit 5c3484
tune_gcd_p_SOURCES = tune-gcd-p.c
Packit 5c3484
tune_gcd_p_DEPENDENCIES = ../mpn/gcd.c
Packit 5c3484
tune_gcd_p_LDFLAGS = $(STATIC)
Packit 5c3484
Packit 5c3484
Packit 5c3484
tune:
Packit 5c3484
	$(MAKE) $(AM_MAKEFLAGS) tuneup$(EXEEXT)
Packit 5c3484
	./tuneup
Packit 5c3484
Packit 5c3484
allprogs: $(EXTRA_PROGRAMS)
Packit 5c3484
Packit 5c3484
# $(MANY_CLEAN) and $(MANY_DISTCLEAN) are hooks for many.pl
Packit 5c3484
CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \
Packit 5c3484
	$(TUNE_MPN_SRCS) fac_ui.c sqr_asm.asm \
Packit 5c3484
	stg.gnuplot stg.data \
Packit 5c3484
	mtg.gnuplot mtg.data \
Packit 5c3484
	fibg.gnuplot fibg.data \
Packit 5c3484
	graph.gnuplot graph.data \
Packit 5c3484
	$(MANY_CLEAN)
Packit 5c3484
DISTCLEANFILES = sqr_basecase.c  $(MANY_DISTCLEAN)
Packit 5c3484
Packit 5c3484
Packit 5c3484
# Generating these little files at build time seems better than including
Packit 5c3484
# them in the distribution, since the list can be changed more easily.
Packit 5c3484
#
Packit 5c3484
# mpn/generic/tdiv_qr.c uses mpn_divrem_1 and mpn_divrem_2, but only for 1
Packit 5c3484
# and 2 limb divisors, which are never used during tuning, so it doesn't
Packit 5c3484
# matter whether it picks up a tuned or untuned version of those.
Packit 5c3484
#
Packit 5c3484
# divrem_1 and mod_1 are recompiled renamed to "_tune" to avoid a linking
Packit 5c3484
# problem.  If a native divrem_1 provides an mpn_divrem_1c entrypoint then
Packit 5c3484
# common.c will want that, but the generic divrem_1 doesn't provide it,
Packit 5c3484
# likewise for mod_1.  The simplest way around this is to have the tune
Packit 5c3484
# build versions renamed suitably.
Packit 5c3484
#
Packit 5c3484
# FIXME: Would like say mul_n.c to depend on $(top_builddir)/mul_n.c so the
Packit 5c3484
# recompiled object will be rebuilt if that file changes.
Packit 5c3484
Packit 5c3484
TUNE_MPN_SRCS = $(TUNE_MPN_SRCS_BASIC) divrem_1.c mod_1.c
Packit 5c3484
TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c			\
Packit 5c3484
  dcpi1_div_qr.c dcpi1_divappr_q.c dcpi1_bdiv_qr.c dcpi1_bdiv_q.c	\
Packit 5c3484
  invertappr.c invert.c binvert.c divrem_2.c gcd.c gcdext.c		\
Packit 5c3484
  get_str.c set_str.c matrix22_mul.c					\
Packit 5c3484
  hgcd.c hgcd_appr.c hgcd_reduce.c					\
Packit 5c3484
  mul_n.c sqr.c sec_powm.c						\
Packit 5c3484
  mullo_n.c mul_fft.c mul.c tdiv_qr.c mulmod_bnm1.c sqrmod_bnm1.c	\
Packit 5c3484
  mulmid.c mulmid_n.c toom42_mulmid.c sqrlo.c sqrlo_basecase.c		\
Packit 5c3484
  nussbaumer_mul.c toom6h_mul.c toom8h_mul.c toom6_sqr.c toom8_sqr.c	\
Packit 5c3484
  toom22_mul.c toom2_sqr.c toom33_mul.c toom3_sqr.c toom44_mul.c toom4_sqr.c
Packit 5c3484
Packit 5c3484
$(TUNE_MPN_SRCS_BASIC):
Packit 5c3484
	for i in $(TUNE_MPN_SRCS_BASIC); do \
Packit 5c3484
	  echo "#define TUNE_PROGRAM_BUILD 1" >$$i; \
Packit 5c3484
	  echo "#include \"mpn/generic/$$i\"" >>$$i; \
Packit 5c3484
	done
Packit 5c3484
Packit 5c3484
divrem_1.c:
Packit 5c3484
	echo "#define TUNE_PROGRAM_BUILD 1"                >divrem_1.c
Packit 5c3484
	echo "#define __gmpn_divrem_1  mpn_divrem_1_tune" >>divrem_1.c
Packit 5c3484
	echo "#include \"mpn/generic/divrem_1.c\""        >>divrem_1.c
Packit 5c3484
Packit 5c3484
mod_1.c:
Packit 5c3484
	echo "#define TUNE_PROGRAM_BUILD 1"          >mod_1.c
Packit 5c3484
	echo "#define __gmpn_mod_1  mpn_mod_1_tune" >>mod_1.c
Packit 5c3484
	echo "#include \"mpn/generic/mod_1.c\""     >>mod_1.c
Packit 5c3484
Packit 5c3484
sqr_asm.asm: $(top_builddir)/mpn/sqr_basecase.asm
Packit 5c3484
	echo 'define(SQR_TOOM2_THRESHOLD_OVERRIDE,SQR_TOOM2_THRESHOLD_MAX)' >sqr_asm.asm
Packit 5c3484
	echo 'include(../mpn/sqr_basecase.asm)' >>sqr_asm.asm
Packit 5c3484
Packit 5c3484
# FIXME: Should it depend on $(top_builddir)/fac_ui.h too?
Packit 5c3484
fac_ui.c: $(top_builddir)/mpz/fac_ui.c
Packit 5c3484
	echo "#define TUNE_PROGRAM_BUILD 1"          >fac_ui.c
Packit 5c3484
	echo "#define __gmpz_fac_ui mpz_fac_ui_tune" >>fac_ui.c
Packit 5c3484
	echo "#define __gmpz_oddfac_1 mpz_oddfac_1_tune" >>fac_ui.c
Packit 5c3484
	echo "#include \"mpz/oddfac_1.c\""           >>fac_ui.c
Packit 5c3484
	echo "#include \"mpz/fac_ui.c\""             >>fac_ui.c
Packit 5c3484
Packit 5c3484
include ../mpn/Makeasm.am