Commit de794a4c authored by Gerard Ryan's avatar Gerard Ryan

Merge branch 'v1.1-candidate' into 'master'

v1.1 release See merge request !1
parents 5993bfbe 86d3d83d
# Ignore everything in this directory # Ignore everything in this directory
*~ *~
*.o *.o
*.gcov
bin/ bin/
build/ build/
test/build test/build
...@@ -10,11 +11,13 @@ apidoc_warning_logfile.txt ...@@ -10,11 +11,13 @@ apidoc_warning_logfile.txt
third-party/distros/gmp-6.1.1 third-party/distros/gmp-6.1.1
third-party/distros/gmp-6.1.2 third-party/distros/gmp-6.1.2
third-party/distros/ntl-10.3.0 third-party/distros/ntl-10.3.0
third-party/distros/ntl-10.5.0
third-party/include third-party/include
third-party/lib third-party/lib
third-party/share third-party/share
timing/
gmon.out gmon.out
.gitattributes ## .gitattributes
# Except this file # Except this file
!.gitignore !.gitignore
output.txt output.txt
......
...@@ -23,13 +23,18 @@ ...@@ -23,13 +23,18 @@
#POSSIBILITY OF SUCH DAMAGE. #POSSIBILITY OF SUCH DAMAGE.
# #
# this defines the source, build (obj) and binary directories
BMARK_SRC := benchmark/src
BMARK_BIN := $(BINDIR)/benchmark
BMARK_BUILD := $(BINDIR)/build/benchmark
BMLIB_SRCDIR := google/benchmark-master/src BMLIB_SRCDIR := google/benchmark-master/src
BMLIB_IFLAG := -I$(BMLIB_SRCDIR)/../include BMLIB_IFLAG := -I$(BMLIB_SRCDIR)/../include
BMLIB_SRC := $(wildcard $(BMLIB_SRCDIR)/*.cc) BMLIB_SRC := $(wildcard $(BMLIB_SRCDIR)/*.cc)
BMLIB_OBJ := $(BMLIB_SRC:.cc=.o) BMLIB_OBJ := $(patsubst $(BMLIB_SRCDIR)/%,$(BMARK_BUILD)/%,$(BMLIB_SRC:.cc=.o))
#this defines the benchmark library archive #this defines the benchmark library archive
BMLIB_LIB := $(BMLIB_SRCDIR)/libbenchmark.a BMLIB_LIB := $(BMARK_BIN)/libbenchmark.a
REGEX_FLAG := -DHAVE_STD_REGEX #note does not work for g++ <version 4.9 REGEX_FLAG := -DHAVE_STD_REGEX #note does not work for g++ <version 4.9
...@@ -42,11 +47,6 @@ WARNING_FLAG := -Wno-unused-but-set-variable ...@@ -42,11 +47,6 @@ WARNING_FLAG := -Wno-unused-but-set-variable
LIBBENCHMARK_FLAGS := $(REGEX_FLAG) -DHAVE_STEADY_CLOCK -DNDEBUG $(WARNING_FLAG) -Wno-unused-variable ##-Wextra -Wshadow -pedantic -pedantic-errors -Wfloat-equal -Wzero-as-null-pointer-constant -fstrict-aliasing -Wstrict-aliasing -Wno-nested-anon-types LIBBENCHMARK_FLAGS := $(REGEX_FLAG) -DHAVE_STEADY_CLOCK -DNDEBUG $(WARNING_FLAG) -Wno-unused-variable ##-Wextra -Wshadow -pedantic -pedantic-errors -Wfloat-equal -Wzero-as-null-pointer-constant -fstrict-aliasing -Wstrict-aliasing -Wno-nested-anon-types
# this defines the source, build (obj) and binary directories
BMARK_SRC := benchmark/src
BMARK_BIN := benchmark/bin
BMARK_BUILD := benchmark/build
#define list of source files (all files with .cc in the BMARK_SRC #define list of source files (all files with .cc in the BMARK_SRC
BM_SOURCES := $(wildcard $(BMARK_SRC)/*.cpp) BM_SOURCES := $(wildcard $(BMARK_SRC)/*.cpp)
...@@ -60,11 +60,13 @@ benchmark: $(BMLIB_LIB) $(BMARKS) ...@@ -60,11 +60,13 @@ benchmark: $(BMLIB_LIB) $(BMARKS)
# this builds objects from sources for benchmark library # this builds objects from sources for benchmark library
.PRECIOUS: $(BMLIB_SRCDIR)/%.o .PRECIOUS: $(BMLIB_SRCDIR)/%.o
$(BMLIB_SRCDIR)/%.o: $(BMLIB_SRCDIR)/%.cc $(BMARK_BUILD)/%.o: $(BMLIB_SRCDIR)/%.cc
@mkdir -p $(BMARK_BUILD)
$(CC) $(CPPFLAGS) $(LIBBENCHMARK_FLAGS) $(BMLIB_IFLAG) -o $@ -c $< $(CC) $(CPPFLAGS) $(LIBBENCHMARK_FLAGS) $(BMLIB_IFLAG) -o $@ -c $<
.PRECIOUS: $(BMLIB_LIB) .PRECIOUS: $(BMLIB_LIB)
$(BMLIB_LIB): $(BMLIB_OBJ) $(BMLIB_LIB): $(BMLIB_OBJ)
@mkdir -p $(BMARK_BIN)
ar cr $(BMLIB_LIB) $(BMLIB_OBJ) ar cr $(BMLIB_LIB) $(BMLIB_OBJ)
ranlib $(BMLIB_LIB) ranlib $(BMLIB_LIB)
...@@ -76,17 +78,18 @@ BMLIB_LIBSRCDIR := google/benchmark-master/include ...@@ -76,17 +78,18 @@ BMLIB_LIBSRCDIR := google/benchmark-master/include
#this is is the Include directive for the palisade code being benchmarked #this is is the Include directive for the palisade code being benchmarked
BM_IFLAG := -Isrc/core/lib -Isrc/pke/lib $(BMLIB_IFLAG) $(NTLINCLUDE) $(GMPINCLUDE) BM_IFLAG := -Isrc/core/lib -Isrc/pke/lib $(BMLIB_IFLAG) $(NTLINCLUDE) $(GMPINCLUDE)
PLIBS := $(EXTLIBDIR)/$(PALISADEPKELIB) $(EXTLIBDIR)/$(PALISADECORELIB) PLIBS := $(EXTLIBDIR)/$(PALISADEPKELIB) $(EXTLIBDIR)/$(PALISADECORELIB) $(NTLLIB) $(GMPLIB)
# this builds executables from objects for benchmarks # this builds executables from objects for benchmarks
benchmark/bin/%$(EXESUFFIX): benchmark/build/%.o $(BMLIB_LIB) $(PLIBS) $(BMARK_BIN)/%$(EXESUFFIX): $(BMARK_BUILD)/%.o $(BMLIB_LIB) $(PLIBS)
@mkdir -p $(BMARK_BIN) @mkdir -p $(BMARK_BIN)
$(CC) $(BM_IFLAG) $(LIBBENCHMARK_FLAGS) $< -o $@ $(PLIBS) $(RDYNAMIC) $(BMLIB_LIB) $(EXTLIB) $(MINGWREGEX) $(CC) $(BM_IFLAG) $(LIBBENCHMARK_FLAGS) $(BMLIB_IFLAG) $< -o $@ $(LOADTHREADFLAG) $(RDYNAMIC) $(BMLIB_LIB) -L$(EXTLIBDIR) -lPALISADEpke -lPALISADEcore $(NTLLIB) $(GMPLIB) -lpthread $(LOADTHREADFLAG) -fopenmp -lgomp $(SHLWAPI)
# this builds objects from sources for benchmarks # this builds objects from sources for benchmarks
.PRECIOUS: benchmark/build/%.o .PRECIOUS: $(BMARK_BUILD)/%.o
benchmark/build/%.o: benchmark/src/%.cpp $(BMARK_BUILD)/%.o: $(BMARK_SRC)/%.cpp
@mkdir -p benchmark/build @mkdir -p $(BMARK_BUILD)
@$(CC) -MM $(CPPFLAGS) $(BM_IFLAG) $(LIBBENCHMARK_FLAGS) $(BM_IFLAG) $(patsubst $(BMARK_BUILD)/%,$(BMARK_SRC)/%,$(patsubst %.o,%.cpp,$@)) > $(patsubst %.o,%.d,$@) @$(CC) -MM $(CPPFLAGS) $(BM_IFLAG) $(LIBBENCHMARK_FLAGS) $(BM_IFLAG) $(patsubst $(BMARK_BUILD)/%,$(BMARK_SRC)/%,$(patsubst %.o,%.cpp,$@)) > $(patsubst %.o,%.d,$@)
@mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d.tmp,$@) @mv -f $(patsubst %.o,%.d,$@) $(patsubst %.o,%.d.tmp,$@)
@sed -e 's|.*\.o:|$@:|' < $(patsubst %.o,%.d.tmp,$@) > $(patsubst %.o,%.d,$@) @sed -e 's|.*\.o:|$@:|' < $(patsubst %.o,%.d.tmp,$@) > $(patsubst %.o,%.d,$@)
...@@ -100,4 +103,8 @@ cleanbenchmark: ...@@ -100,4 +103,8 @@ cleanbenchmark:
$(RM) -r $(BMARK_BIN) $(BMARK_BUILD) $(BMLIB_OBJ) $(BMLIB_LIB) $(RM) -r $(BMARK_BIN) $(BMARK_BUILD) $(BMLIB_OBJ) $(BMLIB_LIB)
bstrings: bstrings:
@echo $(BMARKS) @echo BMARKS is $(BMARKS)
@echo BMLIB_SRC is $(BMLIB_SRC)
@echo BMLIB_OBJ is $(BMLIB_OBJ)
@echo $(BMLIB_SRC:.cc=.o)
@echo $(BMLIB_SRCDIR)
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
# Makefile.circuit-disable ; no actual build # Makefile.circuit-disable ; no actual build
################ ################
circuitstring:
allcircuit: allcircuit:
allcircuitdemos: allcircuitdemos:
......
...@@ -29,8 +29,7 @@ ...@@ -29,8 +29,7 @@
# for making all the palisade components # for making all the palisade components
################ ################
TEST_LIB := $(LOADTHREADFLAG) -fopenmp $(GMPLIB) -lgomp
# NOTE select the appropriate set of CPPFLAGS # NOTE select the appropriate set of CPPFLAGS
# most code is checked into git with the first line active # most code is checked into git with the first line active
...@@ -40,31 +39,52 @@ ...@@ -40,31 +39,52 @@
#CPPFLAGS += -Wall -Ofast -w -fopenmp -g ##undefine for parallel debug operation #CPPFLAGS += -Wall -Ofast -w -fopenmp -g ##undefine for parallel debug operation
#CPPFLAGS += -Wall -O3 -w -DNDEBUG -pg ##undefine for single thread best performance operation with gprof profiling #CPPFLAGS += -Wall -O3 -w -DNDEBUG -pg ##undefine for single thread best performance operation with gprof profiling
##parallel best performance operation with debug
##warn everything
##no threading or optimization when doing coverage testing
CPPFLAGS += -g -Wall -Werror
## handle coverage test options if user set COVERAGE to any value on the command line
ifdef COVERAGE
CPPFLAGS += --coverage -Wno-unknown-pragmas
TEST_LIB += --coverage
LIBSUFFIX=.a
LIBCMD=$(AR) crv
else
CPPFLAGS += -O3 -fopenmp $(COMPTHREADFLAG) ##optimize and threads
endif
## set backend if user set it on the command line
ifdef BACKEND
CPPFLAGS += -DMATHBACKEND=$(BACKEND)
endif
## turn on openmp loop parallelization in the library code
## currently turns on loop parallelization only for the Matrix class
ifdef OMP
CPPFLAGS += -DOMP=$(OMP)
endif
#main best performance configuration for parallel operation - cross-platform
CPPFLAGS += -g -Wall -Werror -O3 -fopenmp $(COMPTHREADFLAG) ##undefine for parallel best performance operation with debug
#CPPFLAGS += -Wall -O3 -w -fopenmp -m64 -DNDEBUG ##undefine for parallel best performance operation with no debug #CPPFLAGS += -Wall -O3 -w -fopenmp -m64 -DNDEBUG ##undefine for parallel best performance operation with no debug
#THE OPTIONS BELOW SHOULD BE USED WITH CARE AS THEY USE A LOT OF AGGRESSIVE OPTIMIZATION OPTIONS #THE OPTIONS BELOW SHOULD BE USED WITH CARE AS THEY USE A LOT OF AGGRESSIVE OPTIMIZATION OPTIONS
#CPPFLAGS += -Wall -w -DNDEBUG -m64 -Ofast -flto -march=native -funroll-loops ##undefine for single thread best performance operation #CPPFLAGS += -Wall Werror -DNDEBUG -m64 -Ofast -flto -march=native -funroll-loops ##undefine for single thread best performance operation
#CPPFLAGS += -Wall -w -DNDEBUG -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation #CPPFLAGS += -Wall -Werror -DNDEBUG -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation
#CPPFLAGS += -Wall -w -m64 -Ofast -flto -march=native -funroll-loops -fopenmp -DNDEBUG ##undefine for multithread really best performance operation #CPPFLAGS += -Wall -Werror -m64 -Ofast -flto -march=native -funroll-loops -fopenmp -DNDEBUG ##undefine for multithread really best performance operation
#CPPFLAGS += -Wall -w -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation #CPPFLAGS += -Wall -Werror -m64 -Ofast -flto -march=native -funroll-loops -fopenmp ##undefine for multithread really best performance operation
TEST_LIB := $(LOADTHREADFLAG) -fopenmp $(NTLLIB) $(GMPLIB) -lgomp
#build directory #build directory
BUILDDIR := build BUILDDIR := build
#bin directory #bin directory
BINDIR := bin BINDIR ?= bin
#sources for palisade library #sources for palisade library
EXTLIBDIR := bin/lib EXTLIBDIR := $(BINDIR)/lib
EXTTESTDIR := bin/unittest EXTTESTDIR := $(BINDIR)/unittest
EXTDEMODIR := bin/demo EXTDEMODIR := $(BINDIR)/demo
# extentions for source and header files # extentions for source and header files
SRCEXT := cpp SRCEXT := cpp
...@@ -75,9 +95,7 @@ $(objects) : %.o : %.cpp ...@@ -75,9 +95,7 @@ $(objects) : %.o : %.cpp
NTLINCLUDE := -I third-party/include NTLINCLUDE := -I third-party/include
GMPINCLUDE := -I third-party/include GMPINCLUDE := -I third-party/include
#DBC added NTL and GML lubraries and turn off profiling EXTLIB := -L$(EXTLIBDIR) $(TEST_LIB) #no profiling
#EXTLIB := -L$(EXTLIBDIR) $(TEST_LIB) -pg #-lmongoclient -L lib -lboost_thread-mt -lboost_filesystem-mt -lboost_system-mt ## include profiling
EXTLIB := -L$(EXTLIBDIR) $(NTLLIB) $(GMPLIB) $(TEST_LIB) #no profiling
INC := -I src/core/lib -I src/pke/lib -I src/trapdoor/lib -I src/circuit/lib -I test $(OMPINCLUDE) $(NTLINCLUDE) $(GMPINCLUDE) INC := -I src/core/lib -I src/pke/lib -I src/trapdoor/lib -I src/circuit/lib -I test $(OMPINCLUDE) $(NTLINCLUDE) $(GMPINCLUDE)
...@@ -90,9 +108,12 @@ PALISADECIRCUITLIB := libPALISADEcircuit$(LIBSUFFIX) ...@@ -90,9 +108,12 @@ PALISADECIRCUITLIB := libPALISADEcircuit$(LIBSUFFIX)
PALISADEPYLIB := pycrypto$(LIBSUFFIX) PALISADEPYLIB := pycrypto$(LIBSUFFIX)
# run make for all components. you can run any individual component separately # run make for all components. you can run any individual component separately
# by invoking "make alltargets" for example # by invoking "make allxxx" for example, make allcore makes everything in core only
# each corresponding makefile will make the allxxxx target
all: allcore allpke alltrapdoor allcircuit all:
$(MAKE) gmp_all
$(MAKE) ntl_all
$(MAKE) allcore allpke alltrapdoor allcircuit utall
docs: apidocs docs: apidocs
...@@ -102,26 +123,40 @@ allpython: allcore allpke alltrapdoor pywrapper ...@@ -102,26 +123,40 @@ allpython: allcore allpke alltrapdoor pywrapper
alldemos: allcoredemos allpkedemos alltrapdoordemos allcircuitdemos alldemos: allcoredemos allpkedemos alltrapdoordemos allcircuitdemos
testall: testcore testpke testtrapdoor testcircuit testall: $(CORE_TEST_TARGET) $(PKE_TEST_TARGET) $(TRAPDOOR_TEST_TARGET) $(CIRCUIT_TEST_TARGET) utall
$(BINDIR)/unittest/tests$(EXESUFFIX) -t
# clean up all components. you can clean any individual compoenent separately # clean up all components. you can clean any individual compoenent separately
# by invoking "make cleantargets" for example # by invoking "make cleantargets" for example
# each corresponding makefile will make the cleanxxxx target # each corresponding makefile will make the cleanxxxx target
.PHONEY: clean .PHONEY: clean clobber
clean: cleancore cleanpke cleantrapdoor cleancircuit cleandocs cleanbenchmark clean: cleancore cleanpke cleantrapdoor cleancircuit cleandocs cleanbenchmark
@echo 'Cleaning top level autogenerated directories' @echo 'Cleaning top level autogenerated directories'
$(RM) -f test/include/gtest/gtest-all.o $(RM) -rf $(BINDIR)
$(RM) -rf bin $(RM) -rf src/*/bin
clobber: clean clean_gmp clean_ntl
UNITTESTMAINOBJ := $(BINDIR)/unittest/Main_TestAll.o
$(UNITTESTMAINOBJ): test/include/gtest/Main_TestAll.cpp src/core/lib/math/backend.h
@mkdir -p $(BINDIR)/unittest
$(CC) -c $(CPPFLAGS) $(INC) -o $@ $<
utall: $(BINDIR)/unittest/tests$(EXESUFFIX)
include Makefile.core include Makefile.core
include Makefile.pke include Makefile.pke
include Makefile.trapdoor include Makefile.trapdoor
include Makefile.circuit include Makefile.circuit
include Makefile.gmp
include Makefile.ntl
include Makefile.wrapper include Makefile.wrapper
include Makefile.benchmark #builds the benchmark framework include Makefile.benchmark #builds the benchmark framework
include Makefile.docs #populates doxgen documentation include Makefile.docs #populates doxgen documentation
test/include/gtest/gtest-all.o: test/include/gtest/gtest-all.cc $(BINDIR)/unittest/tests$(EXESUFFIX): $(UNITTESTMAINOBJ) $(COREUNITOBJECTS) $(EXTLIBDIR)/$(PALISADECORELIB) $(PKEUNITOBJECTS) $(EXTLIBDIR)/$(PALISADEPKELIB) $(TRAPDOORUNITOBJECTS) $(EXTLIBDIR)/$(PALISADETRAPDOORLIB) $(NTLLIB) $(GMPLIB)
$(CC) -c $(CPPFLAGS) -o $@ $< @mkdir -p $(BINDIR)/unittest
$(CC) -o $@ $(UNITTESTMAINOBJ) $(COREUNITOBJECTS) $(PKEUNITOBJECTS) $(TRAPDOORUNITOBJECTS) $(EXTLIB) -lPALISADEtrapdoor -lPALISADEpke -lPALISADEcore $(TEST_LIB) $(NTLLIB) $(GMPLIB)
...@@ -30,39 +30,42 @@ ...@@ -30,39 +30,42 @@
################ ################
CORESRCDIR := src/core CORESRCDIR := src/core
COREBINDIR := src/core/bin COREBINDIR := $(BINDIR)/build/core
CORETESTDIR := src/core/unittest CORETESTDIR := src/core/unittest
COREDEMODIR := src/core/demo COREDEMODIR := src/core/demo
CORESOURCES := $(shell find $(CORESRCDIR)/lib -name '*.cpp') CORESOURCES := $(shell find $(CORESRCDIR)/lib -name '*.cpp' ! -name '*-public.cpp')
COREUNITSOURCES := $(wildcard $(CORESRCDIR)/unittest/*.cpp) COREUNITSOURCES := $(wildcard $(CORESRCDIR)/unittest/*.cpp)
COREDEMOSOURCES := $(wildcard $(CORESRCDIR)/demo/*.cpp) COREDEMOSOURCES := $(wildcard $(CORESRCDIR)/demo/*.cpp)
COREOBJECTS := $(patsubst $(CORESRCDIR)/%,$(COREBINDIR)/%,$(patsubst %.cpp,%.o,$(CORESOURCES))) COREOBJECTS := $(patsubst $(CORESRCDIR)/%,$(COREBINDIR)/%,$(patsubst %.cpp,%.o,$(CORESOURCES)))
COREUNITOBJECTS := $(patsubst $(CORESRCDIR)/%,$(COREBINDIR)/%,$(patsubst %.cpp,%.o,$(COREUNITSOURCES))) COREUNITOBJECTS := $(patsubst $(CORESRCDIR)/%,$(COREBINDIR)/%,$(patsubst %.cpp,%.o,$(COREUNITSOURCES)))
COREUNITOBJECTS += test/include/gtest/gtest-all.o
COREDEMOOBJECTS := $(patsubst $(CORESRCDIR)/%,$(COREBINDIR)/%,$(patsubst %.cpp,%.o,$(COREDEMOSOURCES))) COREDEMOOBJECTS := $(patsubst $(CORESRCDIR)/%,$(COREBINDIR)/%,$(patsubst %.cpp,%.o,$(COREDEMOSOURCES)))
TEST_TARGET := $(EXTTESTDIR)/core/tests$(EXESUFFIX) CORE_TEST_TARGET := $(EXTTESTDIR)/core/tests$(EXESUFFIX)
-include $(COREOBJECTS:.o=.d) -include $(COREOBJECTS:.o=.d)
-include $(COREUNITOBJECTS:.o=.d) -include $(COREUNITOBJECTS:.o=.d)
-include $(COREDEMOOBJECTS:.o=.d) -include $(COREDEMOOBJECTS:.o=.d)
.PHONY:allcore .PHONY:allcore
allcore: $(EXTLIBDIR)/$(PALISADECORELIB) $(TEST_TARGET) allcoredemos allcore: $(EXTLIBDIR)/$(PALISADECORELIB) $(CORE_TEST_TARGET) allcoredemos
allcoredemos: $(EXTLIBDIR)/$(PALISADECORELIB) $(patsubst $(COREBINDIR)/demo/%,bin/demo/core/%,$(patsubst %.o,%$(EXESUFFIX),$(COREDEMOOBJECTS))) allcoredemos: $(EXTLIBDIR)/$(PALISADECORELIB) $(patsubst $(COREBINDIR)/demo/%,$(BINDIR)/demo/core/%,$(patsubst %.o,%$(EXESUFFIX),$(COREDEMOOBJECTS)))
bin/demo/core/%$(EXESUFFIX): src/core/bin/demo/%.o $(EXTLIBDIR)/$(PALISADECORELIB) $(BINDIR)/demo/core/%$(EXESUFFIX): $(COREBINDIR)/demo/%.o $(EXTLIBDIR)/$(PALISADECORELIB) $(NTLLIB) $(GMPLIB)
@mkdir -p $(@D) @mkdir -p $(@D)
$(CC) -o $@ $^ $(EXTLIB) -lPALISADEcore $(CC) -o $@ $< $(EXTLIB) -lPALISADEcore $(NTLLIB) $(GMPLIB)
#this builds the palisade library out of the objects #this builds the palisade library out of the objects
$(EXTLIBDIR)/$(PALISADECORELIB): $(COREOBJECTS) $(EXTLIBDIR)/$(PALISADECORELIB): $(COREOBJECTS) $(NTLLIB) $(GMPLIB)
@echo " -- core:linking $@ from COREOBJECTS" @echo " -- core:linking $@ from COREOBJECTS"
mkdir -p $(EXTLIBDIR) @mkdir -p $(EXTLIBDIR)
$(CC) $(LIBCMD) -o $@ $(COREOBJECTS) $(TEST_LIB) ifdef COVERAGE
$(LIBCMD) $@ $(COREOBJECTS)
else
$(LIBCMD) $@ $(COREOBJECTS) $(NTLLIB) $(GMPLIB)
endif
### #this builds the individual objects that make up the library . ### #this builds the individual objects that make up the library .
.PRECIOUS: $(COREBINDIR)/% .PRECIOUS: $(COREBINDIR)/%
...@@ -82,15 +85,18 @@ $(COREBINDIR)/%: ...@@ -82,15 +85,18 @@ $(COREBINDIR)/%:
.PHONY: cleancore .PHONY: cleancore
cleancore: cleancore:
$(RM) -fr $(COREBINDIR) $(EXTLIBDIR)/$(PALISADECORELIB) `dirname $(TEST_TARGET)` bin/demo/core $(RM) -fr $(COREBINDIR) $(EXTLIBDIR)/$(PALISADECORELIB) `dirname $(CORE_TEST_TARGET)` $(BINDIR)/demo/core
# this links test executable from objects in the test build directory # this links test executable from objects in the test build directory
$(TEST_TARGET): $(COREUNITOBJECTS) $(EXTLIBDIR)/$(PALISADECORELIB) $(CORE_TEST_TARGET): $(UNITTESTMAINOBJ) $(COREUNITOBJECTS) $(EXTLIBDIR)/$(PALISADECORELIB) $(NTLLIB) $(GMPLIB)
@mkdir -p `dirname $(TEST_TARGET)` @mkdir -p `dirname $(CORE_TEST_TARGET)`
$(CC) -o $(TEST_TARGET) $^ $(EXTLIB) $(TEST_LIB) $(CC) -o $(CORE_TEST_TARGET) $(UNITTESTMAINOBJ) $(COREUNITOBJECTS) $(EXTLIB) -lPALISADEcore $(NTLLIB) $(GMPLIB) $(TEST_LIB)
#used to run tests from make #used to run tests from make
.PHONY: testcore .PHONY: testcore
testcore: $(TEST_TARGET) testcore: $(CORE_TEST_TARGET)
$(TEST_TARGET) $(CORE_TEST_TARGET)
corestrings:
@echo $(CORESOURCES)
@echo $(COREOBJECTS)
#Makefile to build and install gmp in palisade
TAR ?= tar
#note change the following directory to the correct one on your install
PALISADE_DIR := $(PWD)
GMP_VER :=6.1.2
#check if the palisade directory is correct
#ifneq ($(wildcard $(PALISADE_DIR)), )
# $(info Makefile.gmp running)
#else
# $(info Makefile.gmp needs to be updated for correct PALISADE_DIR directory)
#endif
THIRD_PARTY_DIR := $(PALISADE_DIR)/third-party
DISTROS_DIR := $(THIRD_PARTY_DIR)/distros
GMP_DISTRO_DIR := $(DISTROS_DIR)/gmp-$(GMP_VER)
#check if gmp has been unpacked into the correct directory
# and installs it if not.
ifneq ($(wildcard $(THIRD_PARTY_DIR)/distros/gmp-$(GMP_VER)), )
#$(info Makefile.gmp: GMP already unpacked)
GMP_UNPACK_NEEDED :=
else
#$(info Makefile.gmp: unpacking GMP)
GMP_UNPACK_NEEDED := gmp_unpack
endif
#check if gmp has been installed into the correct directory
# and installs it if not.
ifneq ($(wildcard $(THIRD_PARTY_DIR)/lib/libgmp.a), )
#$(info Makefile.gmp: GMP already installed)
GMP_CONFIG_NEEDED :=
GMP_MAKE_NEEDED :=
GMP_CHECK_NEEDED :=
GMP_INSTALL_NEEDED :=
else
#$(info Makefile.gmp: installing GMP)
GMP_CONFIG_NEEDED := gmp_config
GMP_MAKE_NEEDED := gmp_make
#GMP_CHECK_NEEDED := gmp_check
GMP_INSTALL_NEEDED := gmp_install
endif
$(GMPLIB): gmp_all
gmp_all: $(GMP_UNPACK_NEEDED) $(GMP_CONFIG_NEEDED) $(GMP_MAKE_NEEDED) $(GMP_CHECK_NEEDED) $(GMP_INSTALL_NEEDED)
gmp_unpack:
@echo 'Unpacking gmp for Palisade into $(GMP_DISTRO_DIR)'
cd $(DISTROS_DIR);\
$(TAR) xf ./gmp-$(GMP_VER).tar.lz
gmp_config: $(GMP_UNPACK_NEEDED)
@echo 'Configuring gmp for Palisade in $(GMP_DISTRO_DIR)'
cd $(GMP_DISTRO_DIR); \
./configure --prefix=$(THIRD_PARTY_DIR);
gmp_make: gmp_config
@echo 'making gmp for Palisade in $(GMP_DISTRO_DIR)'
cd $(GMP_DISTRO_DIR); \
$(MAKE)
gmp_check: $(GMP_MAKE_NEEDED)
@echo 'checking gmp for Palisade in $(GMP_DISTRO_DIR)'
cd $(GMP_DISTRO_DIR); \
$(MAKE) check
gmp_install: $(GMP_CHECK_NEEDED) $(GMP_MAKE_NEEDED)
@echo 'installing gmp for Palisade in $(THIRD_PARTY_DIR)'
cd $(GMP_DISTRO_DIR); \
$(MAKE) install
clean_gmp:
@echo 'Cleaning gmp installation'
cd $(DISTROS_DIR);\
$(RM) -rf gmp-$(GMP_VER)
cd $(THIRD_PARTY_DIR); \
$(RM) -rf include lib share
...@@ -22,7 +22,7 @@ CPPSTD := -std=gnu++11 -fPIC ...@@ -22,7 +22,7 @@ CPPSTD := -std=gnu++11 -fPIC
CC := g++ $(CPPSTD) CC := g++ $(CPPSTD)
LIBSUFFIX := .so LIBSUFFIX := .so
LIBCMD := -fPIC -shared -Wl,--export-dynamic -fopenmp LIBCMD := $(CC) -fPIC -shared -Wl,--export-dynamic -fopenmp -o #libname to follow
RDYNAMIC := -rdynamic RDYNAMIC := -rdynamic
......
## for mac OSx ## for mac OSx
TAR := gnutar
OMPINCLUDE := -I /opt/local/include/libomp -fopenmp OMPINCLUDE := -I /opt/local/include/libomp -fopenmp
ifneq ($(wildcard third-party/include), )
NTLLIB := third-party/lib/libntl.dylib
GMPLIB := third-party/lib/libgmp.dylib
endif
CPPSTD := -std=c++11 -stdlib=libc++ -fPIC CPPSTD := -std=c++11 -stdlib=libc++ -fPIC
CC := /opt/local/bin/clang++ $(CPPSTD) CC := /opt/local/bin/clang++ $(CPPSTD)
BISON := /opt/local/bin/bison BISON := /opt/local/bin/bison
FLEX := /opt/local/bin/flex FLEX := /opt/local/bin/flex
LIBSUFFIX := .dylib LIBSUFFIX := .dylib
LIBCMD := -dynamiclib -undefined suppress -flat_namespace -fopenmp LIBCMD := $(CC) -dynamiclib -undefined suppress -flat_namespace -fopenmp -o #libname to follow
RDYNAMIC := RDYNAMIC :=
......
...@@ -6,17 +6,24 @@ BOOSTLIB := -L C:/boost_1_60_0/stage/lib/ ...@@ -6,17 +6,24 @@ BOOSTLIB := -L C:/boost_1_60_0/stage/lib/
#BOOSTINCLUDE := #BOOSTINCLUDE :=
#BOOSTLIB := #BOOSTLIB :=
ifneq ($(wildcard third-party/include), )
#$(info GMP/NTL directory third-party/include exists)
NTLLIB := third-party/lib/libntl.a
GMPLIB := third-party/lib/libgmp.a
else
#$(info GMP/NTL directory third-party does not exist)
endif
OMPINCLUDE := OMPINCLUDE :=
CPPSTD := -std=gnu++11 CPPSTD := -std=gnu++11
CC := g++ $(CPPSTD) CC := g++ $(CPPSTD)
LIBCMD := -s -shared -Wl,--subsystem,windows -fopenmp LIBCMD := $(CC) -s -shared -Wl,--subsystem,windows -fopenmp -o #libname to follow
LIBSUFFIX := .dll LIBSUFFIX := .dll
EXESUFFIX := .exe EXESUFFIX := .exe
MINGWREGEX := -Lc:/Mingw64/mingw64/opt/lib -lregex -lshlwapi SHLWAPI := -lshlwapi
RDYNAMIC := RDYNAMIC :=
JNIBUILD := -I "C:/Program Files/java/jdk1.8.0_91/include" -I "C:/Program Files/java/jdk1.8.0_91/include/win32" JNIBUILD := -I "C:/Program Files/java/jdk1.8.0_91/include" -I "C:/Program Files/java/jdk1.8.0_91/include/win32"
......
#Makefile to build and install ntl in palisade
TAR ?= tar
#note change the following directory to the correct one on your install
PALISADE_DIR := $(PWD)
NTL_VER:= 10.5.0
#check if the palisade directory is correct
#ifneq ($(wildcard $(PALISADE_DIR)), )
# $(info Makefile.ntl running PALISADE_DIR found)
#else
# $(info Makefile.ntl needs to be updated for correct PALISADE_DIR directory)
#endif
THIRD_PARTY_DIR := $(PALISADE_DIR)/third-party