aboutsummaryrefslogtreecommitdiff
path: root/libtfm/Makefile
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2016-06-26 01:04:05 -0400
committerRob Austein <sra@hactrn.net>2016-06-26 01:04:05 -0400
commit6c7ea9977c45116cc51aba7a4486059926d01113 (patch)
treeae5f4cc31d2a5c4d2688f3dfdca543e81c7c95e1 /libtfm/Makefile
parentb996343a3b07228ca34e6b0df4cc7c1033e48af5 (diff)
More GNUmakefile cleanup.
Diffstat (limited to 'libtfm/Makefile')
-rw-r--r--libtfm/Makefile46
1 files changed, 46 insertions, 0 deletions
diff --git a/libtfm/Makefile b/libtfm/Makefile
new file mode 100644
index 0000000..b819bba
--- /dev/null
+++ b/libtfm/Makefile
@@ -0,0 +1,46 @@
+
+# This duplicates more of sw/thirdparty/libtfm/Makefile than I
+# would like, but it does the job. Prettier makefiles can wait for another day.
+
+ifndef CRYPTECH_ROOT
+ CRYPTECH_ROOT := $(abspath ../../..)
+endif
+
+REPO := ${CRYPTECH_ROOT}/sw/thirdparty/libtfm
+
+# vpath %.c ${REPO}
+# vpath %.h ${REPO}
+
+BITS := 8192
+
+HDR := ${REPO}/tomsfastmath/src/headers/tfm.h
+LIB := tomsfastmath/libtfm.a
+
+#CFLAGS += -DTFM_X86
+#CFLAGS += -DTFM_NO_ASM
+
+CFLAGS += -fPIC -Wall -W -Wshadow -I${REPO}/tomsfastmath/src/headers -g3 -DFP_MAX_SIZE="(${BITS}*2+(8*DIGIT_BIT))"
+
+TARGETS := $(notdir ${HDR} ${LIB})
+
+all: ${TARGETS}
+
+clean:
+ rm -rf ${TARGETS} $(notdir ${HDR}.tmp) ${LIB} tomsfastmath/src
+
+distclean: clean
+ rm -f TAGS
+
+$(notdir ${HDR}): ${HDR}
+ echo >$@.tmp '/* Configure size of largest bignum we want to handle -- see notes in tfm.pdf */'
+ echo >>$@.tmp '#define FP_MAX_SIZE (${BITS}*2+(8*DIGIT_BIT))'
+ echo >>$@.tmp ''
+ cat >>$@.tmp $^
+ mv -f $@.tmp $@
+
+$(notdir ${LIB}): ${LIB}
+ ln -f $^ $@
+
+${LIB}: ${HDR}
+ (cd ${REPO} && find tomsfastmath/src -type d) | xargs mkdir -p
+ cd tomsfastmath; ${MAKE} CFLAGS='${CFLAGS}'