Mercurial > dropbear
annotate libtommath/makefile_include.mk @ 1667:986126448688
Update remaining advise to edit options.h
You should edit localoptions.h instead.
author | Alexander Dahl <ada@thorsis.com> |
---|---|
date | Tue, 10 Mar 2020 15:38:38 +0100 |
parents | 823592f244c9 |
children | 1051e4eea25a |
rev | line source |
---|---|
1470 | 1 # |
2 # Include makefile for libtommath | |
3 # | |
4 | |
5 #version of library | |
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
|
6 VERSION=1.1.0 |
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
|
7 VERSION_PC=1.1.0 |
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
|
8 VERSION_SO=2:0:1 |
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 | |
51 CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow | |
52 | |
53 ifndef NO_ADDTL_WARNINGS | |
54 # additional warnings | |
55 CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align | |
56 CFLAGS += -Wstrict-prototypes -Wpointer-arith | |
57 endif | |
58 | |
59 ifdef COMPILE_DEBUG | |
60 #debug | |
61 CFLAGS += -g3 | |
62 else | |
63 | |
64 ifdef COMPILE_SIZE | |
65 #for size | |
66 CFLAGS += -Os | |
67 else | |
68 | |
69 ifndef IGNORE_SPEED | |
70 #for speed | |
71 CFLAGS += -O3 -funroll-loops | |
72 | |
73 #x86 optimizations [should be valid for any GCC install though] | |
74 CFLAGS += -fomit-frame-pointer | |
75 endif | |
76 | |
77 endif # COMPILE_SIZE | |
78 endif # COMPILE_DEBUG | |
79 | |
80 ifneq ($(findstring clang,$(CC)),) | |
81 CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header | |
82 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
|
83 ifneq ($(findstring mingw,$(CC)),) |
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
|
84 CFLAGS += -Wno-shadow |
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
|
85 endif |
1470 | 86 ifeq ($(PLATFORM), Darwin) |
87 CFLAGS += -Wno-nullability-completeness | |
88 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
|
89 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
|
90 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
|
91 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
|
92 |
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
|
93 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
|
94 _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
|
95 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
|
96 _ARCH := $(shell 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
|
97 endif |
1470 | 98 |
99 # 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
|
100 ifneq ($(filter $(_ARCH), i386 i686 x86_64 amd64 ia64),) |
1470 | 101 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
|
102 COVERAGE_APP = ./test && ./timing |
1470 | 103 else |
104 COVERAGE = test_standalone | |
105 COVERAGE_APP = ./test | |
106 endif | |
107 | |
108 HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h | |
109 HEADERS=tommath_private.h $(HEADERS_PUB) | |
110 | |
111 test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 | |
112 | |
113 #LIBPATH The directory for libtommath to be installed to. | |
114 #INCPATH The directory to install the header files for libtommath. | |
115 #DATAPATH The directory to install the pdf docs. | |
116 DESTDIR ?= | |
117 PREFIX ?= /usr/local | |
118 LIBPATH ?= $(PREFIX)/lib | |
119 INCPATH ?= $(PREFIX)/include | |
120 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf | |
121 | |
122 #make the code coverage of the library | |
123 # | |
124 coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS | |
125 coverage: LFLAGS += -lgcov | |
126 coverage: LDFLAGS += -lgcov | |
127 | |
128 coverage: $(COVERAGE) | |
129 $(COVERAGE_APP) | |
130 | |
131 lcov: coverage | |
132 rm -f coverage.info | |
133 lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q | |
134 genhtml coverage.info --output-directory coverage -q | |
135 | |
136 # target that removes all coverage output | |
137 cleancov-clean: | |
138 rm -f `find . -type f -name "*.info" | xargs` | |
139 rm -rf coverage/ | |
140 | |
141 # cleans everything - coverage output and standard 'clean' | |
142 cleancov: cleancov-clean clean | |
143 | |
144 clean: | |
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
|
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 \ |
1470 | 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 |
147 rm -rf .libs/ | |
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
|
148 # ${MAKE} -C etc/ clean 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
|
149 # ${MAKE} -C doc/ clean MAKE=${MAKE} |