Mercurial > dropbear
comparison libtommath/makefile_include.mk @ 1692:1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
* update C files
* update other files
* update headers
* update makefiles
* remove mp_set/get_double()
* use ltm 1.2.0 API
* update ltm_desc
* use bundled tommath if system-tommath is too old
* XMALLOC etc. were changed to MP_MALLOC etc.
author | Steffen Jaeckel <s@jaeckel.eu> |
---|---|
date | Tue, 26 May 2020 17:36:47 +0200 |
parents | 823592f244c9 |
children | 93e738ef0d9d |
comparison
equal
deleted
inserted
replaced
1691:2d3745d58843 | 1692:1051e4eea25a |
---|---|
1 # | 1 # |
2 # Include makefile for libtommath | 2 # Include makefile for libtommath |
3 # | 3 # |
4 | 4 |
5 #version of library | 5 #version of library |
6 VERSION=1.1.0 | 6 VERSION=1.2.0 |
7 VERSION_PC=1.1.0 | 7 VERSION_PC=1.2.0 |
8 VERSION_SO=2:0:1 | 8 VERSION_SO=3:0:2 |
9 | 9 |
10 PLATFORM := $(shell uname | sed -e 's/_.*//') | 10 PLATFORM := $(shell uname | sed -e 's/_.*//') |
11 | 11 |
12 # default make target | 12 # default make target |
13 default: ${LIBNAME} | 13 default: ${LIBNAME} |
46 else | 46 else |
47 MAKE=make | 47 MAKE=make |
48 endif | 48 endif |
49 endif | 49 endif |
50 | 50 |
51 CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow | 51 LTM_CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow |
52 | |
53 ifdef SANITIZER | |
54 LTM_CFLAGS += -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=float-divide-by-zero | |
55 endif | |
52 | 56 |
53 ifndef NO_ADDTL_WARNINGS | 57 ifndef NO_ADDTL_WARNINGS |
54 # additional warnings | 58 # additional warnings |
55 CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align | 59 LTM_CFLAGS += -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align |
56 CFLAGS += -Wstrict-prototypes -Wpointer-arith | 60 LTM_CFLAGS += -Wstrict-prototypes -Wpointer-arith |
61 endif | |
62 | |
63 ifdef CONV_WARNINGS | |
64 LTM_CFLAGS += -std=c89 -Wconversion -Wsign-conversion | |
65 ifeq ($(CONV_WARNINGS), strict) | |
66 LTM_CFLAGS += -DMP_USE_ENUMS -Wc++-compat | |
67 endif | |
68 else | |
69 LTM_CFLAGS += -Wsystem-headers | |
57 endif | 70 endif |
58 | 71 |
59 ifdef COMPILE_DEBUG | 72 ifdef COMPILE_DEBUG |
60 #debug | 73 #debug |
61 CFLAGS += -g3 | 74 LTM_CFLAGS += -g3 |
62 else | 75 endif |
63 | 76 |
64 ifdef COMPILE_SIZE | 77 ifdef COMPILE_SIZE |
65 #for size | 78 #for size |
66 CFLAGS += -Os | 79 LTM_CFLAGS += -Os |
67 else | 80 else |
68 | 81 |
69 ifndef IGNORE_SPEED | 82 ifndef IGNORE_SPEED |
70 #for speed | 83 #for speed |
71 CFLAGS += -O3 -funroll-loops | 84 LTM_CFLAGS += -O3 -funroll-loops |
72 | 85 |
73 #x86 optimizations [should be valid for any GCC install though] | 86 #x86 optimizations [should be valid for any GCC install though] |
74 CFLAGS += -fomit-frame-pointer | 87 LTM_CFLAGS += -fomit-frame-pointer |
75 endif | 88 endif |
76 | 89 |
77 endif # COMPILE_SIZE | 90 endif # COMPILE_SIZE |
78 endif # COMPILE_DEBUG | |
79 | 91 |
80 ifneq ($(findstring clang,$(CC)),) | 92 ifneq ($(findstring clang,$(CC)),) |
81 CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header | 93 LTM_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header |
82 endif | 94 endif |
83 ifneq ($(findstring mingw,$(CC)),) | 95 ifneq ($(findstring mingw,$(CC)),) |
84 CFLAGS += -Wno-shadow | 96 LTM_CFLAGS += -Wno-shadow |
85 endif | 97 endif |
86 ifeq ($(PLATFORM), Darwin) | 98 ifeq ($(PLATFORM), Darwin) |
87 CFLAGS += -Wno-nullability-completeness | 99 LTM_CFLAGS += -Wno-nullability-completeness |
88 endif | 100 endif |
89 ifeq ($(PLATFORM), CYGWIN) | 101 ifeq ($(PLATFORM), CYGWIN) |
90 LIBTOOLFLAGS += -no-undefined | 102 LIBTOOLFLAGS += -no-undefined |
91 endif | 103 endif |
92 | 104 |
105 # add in the standard FLAGS | |
106 LTM_CFLAGS += $(CFLAGS) | |
107 LTM_LFLAGS += $(LFLAGS) | |
108 LTM_LDFLAGS += $(LDFLAGS) | |
109 LTM_LIBTOOLFLAGS += $(LIBTOOLFLAGS) | |
110 | |
111 | |
93 ifeq ($(PLATFORM),FreeBSD) | 112 ifeq ($(PLATFORM),FreeBSD) |
94 _ARCH := $(shell sysctl -b hw.machine_arch) | 113 _ARCH := $(shell sysctl -b hw.machine_arch) |
95 else | 114 else |
96 _ARCH := $(shell arch) | 115 _ARCH := $(shell uname -m) |
97 endif | 116 endif |
98 | 117 |
99 # adjust coverage set | 118 # adjust coverage set |
100 ifneq ($(filter $(_ARCH), i386 i686 x86_64 amd64 ia64),) | 119 ifneq ($(filter $(_ARCH), i386 i686 x86_64 amd64 ia64),) |
101 COVERAGE = test_standalone timing | 120 COVERAGE = test_standalone timing |
103 else | 122 else |
104 COVERAGE = test_standalone | 123 COVERAGE = test_standalone |
105 COVERAGE_APP = ./test | 124 COVERAGE_APP = ./test |
106 endif | 125 endif |
107 | 126 |
108 HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h | 127 HEADERS_PUB=tommath.h |
109 HEADERS=tommath_private.h $(HEADERS_PUB) | 128 HEADERS=tommath_private.h tommath_class.h tommath_superclass.h tommath_cutoffs.h $(HEADERS_PUB) |
110 | |
111 test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 | |
112 | 129 |
113 #LIBPATH The directory for libtommath to be installed to. | 130 #LIBPATH The directory for libtommath to be installed to. |
114 #INCPATH The directory to install the header files for libtommath. | 131 #INCPATH The directory to install the header files for libtommath. |
115 #DATAPATH The directory to install the pdf docs. | 132 #DATAPATH The directory to install the pdf docs. |
116 DESTDIR ?= | 133 DESTDIR ?= |
119 INCPATH ?= $(PREFIX)/include | 136 INCPATH ?= $(PREFIX)/include |
120 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf | 137 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf |
121 | 138 |
122 #make the code coverage of the library | 139 #make the code coverage of the library |
123 # | 140 # |
124 coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS | 141 coverage: LTM_CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS |
125 coverage: LFLAGS += -lgcov | 142 coverage: LTM_LFLAGS += -lgcov |
126 coverage: LDFLAGS += -lgcov | 143 coverage: LTM_LDFLAGS += -lgcov |
127 | 144 |
128 coverage: $(COVERAGE) | 145 coverage: $(COVERAGE) |
129 $(COVERAGE_APP) | 146 $(COVERAGE_APP) |
130 | 147 |
131 lcov: coverage | 148 lcov: coverage |
140 | 157 |
141 # cleans everything - coverage output and standard 'clean' | 158 # cleans everything - coverage output and standard 'clean' |
142 cleancov: cleancov-clean clean | 159 cleancov: cleancov-clean clean |
143 | 160 |
144 clean: | 161 clean: |
145 rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test timing mpitest mtest/mtest mtest/mtest.exe \ | 162 rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o \ |
146 *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la | 163 demo/*.o test timing mtest_opponent mtest/mtest mtest/mtest.exe tuning_list \ |
147 rm -rf .libs/ | 164 *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la |
148 # ${MAKE} -C etc/ clean MAKE=${MAKE} | 165 rm -rf .libs/ demo/.libs |
149 # ${MAKE} -C doc/ clean MAKE=${MAKE} |