2005-08-01 18:37:35 +02:00
|
|
|
#makefile for TomsFastMath
|
|
|
|
#
|
|
|
|
#
|
2015-08-07 10:51:36 +02:00
|
|
|
VERSION=1:0:0
|
2005-08-01 18:37:35 +02:00
|
|
|
|
2014-10-13 16:44:58 +02:00
|
|
|
LT ?= libtool
|
|
|
|
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
|
2005-08-01 18:37:35 +02:00
|
|
|
|
2007-03-14 18:58:46 +01:00
|
|
|
CFLAGS += -Wall -W -Wshadow -Isrc/headers
|
2005-08-01 18:37:35 +02:00
|
|
|
|
|
|
|
ifndef IGNORE_SPEED
|
|
|
|
|
|
|
|
CFLAGS += -O3 -funroll-all-loops
|
|
|
|
|
|
|
|
#profiling
|
|
|
|
#PROF=-pg -g
|
|
|
|
#CFLAGS += $(PROF)
|
|
|
|
|
|
|
|
#speed
|
|
|
|
CFLAGS += -fomit-frame-pointer
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
2007-03-14 18:58:46 +01:00
|
|
|
#START_INS
|
|
|
|
OBJECTS=src/addsub/fp_add.o src/addsub/fp_add_d.o src/addsub/fp_addmod.o src/addsub/fp_cmp.o \
|
|
|
|
src/addsub/fp_cmp_d.o src/addsub/fp_cmp_mag.o src/addsub/fp_sub.o src/addsub/fp_sub_d.o \
|
|
|
|
src/addsub/fp_submod.o src/addsub/s_fp_add.o src/addsub/s_fp_sub.o src/bin/fp_radix_size.o \
|
|
|
|
src/bin/fp_read_radix.o src/bin/fp_read_signed_bin.o src/bin/fp_read_unsigned_bin.o \
|
2014-06-12 18:16:06 +02:00
|
|
|
src/bin/fp_reverse.o src/bin/fp_signed_bin_size.o src/bin/fp_s_rmap.o src/bin/fp_toradix.o \
|
2015-02-15 23:30:09 +01:00
|
|
|
src/bin/fp_toradix_n.o src/bin/fp_to_signed_bin.o src/bin/fp_to_unsigned_bin.o \
|
|
|
|
src/bin/fp_unsigned_bin_size.o src/bit/fp_cnt_lsb.o src/bit/fp_count_bits.o src/bit/fp_div_2.o \
|
|
|
|
src/bit/fp_div_2d.o src/bit/fp_lshd.o src/bit/fp_mod_2d.o src/bit/fp_rshd.o src/divide/fp_div.o \
|
|
|
|
src/divide/fp_div_d.o src/divide/fp_mod.o src/divide/fp_mod_d.o src/exptmod/fp_2expt.o \
|
|
|
|
src/exptmod/fp_exptmod.o src/misc/fp_ident.o src/misc/fp_rand.o src/misc/fp_set.o \
|
|
|
|
src/mont/fp_montgomery_calc_normalization.o src/mont/fp_montgomery_reduce.o \
|
|
|
|
src/mont/fp_montgomery_setup.o src/mul/fp_mul_2.o src/mul/fp_mul_2d.o src/mul/fp_mul.o \
|
|
|
|
src/mul/fp_mul_comba_12.o src/mul/fp_mul_comba_17.o src/mul/fp_mul_comba_20.o src/mul/fp_mul_comba_24.o \
|
|
|
|
src/mul/fp_mul_comba_28.o src/mul/fp_mul_comba_32.o src/mul/fp_mul_comba_3.o src/mul/fp_mul_comba_48.o \
|
|
|
|
src/mul/fp_mul_comba_4.o src/mul/fp_mul_comba_64.o src/mul/fp_mul_comba_6.o src/mul/fp_mul_comba_7.o \
|
|
|
|
src/mul/fp_mul_comba_8.o src/mul/fp_mul_comba_9.o src/mul/fp_mul_comba.o \
|
2007-03-14 18:58:46 +01:00
|
|
|
src/mul/fp_mul_comba_small_set.o src/mul/fp_mul_d.o src/mul/fp_mulmod.o src/numtheory/fp_gcd.o \
|
2014-10-13 13:40:41 +02:00
|
|
|
src/numtheory/fp_invmod.o src/numtheory/fp_isprime.o src/numtheory/fp_isprime_ex.o \
|
|
|
|
src/numtheory/fp_lcm.o src/numtheory/fp_prime_miller_rabin.o src/numtheory/fp_prime_random_ex.o \
|
|
|
|
src/sqr/fp_sqr.o src/sqr/fp_sqr_comba_12.o src/sqr/fp_sqr_comba_17.o src/sqr/fp_sqr_comba_20.o \
|
|
|
|
src/sqr/fp_sqr_comba_24.o src/sqr/fp_sqr_comba_28.o src/sqr/fp_sqr_comba_32.o src/sqr/fp_sqr_comba_3.o \
|
|
|
|
src/sqr/fp_sqr_comba_48.o src/sqr/fp_sqr_comba_4.o src/sqr/fp_sqr_comba_64.o src/sqr/fp_sqr_comba_6.o \
|
|
|
|
src/sqr/fp_sqr_comba_7.o src/sqr/fp_sqr_comba_8.o src/sqr/fp_sqr_comba_9.o src/sqr/fp_sqr_comba.o \
|
|
|
|
src/sqr/fp_sqr_comba_generic.o src/sqr/fp_sqr_comba_small_set.o src/sqr/fp_sqrmod.o
|
2007-03-14 18:58:46 +01:00
|
|
|
|
2016-04-24 18:36:51 +02:00
|
|
|
HEADERS_PUB:=src/headers/tfm.h
|
|
|
|
HEADERS=src/headers/tfm_private.h $(HEADERS_PUB)
|
2007-03-14 18:58:46 +01:00
|
|
|
|
|
|
|
#END_INS
|
2005-08-01 18:37:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
ifndef LIBPATH
|
|
|
|
LIBPATH=/usr/lib
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef INCPATH
|
|
|
|
INCPATH=/usr/include
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef INSTALL_GROUP
|
|
|
|
GROUP=wheel
|
|
|
|
else
|
|
|
|
GROUP=$(INSTALL_GROUP)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef INSTALL_USER
|
|
|
|
USER=root
|
|
|
|
else
|
|
|
|
USER=$(INSTALL_USER)
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef LIBNAME
|
|
|
|
LIBNAME=libtfm.la
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifndef LIBNAME_S
|
|
|
|
LIBNAME_S=libtfm.a
|
|
|
|
endif
|
|
|
|
|
|
|
|
default: $(LIBNAME)
|
|
|
|
|
2014-10-13 16:44:58 +02:00
|
|
|
$(OBJECTS): $(HEADERS)
|
|
|
|
|
|
|
|
.c.o:
|
|
|
|
$(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
|
2005-10-31 16:32:05 +01:00
|
|
|
|
2005-08-01 18:37:35 +02:00
|
|
|
$(LIBNAME): $(OBJECTS)
|
2016-07-03 21:47:13 +02:00
|
|
|
libtool --mode=link --tag=CC $(CC) $(CFLAGS) $(LDFLAGS) `find . -type f | LC_ALL=C sort | grep "[.]lo" | xargs` -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION) -export-symbols libtfm.symbols
|
2005-08-01 18:37:35 +02:00
|
|
|
|
|
|
|
install: $(LIBNAME)
|
2006-04-06 21:49:03 +02:00
|
|
|
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
|
2016-03-08 21:51:23 +01:00
|
|
|
libtool --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
|
2005-08-01 18:37:35 +02:00
|
|
|
install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
|
2016-04-24 18:36:51 +02:00
|
|
|
install -g $(GROUP) -o $(USER) $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
|
2005-08-01 18:37:35 +02:00
|
|
|
|
2016-04-24 18:37:17 +02:00
|
|
|
HEADER_FILES=$(notdir $(HEADERS_PUB))
|
|
|
|
uninstall:
|
|
|
|
libtool --mode=uninstall rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
|
|
|
|
rm $(HEADER_FILES:%=$(DESTDIR)$(INCPATH)/%)
|
|
|
|
|
2005-08-01 18:37:35 +02:00
|
|
|
mtest/mtest: mtest/mtest.c
|
|
|
|
cd mtest ; make mtest
|
|
|
|
|
2015-02-15 15:13:20 +01:00
|
|
|
demo/test.o: CFLAGS+=-Wno-unused-result
|
|
|
|
|
2014-10-13 16:44:58 +02:00
|
|
|
.PHONY: test
|
|
|
|
test: $(LIBNAME) demo/test.o
|
|
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test demo/test.o $(LIBNAME)
|
2005-08-01 18:37:35 +02:00
|
|
|
|
2015-02-15 15:13:20 +01:00
|
|
|
test_standalone: CFLAGS+=-DTFM_DEMO_TEST_VS_MTEST=0
|
|
|
|
|
|
|
|
.PHONY: test_standalone
|
|
|
|
test_standalone: $(LIBNAME) demo/test.o
|
|
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o test demo/test.o $(LIBNAME)
|
|
|
|
|
2014-06-12 17:35:54 +02:00
|
|
|
stest: $(LIBNAME) demo/stest.o
|
2014-10-13 16:44:58 +02:00
|
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o stest demo/stest.o $(LIBNAME)
|
2005-08-01 18:37:35 +02:00
|
|
|
|
2015-02-08 11:50:39 +01:00
|
|
|
.PHONY: timing
|
|
|
|
timing: $(LIBNAME) demo/timing.o
|
2015-02-26 09:17:20 +01:00
|
|
|
$(LT) --mode=link --tag=CC $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o timing demo/timing.o $(LIBNAME)
|
2015-02-08 11:50:39 +01:00
|
|
|
|
2014-06-12 17:35:54 +02:00
|
|
|
# $Source$
|
|
|
|
# $Revision$
|
|
|
|
# $Date$
|
2005-08-01 18:37:35 +02:00
|
|
|
|