tomsfastmath/makefile

137 lines
4.7 KiB
Makefile
Raw Normal View History

2004-08-25 04:43:43 +02:00
#makefile for TomsFastMath
#
#
ifndef LIBNAME
LIBNAME=libtfm.a
endif
INSTALL_CMD = install
UNINSTALL_CMD = rm
include makefile_include.mk
2005-08-01 18:37:35 +02:00
ifeq ($V,1)
silent=
else
silent=@
endif
2017-09-13 17:46:41 +02:00
ifeq ($(COVERAGE),1)
CFLAGS += -fprofile-arcs -ftest-coverage
LDFLAGS += -lgcov
LIB_PRE = -Wl,--whole-archive
LIB_POST = -Wl,--no-whole-archive
endif
%.o: %.c
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} ${CC} ${CFLAGS} -c $< -o $@
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
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-07-23 12:43:03 +02:00
$(OBJECTS): $(HEADERS)
2005-07-23 12:43:03 +02:00
$(LIBNAME): $(OBJECTS)
2005-08-01 18:37:35 +02:00
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
2005-07-23 12:43:03 +02:00
install: .common_install
2004-08-25 04:43:43 +02:00
uninstall: .common_uninstall
2016-04-24 18:37:17 +02:00
2014-08-14 21:11:24 +02:00
.PHONY: test
test: $(LIBNAME) demo/test.o
2017-09-13 17:46:41 +02:00
$(CC) $(CFLAGS) demo/test.o $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(PROF) -o test
2004-08-25 04:43:43 +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
2017-09-13 17:46:41 +02:00
$(CC) $(CFLAGS) demo/test.o $(LIB_PRE) $(LIBNAME) $(LIB_POST) $(PROF) -o test
2015-02-15 15:13:20 +01:00
testme: test mtest
./mtest/mtest -15 | ./test
timing: $(LIBNAME) demo/timing.o
$(CC) $(CFLAGS) demo/timing.o $(LIBNAME) $(PROF) -o timing
2007-03-14 18:58:46 +01:00
profiled:
2017-09-13 15:20:40 +02:00
CC="$(CC)" CROSS_COMPILE="${CROSS_COMPILE} CFLAGS="${CFLAGS} -fprofile-generate" MAKE=${MAKE} ${MAKE} timing
2007-03-14 18:58:46 +01:00
./test
2014-08-14 21:11:24 +02:00
rm -f `find . -type f -name "*.o" | xargs`
rm -f `find . -type f -name "*.a" | xargs`
2007-03-14 18:58:46 +01:00
rm -f test
2017-09-13 15:20:40 +02:00
CC=$(CC) CROSS_COMPILE="${CROSS_COMPILE} CFLAGS="${CFLAGS} -fprofile-use" MAKE=${MAKE} ${MAKE} timing
# target that pre-processes all coverage data
lcov-single-create:
lcov --capture --no-external --directory src -q --output-file coverage_std.info
# target that removes all coverage output
cleancov-clean:
rm -f `find . -type f -name "*.info" | xargs`
rm -rf coverage/
# generates html output from all coverage_*.info files
lcov:
lcov `find -name 'coverage_*.info' -exec echo -n " -a {}" \;` -o coverage.info -q 2>/dev/null
2017-04-08 22:10:29 +02:00
genhtml coverage.info --output-directory coverage -q
# combines all necessary steps to create the coverage from a single testrun with e.g.
2017-04-08 22:10:29 +02:00
lcov-single:
$(MAKE) cleancov-clean
$(MAKE) lcov-single-create
$(MAKE) lcov
#make the code coverage of the library
coverage: CFLAGS += -fprofile-arcs -ftest-coverage
coverage: LDFLAGS += -lgcov
coverage: LIB_PRE = -Wl,--whole-archive
coverage: LIB_POST = -Wl,--no-whole-archive
2017-09-13 17:46:41 +02:00
coverage: testme
2017-04-08 22:10:29 +02:00
$(MAKE) lcov-single
2014-06-12 17:35:54 +02:00
stest: $(LIBNAME) demo/stest.o
2005-08-01 18:37:35 +02:00
$(CC) $(CFLAGS) demo/stest.o $(LIBNAME) -o stest
2005-07-23 12:43:03 +02:00
2005-08-01 18:37:35 +02:00
rsatest: $(LIBNAME) demo/rsa.o
$(CC) $(CFLAGS) demo/rsa.o $(LIBNAME) -o rsatest
2004-08-25 04:43:43 +02:00
2017-06-14 13:58:48 +02:00
# ref: $Format:%D$
# git commit: $Format:%H$
# commit time: $Format:%ai$