aboutsummaryrefslogtreecommitdiff
path: root/GNUmakefile
diff options
context:
space:
mode:
Diffstat (limited to 'GNUmakefile')
-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 $^ $@