From 652a357ac9e6db1818945963515516db44c297b6 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 18 Jun 2015 23:37:41 -0400 Subject: Make bignum size configurable. --- GNUmakefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 533bb42..35cc7d5 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,20 +3,25 @@ # Perhaps we should be using a git subrepository instead of this hack? # Work that out later. +# See tfm.pdf section 1.3.6 ("Precision configuration") for details on +# how FP_MAX_SIZE works. + +BITS := 8192 + URL := https://github.com/libtom/tomsfastmath.git REPO := $(notdir $(basename ${URL})) HDR := ${REPO}/src/headers/tfm.h LIB := ${REPO}/libtfm.a -FLAGS := CFLAGS='-fPIC -Wall -W -Wshadow -Isrc/headers -g3' +FLAGS := CFLAGS='-fPIC -Wall -W -Wshadow -Isrc/headers -g3 -DFP_MAX_SIZE="(${BITS}+(8*DIGIT_BIT))"' TARGETS := $(notdir ${HDR} ${LIB}) all: ${TARGETS} clean: - rm -f ${TARGETS} + rm -f ${TARGETS} $(notdir ${HDR}.tmp) cd ${REPO}; git clean -dxf distclean: clean @@ -31,7 +36,11 @@ ${LIB}: ${HDR} cd ${REPO}; ${MAKE} ${FLAGS} $(notdir ${HDR}): ${HDR} - ln -f $^ $@ + echo >$@.tmp '/* Configure size of largest bignum we want to handle -- see notes in tfm.pdf */' + echo >>$@.tmp '#define FP_MAX_SIZE (${BITS}+(8*DIGIT_BIT))' + echo >>$@.tmp '' + cat >>$@.tmp $^ + mv -f $@.tmp $@ $(notdir ${LIB}): ${LIB} ln -f $^ $@ -- cgit v1.2.3