forked from holybao/PALISADE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.ntl
99 lines (82 loc) · 2.77 KB
/
Makefile.ntl
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#Makefile to build and install ntl in palisade
TAR ?= tar
#note change the following directory to the correct one on your install
PALISADE_DIR := $(CURDIR)
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
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)/distros/lib/libgmp.a), )
#$(info Makefile.ntl: GMP install found)
GMP_NEEDED :=
else
#$(info Makefile.ntl: running Makefile.gmp for GMP install)
GMP_NEEDED := gmp_all
endif
#check if ntl has been unpacked into the correct directory
# and installs it if not.
ifneq ($(wildcard $(THIRD_PARTY_DIR)/distros/ntl-$(NTL_VER)), )
#$(info Makefile.ntl: NTL already unpacked)
NTL_UNPACK_NEEDED :=
else
#$(info Makefile.ntl: unpacking NTL)
NTL_UNPACK_NEEDED :=ntl_unpack
endif
#check if ntl has been installed into the correct directory
# and installs it if not.
ifneq ($(wildcard $(THIRD_PARTY_DIR)/lib/libntl.a), )
#$(info Makefile.ntl: NTL already installed)
NTL_CONFIG_NEEDED :=
NTL_MAKE_NEEDED :=
NTL_CHECK_NEEDED :=
NTL_INSTALL_NEEDED :=
else
#$(info Makefile.ntl: installing NTL)
NTL_CONFIG_NEEDED := ntl_config
NTL_MAKE_NEEDED := ntl_make
#NTL_CHECK_NEEDED := ntl_check
NTL_INSTALL_NEEDED := ntl_install
endif
.PHONY: ntl_all
ntl_all: $(GMP_NEEDED) $(NTL_UNPACK_NEEDED) $(NTL_CONFIG_NEEDED) $(NTL_MAKE_NEEDED) $(NTL_CHECK_NEEDED) $(NTL_INSTALL_NEEDED)
@echo $(all)
.PHONY: ntl_unpack
ntl_unpack:
@echo 'Unpacking ntl for Palisade into $(NTL_DISTRO_DIR)'
cd $(DISTROS_DIR);\
$(TAR) xf ./ntl-$(NTL_VER).tar.gz
.PHONY: ntl_config
ntl_config: $(NTL_UNPACK_NEEDED)
@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_STD_CXX11=on NTL_SAFE_VECTORS=off
.PHONY: ntl_make
ntl_make: ntl_config
@echo 'making ntl for Palisade in $(NTL_DISTRO_DIR)'
cd $(NTL_DISTRO_DIR); \
$(MAKE)
.PHONY: ntl_check
ntl_check: $(NTL_MAKE_NEEDED)
@echo 'checking ntl for Palisade in $(NTL_DISTRO_DIR)'
cd $(NTL_DISTRO_DIR); \
$(MAKE) check
.PHONY: ntl_install
ntl_install: $(NTL_CHECK_NEEDED) $(NTL_MAKE_NEEDED)
@echo 'installing ntl for Palisade in $(THIRD_PARTY_DIR)'
cd $(NTL_DISTRO_DIR); \
$(MAKE) install
.PHONY: clean_ntl
clean_ntl:
@echo 'Cleaning ntl installation'
cd $(DISTROS_DIR);\
$(RM) -rf ntl-$(NTL_VER)
cd $(THIRD_PARTY_DIR); \
$(RM) -rf include/NTL lib share includels