From 7b0a1f19204cb7ba62cb4d787f3715264d5ec0a3 Mon Sep 17 00:00:00 2001 From: hasufell Date: Mon, 19 May 2014 00:04:00 +0200 Subject: [PATCH] BUILD: Fix Makefiles for flint --- Makefile | 1 + src/Makefile | 20 ++++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index d16c097..0f8d809 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ clean: clean-all: clean $(MAKE) -C external/libtommath-0.42.0 clean $(MAKE) -C external/libtompoly-0.04 clean + $(MAKE) -C external/flint-2.4.3 clean doc: doxygen diff --git a/src/Makefile b/src/Makefile index bd89c5d..9811bf7 100644 --- a/src/Makefile +++ b/src/Makefile @@ -34,7 +34,7 @@ else PQC_LIBS = libpqc.a endif # CUNIT_LIBS = -lcunit -LIBS += -L. +LIBS += -L. -lgmp -lmpfr -lm # objects PQC_OBJS = rand.o poly.o mem.o ntru_decrypt.o pqc_encrypt.o @@ -47,10 +47,14 @@ INCS = -I. ifndef UNBUNDLE LIBTOMMATH = ../external/libtommath-0.42.0/libtommath.a LIBTOMPOLY = ../external/libtompoly-0.04/libtompoly.a -INCS += -I../external/libtommath-0.42.0 -I../external/libtompoly-0.04 +LIBFLINT = ../external/flint-2.4.3/libflint.a +INCS += -I../external/libtommath-0.42.0 \ + -I../external/libtompoly-0.04 \ + -I../external/flint-2.4.3 else LIBTOMMATH = -ltommath LIBTOMPOLY = -ltompoly +LIBFLINT = -lflint endif @@ -69,18 +73,22 @@ $(LIBTOMMATH): $(LIBTOMPOLY): $(MAKE) -C ../external/libtompoly-0.04 + +$(LIBFLINT): + cd ../external/flint-2.4.3 && ./configure --prefix=/usr --with-gmp=/usr --with-mpfr=/usr --disable-shared + $(MAKE) -C ../external/flint-2.4.3 endif libpqc.a: $(PQC_OBJS) $(PQC_HEADERS) $(AR) cru libpqc.a $(PQC_OBJS) -libpqc.so: libpqc.a $(PQC_HEADERS) $(LIBTOMMATH) $(LIBTOMPOLY) +libpqc.so: libpqc.a $(PQC_HEADERS) $(LIBTOMMATH) $(LIBTOMPOLY) $(LIBFLINT) $(CC) -shared $(CFLAGS) -o $@ $(LDFLAGS) \ - libpqc.a $(LIBTOMMATH) $(LIBTOMPOLY) $(LIBS) + libpqc.a $(LIBTOMMATH) $(LIBTOMPOLY) $(LIBFLINT) $(LIBS) -main: main.o libpqc.a $(LIBTOMMATH) $(LIBTOMPOLY) +main: main.o libpqc.a $(LIBTOMMATH) $(LIBTOMPOLY) $(LIBFLINT) $(CC) $(CFLAGS) -o $@ $(LDFLAGS) \ - main.o $(LIBTOMPOLY) libpqc.a $(LIBTOMPOLY) $(LIBTOMMATH) $(LIBS) + main.o $(LIBTOMPOLY) libpqc.a $(LIBTOMPOLY) $(LIBTOMMATH) $(LIBFLINT) $(LIBS) install: $(INSTALL_DIR) "$(DESTDIR)$(INSTALL_BINDIR)"