Mercurial > dropbear
annotate libtommath/makefile_include.mk @ 1838:60cd5cdb165c
Update .hgignore and .gitignore with tests
author | Matt Johnston <matt@codeconstruct.com.au> |
---|---|
date | Mon, 18 Oct 2021 14:26:59 +0800 |
parents | 93e738ef0d9d |
children |
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 |
1695
93e738ef0d9d
Avoid oss-fuzz $SANITIZER causing wrong build
Matt Johnston <matt@ucc.asn.au>
parents:
1692
diff
changeset
|
53 # renamed for Dropbear to avoid clash with oss-fuzz $SANITIZER var |
93e738ef0d9d
Avoid oss-fuzz $SANITIZER causing wrong build
Matt Johnston <matt@ucc.asn.au>
parents:
1692
diff
changeset
|
54 ifdef LTM_SANITIZER |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
55 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
|
56 endif |
1470 | 57 |
58 ifndef NO_ADDTL_WARNINGS | |
59 # additional warnings | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
60 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
|
61 LTM_CFLAGS += -Wstrict-prototypes -Wpointer-arith |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
62 endif |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
63 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
64 ifdef CONV_WARNINGS |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
65 LTM_CFLAGS += -std=c89 -Wconversion -Wsign-conversion |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
66 ifeq ($(CONV_WARNINGS), strict) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
67 LTM_CFLAGS += -DMP_USE_ENUMS -Wc++-compat |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
68 endif |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
69 else |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
70 LTM_CFLAGS += -Wsystem-headers |
1470 | 71 endif |
72 | |
73 ifdef COMPILE_DEBUG | |
74 #debug | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
75 LTM_CFLAGS += -g3 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
76 endif |
1470 | 77 |
78 ifdef COMPILE_SIZE | |
79 #for size | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
80 LTM_CFLAGS += -Os |
1470 | 81 else |
82 | |
83 ifndef IGNORE_SPEED | |
84 #for speed | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
85 LTM_CFLAGS += -O3 -funroll-loops |
1470 | 86 |
87 #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
|
88 LTM_CFLAGS += -fomit-frame-pointer |
1470 | 89 endif |
90 | |
91 endif # COMPILE_SIZE | |
92 | |
93 ifneq ($(findstring clang,$(CC)),) | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
94 LTM_CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header |
1470 | 95 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
|
96 ifneq ($(findstring mingw,$(CC)),) |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
97 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
|
98 endif |
1470 | 99 ifeq ($(PLATFORM), Darwin) |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
100 LTM_CFLAGS += -Wno-nullability-completeness |
1470 | 101 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
|
102 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
|
103 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
|
104 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
|
105 |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
106 # add in the standard FLAGS |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
107 LTM_CFLAGS += $(CFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
108 LTM_LFLAGS += $(LFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
109 LTM_LDFLAGS += $(LDFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
110 LTM_LIBTOOLFLAGS += $(LIBTOOLFLAGS) |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
111 |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
112 |
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
|
113 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
|
114 _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
|
115 else |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
116 _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
|
117 endif |
1470 | 118 |
119 # 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
|
120 ifneq ($(filter $(_ARCH), i386 i686 x86_64 amd64 ia64),) |
1470 | 121 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
|
122 COVERAGE_APP = ./test && ./timing |
1470 | 123 else |
124 COVERAGE = test_standalone | |
125 COVERAGE_APP = ./test | |
126 endif | |
127 | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
128 HEADERS_PUB=tommath.h |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
129 HEADERS=tommath_private.h tommath_class.h tommath_superclass.h tommath_cutoffs.h $(HEADERS_PUB) |
1470 | 130 |
131 #LIBPATH The directory for libtommath to be installed to. | |
132 #INCPATH The directory to install the header files for libtommath. | |
133 #DATAPATH The directory to install the pdf docs. | |
134 DESTDIR ?= | |
135 PREFIX ?= /usr/local | |
136 LIBPATH ?= $(PREFIX)/lib | |
137 INCPATH ?= $(PREFIX)/include | |
138 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf | |
139 | |
140 #make the code coverage of the library | |
141 # | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
142 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
|
143 coverage: LTM_LFLAGS += -lgcov |
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
144 coverage: LTM_LDFLAGS += -lgcov |
1470 | 145 |
146 coverage: $(COVERAGE) | |
147 $(COVERAGE_APP) | |
148 | |
149 lcov: coverage | |
150 rm -f coverage.info | |
151 lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q | |
152 genhtml coverage.info --output-directory coverage -q | |
153 | |
154 # target that removes all coverage output | |
155 cleancov-clean: | |
156 rm -f `find . -type f -name "*.info" | xargs` | |
157 rm -rf coverage/ | |
158 | |
159 # cleans everything - coverage output and standard 'clean' | |
160 cleancov: cleancov-clean clean | |
161 | |
162 clean: | |
1692
1051e4eea25a
Update LibTomMath to 1.2.0 (#84)
Steffen Jaeckel <s@jaeckel.eu>
parents:
1657
diff
changeset
|
163 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
|
164 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
|
165 *.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
|
166 rm -rf .libs/ demo/.libs |