Mercurial > dropbear
annotate libtommath/makefile_include.mk @ 1696:d18fa38c1fd4
initialise variable to stop warning
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 28 May 2020 22:02:03 +0800 |
parents | 1051e4eea25a |
children | 93e738ef0d9d |
rev | line source |
---|---|
1470 | 1 # |
2 # Include makefile for libtommath | |
3 # | |
4 | |
5 #version of library | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
6 VERSION=1.2.0 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
7 VERSION_PC=1.2.0 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
8 VERSION_SO=3:0:2 |
1470 | 9 |
10 PLATFORM := $(shell uname | sed -e 's/_.*//') | |
11 | |
12 # default make target | |
13 default: ${LIBNAME} | |
14 | |
15 # Compiler and Linker Names | |
16 ifndef CROSS_COMPILE | |
17 CROSS_COMPILE= | |
18 endif | |
19 | |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
20 # We only need to go through this dance of determining the right compiler if we're using |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
21 # cross compilation, otherwise $(CC) is fine as-is. |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
22 ifneq (,$(CROSS_COMPILE)) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
23 ifeq ($(origin CC),default) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
24 CSTR := "\#ifdef __clang__\nCLANG\n\#endif\n" |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
25 ifeq ($(PLATFORM),FreeBSD) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
26 # XXX: FreeBSD needs extra escaping for some reason |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
27 CSTR := $$$(CSTR) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
28 endif |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
29 ifneq (,$(shell echo $(CSTR) | $(CC) -E - | grep CLANG)) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
30 CC := $(CROSS_COMPILE)clang |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
31 else |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
32 CC := $(CROSS_COMPILE)gcc |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
33 endif # Clang |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
34 endif # cc is Make's default |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
35 endif # CROSS_COMPILE non-empty |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
36 |
1657
823592f244c9
Bring back Dropbear patch to avoid setting AR/LD/RANLIB in LTM
Matt Johnston <matt@ucc.asn.au>
parents:
1655
diff
changeset
|
37 # Dropbear passes these down |
823592f244c9
Bring back Dropbear patch to avoid setting AR/LD/RANLIB in LTM
Matt Johnston <matt@ucc.asn.au>
parents:
1655
diff
changeset
|
38 #LD=$(CROSS_COMPILE)ld |
823592f244c9
Bring back Dropbear patch to avoid setting AR/LD/RANLIB in LTM
Matt Johnston <matt@ucc.asn.au>
parents:
1655
diff
changeset
|
39 #AR=$(CROSS_COMPILE)ar |
823592f244c9
Bring back Dropbear patch to avoid setting AR/LD/RANLIB in LTM
Matt Johnston <matt@ucc.asn.au>
parents:
1655
diff
changeset
|
40 #RANLIB=$(CROSS_COMPILE)ranlib |
1470 | 41 |
42 ifndef MAKE | |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
43 # BSDs refer to GNU Make as gmake |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
44 ifneq (,$(findstring $(PLATFORM),FreeBSD OpenBSD DragonFly NetBSD)) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
45 MAKE=gmake |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
46 else |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
47 MAKE=make |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
48 endif |
1470 | 49 endif |
50 | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
51 LTM_CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
52 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
53 ifdef SANITIZER |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
54 LTM_CFLAGS += -fsanitize=undefined -fno-sanitize-recover=all -fno-sanitize=float-divide-by-zero |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
55 endif |
1470 | 56 |
57 ifndef NO_ADDTL_WARNINGS | |
58 # additional warnings | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
59 LTM_CFLAGS += -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
60 LTM_CFLAGS += -Wstrict-prototypes -Wpointer-arith |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
61 endif |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
62 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
63 ifdef CONV_WARNINGS |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
64 LTM_CFLAGS += -std=c89 -Wconversion -Wsign-conversion |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
65 ifeq ($(CONV_WARNINGS), strict) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
66 LTM_CFLAGS += -DMP_USE_ENUMS -Wc++-compat |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
67 endif |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
68 else |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
69 LTM_CFLAGS += -Wsystem-headers |
1470 | 70 endif |
71 | |
72 ifdef COMPILE_DEBUG | |
73 #debug | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
74 LTM_CFLAGS += -g3 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
75 endif |
1470 | 76 |
77 ifdef COMPILE_SIZE | |
78 #for size | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
79 LTM_CFLAGS += -Os |
1470 | 80 else |
81 | |
82 ifndef IGNORE_SPEED | |
83 #for speed | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
84 LTM_CFLAGS += -O3 -funroll-loops |
1470 | 85 |
86 #x86 optimizations [should be valid for any GCC install though] | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
87 LTM_CFLAGS += -fomit-frame-pointer |
1470 | 88 endif |
89 | |
90 endif # COMPILE_SIZE | |
91 | |
92 ifneq ($(findstring clang,$(CC)),) | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
93 LTM_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header |
1470 | 94 endif |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
95 ifneq ($(findstring mingw,$(CC)),) |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
96 LTM_CFLAGS += -Wno-shadow |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
97 endif |
1470 | 98 ifeq ($(PLATFORM), Darwin) |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
99 LTM_CFLAGS += -Wno-nullability-completeness |
1470 | 100 endif |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
101 ifeq ($(PLATFORM), CYGWIN) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
102 LIBTOOLFLAGS += -no-undefined |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
103 endif |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
104 |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
105 # add in the standard FLAGS |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
106 LTM_CFLAGS += $(CFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
107 LTM_LFLAGS += $(LFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
108 LTM_LDFLAGS += $(LDFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
109 LTM_LIBTOOLFLAGS += $(LIBTOOLFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
110 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
111 |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
112 ifeq ($(PLATFORM),FreeBSD) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
113 _ARCH := $(shell sysctl -b hw.machine_arch) |
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
114 else |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
115 _ARCH := $(shell uname -m) |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
116 endif |
1470 | 117 |
118 # adjust coverage set | |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
119 ifneq ($(filter $(_ARCH), i386 i686 x86_64 amd64 ia64),) |
1470 | 120 COVERAGE = test_standalone timing |
1655
f52919ffd3b1
update ltm to 1.1.0 and enable FIPS 186.4 compliant key-generation (#79)
Steffen Jaeckel <s_jaeckel@gmx.de>
parents:
1522
diff
changeset
|
121 COVERAGE_APP = ./test && ./timing |
1470 | 122 else |
123 COVERAGE = test_standalone | |
124 COVERAGE_APP = ./test | |
125 endif | |
126 | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
127 HEADERS_PUB=tommath.h |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
128 HEADERS=tommath_private.h tommath_class.h tommath_superclass.h tommath_cutoffs.h $(HEADERS_PUB) |
1470 | 129 |
130 #LIBPATH The directory for libtommath to be installed to. | |
131 #INCPATH The directory to install the header files for libtommath. | |
132 #DATAPATH The directory to install the pdf docs. | |
133 DESTDIR ?= | |
134 PREFIX ?= /usr/local | |
135 LIBPATH ?= $(PREFIX)/lib | |
136 INCPATH ?= $(PREFIX)/include | |
137 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf | |
138 | |
139 #make the code coverage of the library | |
140 # | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
141 coverage: LTM_CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
142 coverage: LTM_LFLAGS += -lgcov |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
143 coverage: LTM_LDFLAGS += -lgcov |
1470 | 144 |
145 coverage: $(COVERAGE) | |
146 $(COVERAGE_APP) | |
147 | |
148 lcov: coverage | |
149 rm -f coverage.info | |
150 lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q | |
151 genhtml coverage.info --output-directory coverage -q | |
152 | |
153 # target that removes all coverage output | |
154 cleancov-clean: | |
155 rm -f `find . -type f -name "*.info" | xargs` | |
156 rm -rf coverage/ | |
157 | |
158 # cleans everything - coverage output and standard 'clean' | |
159 cleancov: cleancov-clean clean | |
160 | |
161 clean: | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
162 rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o \ |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
163 demo/*.o test timing mtest_opponent mtest/mtest mtest/mtest.exe tuning_list \ |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
164 *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
165 rm -rf .libs/ demo/.libs |