aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-06-18 23:37:41 -0400
committerRob Austein <sra@hactrn.net>2015-06-18 23:37:41 -0400
commit652a357ac9e6db1818945963515516db44c297b6 (patch)
tree605183fc58ae9bd30f62c9c321b6a9179456832a
parentc4b3c14cee66da31b399fb88766df87c95c464ce (diff)
Make bignum size configurable.
-rw-r--r--GNUmakefile15
1 files 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 $^ $@