Annotation of OpenXM_contrib/gmp/tune/Makefile.am, Revision 1.1.1.1
1.1 maekawa 1: ## Process this file with automake to generate Makefile.in
2:
3: # Copyright (C) 2000 Free Software Foundation, Inc.
4: #
5: # This file is part of the GNU MP Library.
6: #
7: # The GNU MP Library is free software; you can redistribute it and/or modify
8: # it under the terms of the GNU Lesser General Public License as published by
9: # the Free Software Foundation; either version 2.1 of the License, or (at your
10: # option) any later version.
11: #
12: # The GNU MP Library is distributed in the hope that it will be useful, but
13: # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15: # License for more details.
16: #
17: # You should have received a copy of the GNU Lesser General Public License
18: # along with the GNU MP Library; see the file COPYING.LIB. If not, write to
19: # the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
20: # MA 02111-1307, USA.
21:
22:
23: AUTOMAKE_OPTIONS = gnu no-dependencies $(top_builddir)/ansi2knr
24:
25: INCLUDES = -I$(top_srcdir)
26:
27: EXTRA_DIST = alpha.asm pentium.asm sparcv9.asm hppa.asm hppa2.asm
28: noinst_HEADERS = speed.h
29:
30: # No dependency on libgmp, so can use libgmptune instead for tune program
31: EXTRA_LTLIBRARIES = libspeed.la
32: libspeed_la_SOURCES = common.c time.c noop.c
33: libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJS)
34: libspeed_la_LIBADD = $(libspeed_la_DEPENDENCIES)
35:
36: # Both libspeed and the programs are built static-only since static is
37: # fastest and will be preferred by users who care about maximizing speed.
38: #
39: # Actually libtool doesn't seem to pass -static through to gcc, it only
40: # chooses the ".a" versions of libtool libraries. Rerun the gcc link
41: # invocation with -static if you want a static link of libc and libm.
42: #
43: LDFLAGS = -static
44: LDADD = libspeed.la $(top_builddir)/libgmp.la -lm
45:
46: EXTRA_PROGRAMS = speed speed-ext tuneup
47:
48: tuneup_SOURCES = tuneup.c
49: tuneup_DEPENDENCIES = libspeed.la libgmptune.a
50: tuneup_LDADD = $(tuneup_DEPENDENCIES) -lm
51:
52: # Don't know how to get tuneup$U.lo to depend on sqr_basecase.h, so just do
53: # an explicit make. A plain "make tuneup" will fail if used directly.
54: tune:
55: $(MAKE) $(AM_MAKEFLAGS) sqr_basecase.h tuneup$(EXEEXT)
56: ./tuneup
57:
58: allprogs: sqr_basecase.h $(EXTRA_PROGRAMS)
59:
60:
61: speed_SOURCES = speed.c
62:
63: SQR_CLEANFILES = sqr_basecase.c sqr_basecase.h sqr_basecase.asm
64:
65: CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \
66: $(SQR_CLEANFILES) libgmptune.a libgmptmp.a \
67: stg.gnuplot stg.data \
68: mtg.gnuplot mtg.data \
69: fibg.gnuplot fibg.data \
70: graph.gnuplot graph.data
71:
72:
73: # This bit like mpn/Makefile.am
74:
75: # COMPILE minus CC. FIXME: Really pass *_CFLAGS to CPP?
76: COMPILE_FLAGS = \
77: $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
78:
79: SUFFIXES = .asm
80: .asm.o:
81: $(M4) $(M4FLAGS) -DOPERATION_$* $< >tmp-$*.s
82: $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
83: rm -f tmp-$*.s
84: .asm.obj:
85: $(M4) $(M4FLAGS) -DOPERATION_$* `cygpath -w $<` >tmp-$*.s
86: $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
87: rm -f tmp-$*.s
88: .asm.lo:
89: echo "$(COMPILE_FLAGS)"
90: $(M4) $(M4FLAGS) -DPIC -DOPERATION_$* $< >tmp-$*.s
91: $(LIBTOOL) --mode=compile $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $@
92: $(M4) $(M4FLAGS) -DOPERATION_$* $< >tmp-$*.s
93: $(CCAS) $(COMPILE_FLAGS) tmp-$*.s -o $*.o
94: rm -f tmp-$*.s
95:
96:
97: # Recompiled versions of $(LIBGMPTUNE_OBJS) are always used. sqr_basecase.o
98: # is replaced if it's mpn/generic/sqr_basecase.c (due to the fixed size
99: # temporary array), or sqr_basecase.asm with a KARATSUBA_SQR_THRESHOLD_MAX
100: # (because that says it normally works only up to KARATSUBA_SQR_THRESHOLD).
101:
102: SQR_GENERIC_MAX = 200
103:
104: LIBGMPTUNE_OBJS = \
105: mul_n.o mul_fft.o mul.o \
106: bz_divrem_n.o tdiv_qr.o fib_ui.o powm.o gcd.o gcdext.o
107:
108: sqr_basecase.h: libgmptune.a
109:
110:
111: # "cp -f" is not portable (eg. it fails on SunOS)
112: # "ar r" is going to be a bit fragile because there's more than one mul.o in
113: # libgmp.a.
114:
115: libgmptune.a: $(top_builddir)/libgmp.la $(LIBGMPTUNE_OBJS)
116: rm -f libgmptmp.a
117: eval `$(LIBTOOL) --config | grep '^objdir='` ; \
118: cp $(top_builddir)/$$objdir/libgmp.a libgmptmp.a
119: $(AR) r libgmptmp.a $(LIBGMPTUNE_OBJS)
120: rm -f $(SQR_CLEANFILES)
121: echo "" >sqr_basecase.h
122: if test -f $(top_builddir)/mpn/sqr_basecase.c; then \
123: $(MAKE) $(AM_MAKEFLAGS) sqr-basecase-generic; \
124: else \
125: if grep KARATSUBA_SQR_THRESHOLD_MAX \
126: $(top_builddir)/mpn/sqr_basecase.asm >/dev/null; then \
127: $(MAKE) $(AM_MAKEFLAGS) sqr-basecase-asm; \
128: fi \
129: fi
130: $(RANLIB) libgmptmp.a
131: rm -f libgmptune.a
132: mv libgmptmp.a libgmptune.a
133:
134: sqr-basecase-generic:
135: cp $(top_builddir)/mpn/sqr_basecase.c .
136: $(MAKE) $(AM_MAKEFLAGS) \
137: CFLAGS='$(CFLAGS) -DKARATSUBA_SQR_THRESHOLD=$(SQR_GENERIC_MAX)' \
138: sqr_basecase.o
139: $(AR) r libgmptmp.a sqr_basecase.o
140: echo '#define KARATSUBA_SQR_MAX $(SQR_GENERIC_MAX)' >sqr_basecase.h
141:
142: sqr-basecase-asm:
143: cp $(top_builddir)/mpn/sqr_basecase.asm .
144: $(MAKE) $(AM_MAKEFLAGS) \
145: M4FLAGS='$(M4FLAGS) -DKARATSUBA_SQR_THRESHOLD_OVERRIDE=KARATSUBA_SQR_THRESHOLD_MAX' \
146: sqr_basecase.o
147: ar r libgmptmp.a sqr_basecase.o
148: echo "#define KARATSUBA_SQR_MAX `sed -n 's/def...(KARATSUBA_SQR_THRESHOLD_MAX, *\([0-9]*\))/\1/p' sqr_basecase.asm`" >sqr_basecase.h
149:
150:
151: mul_n.o: $(top_builddir)/mpn/mul_n.c
152: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/mul_n.c
153:
154: mul_fft.o: $(top_builddir)/mpn/mul_fft.c
155: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/mul_fft.c
156:
157: mul.o: $(top_builddir)/mpn/mul.c
158: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/mul.c
159:
160: bz_divrem_n.o: $(top_builddir)/mpn/bz_divrem_n.c
161: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/bz_divrem_n.c
162:
163: tdiv_qr.o: $(top_builddir)/mpn/tdiv_qr.c
164: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/tdiv_qr.c
165:
166: fib_ui.o: $(top_srcdir)/mpz/fib_ui.c
167: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_srcdir)/mpz/fib_ui.c
168:
169: powm.o: $(top_srcdir)/mpz/powm.c
170: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_srcdir)/mpz/powm.c
171:
172: gcd.o: $(top_builddir)/mpn/gcd.c
173: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/gcd.c
174:
175: gcdext.o: $(top_builddir)/mpn/gcdext.c
176: $(COMPILE) -DTUNE_PROGRAM_BUILD=1 -c $(top_builddir)/mpn/gcdext.c
177:
178:
179:
180:
181: # "mk" is multiplication in the karatsuba range
182: # "st" is squaring in the toom-cook range, etc
183: # "g" forms produce graphs
184:
185: mk:
186: ./speed -s 5-40 -c mpn_mul_basecase mpn_kara_mul_n
187:
188: MTS = -s 50-150 -c
189: mt:
190: ./speed $(MTS) mpn_kara_mul_n mpn_toom3_mul_n | less
191: mtg:
192: ./speed $(MTS) -P mtg mpn_kara_mul_n mpn_toom3_mul_n
193:
194: sk:
195: ./speed -s 5-40 -c mpn_sqr_basecase mpn_kara_sqr_n
196:
197: STS = -s 50-150 -c
198: st:
199: ./speed $(STS) mpn_kara_sqr_n mpn_toom3_sqr_n | less
200: stg:
201: ./speed $(STS) -P stg mpn_kara_sqr_n mpn_toom3_sqr_n
202:
203: bz:
204: ./speed -s 5-40 -c mpn_bz_divrem_sb mpn_bz_divrem_n mpn_bz_tdiv_qr
205:
206: fib:
207: ./speed -s 80-120 -c mpz_fib_ui
208: fibg:
209: ./speed -s 10-300 -P fibg mpz_fib_ui
210:
211:
212: gcd:
213: ./speed -s 1-20 -c mpn_gcd
214:
215:
216: graph:
217: ./speed -s 1-5000 -f 1.02 -P graph mpn_mul_n mpn_sqr
218: gnuplot graph.gnuplot
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>