Makefile.ntl 1.75 KB
Newer Older
Gerard Ryan's avatar
Gerard Ryan committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#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.3.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
DISTROS_DIR := $(THIRD_PARTY_DIR)/distros
NTL_DISTRO_DIR := $(DISTROS_DIR)/ntl-$(NTL_VER)/src

#check if gmp has been installed into the correct directory
# and build gmp if not.
ifneq ($(wildcard $(THIRD_PARTY_DIR)/include), )
 $(info Makefile.ntl running GMP install found)
 GMP_NEEDED := 
else
 $(info running Makefile.gmp for GMP install)
 GMP_NEEDED :=gmp_make
endif

all: $(GMP_NEEDED) ntl_unpack ntl_config ntl_make ntl_check ntl_install
	@echo $(all)

clean: clean_ntl


ntl_unpack: 
	@echo 'Unpacking ntl for Palisade into $(NTL_DISTRO_DIR)'
	cd $(DISTROS_DIR);\
	$(TAR) xf ./ntl-$(NTL_VER).tar.gz

ntl_config:
	@echo 'Configuring ntl for Palisade in $(NTL_DISTRO_DIR)'
	cd $(NTL_DISTRO_DIR); \
	./configure PREFIX=$(THIRD_PARTY_DIR) GMP_PREFIX=$(THIRD_PARTY_DIR) NTL_THREADS=on NTL_THREAD_BOOST=on NTL_EXCEPTIONS=on SHARED=on

ntl_make:
	@echo 'making ntl for Palisade in $(NTL_DISTRO_DIR)'
	cd $(NTL_DISTRO_DIR); \
	$(MAKE)

ntl_check:
	@echo 'checking ntl for Palisade in $(NTL_DISTRO_DIR)'
	cd $(NTL_DISTRO_DIR); \
	$(MAKE) check
ntl_install:
	@echo 'installing ntl for Palisade in $(THIRD_PARTY_DIR)'
	cd $(NTL_DISTRO_DIR); \
	$(MAKE) install
clean_ntl:
	@echo 'Cleaning ntl installation'
	cd $(DISTROS_DIR);\
	$(RM) -rf ntl-$(NTL_VER)
	cd $(THIRD_PARTY_DIR); \
	$(RM) -rf include lib share includels
 
gmp_make:
	$(MAKE) -f Makefile.gmp