annotate libtommath/makefile_include.mk @ 1604:99ca393afc56

It turns out you can't have a single-quote in an #error
author Matt Johnston <matt@ucc.asn.au>
date Thu, 08 Mar 2018 22:37:54 +0800
parents 47fcbdd12d9b
children f52919ffd3b1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
1 #
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
2 # Include makefile for libtommath
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
3 #
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
4
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
5 #version of library
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
6 VERSION=1.0.1
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
7 VERSION_PC=1.0.1
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
8 VERSION_SO=1:1
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
9
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
10 PLATFORM := $(shell uname | sed -e 's/_.*//')
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
11
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
12 # default make target
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
13 default: ${LIBNAME}
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
14
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
15 # Compiler and Linker Names
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
16 ifndef CROSS_COMPILE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
17 CROSS_COMPILE=
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
18 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
19
1522
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
20 # Dropbear passes these down
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
21 #ifeq ($(CC),cc)
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
22 # CC = $(CROSS_COMPILE)gcc
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
23 #endif
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
24 #LD=$(CROSS_COMPILE)ld
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
25 #AR=$(CROSS_COMPILE)ar
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
26 #RANLIB=$(CROSS_COMPILE)ranlib
1470
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 ifndef MAKE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 MAKE=make
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32 CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 ifndef NO_ADDTL_WARNINGS
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 # additional warnings
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
36 CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 CFLAGS += -Wstrict-prototypes -Wpointer-arith
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 ifdef COMPILE_DEBUG
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 #debug
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 CFLAGS += -g3
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43 else
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 ifdef COMPILE_SIZE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 #for size
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 CFLAGS += -Os
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48 else
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 ifndef IGNORE_SPEED
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 #for speed
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52 CFLAGS += -O3 -funroll-loops
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
54 #x86 optimizations [should be valid for any GCC install though]
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 CFLAGS += -fomit-frame-pointer
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 endif # COMPILE_SIZE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59 endif # COMPILE_DEBUG
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 ifneq ($(findstring clang,$(CC)),)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
62 CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 ifeq ($(PLATFORM), Darwin)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 CFLAGS += -Wno-nullability-completeness
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 # adjust coverage set
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
69 ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
70 COVERAGE = test_standalone timing
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 COVERAGE_APP = ./test && ./ltmtest
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 else
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 COVERAGE = test_standalone
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
74 COVERAGE_APP = ./test
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
75 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
76
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
77 HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78 HEADERS=tommath_private.h $(HEADERS_PUB)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
80 test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
81
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
82 #LIBPATH The directory for libtommath to be installed to.
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
83 #INCPATH The directory to install the header files for libtommath.
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
84 #DATAPATH The directory to install the pdf docs.
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 DESTDIR ?=
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
86 PREFIX ?= /usr/local
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
87 LIBPATH ?= $(PREFIX)/lib
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
88 INCPATH ?= $(PREFIX)/include
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 #make the code coverage of the library
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92 #
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
93 coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94 coverage: LFLAGS += -lgcov
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95 coverage: LDFLAGS += -lgcov
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 coverage: $(COVERAGE)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98 $(COVERAGE_APP)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
99
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
100 lcov: coverage
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101 rm -f coverage.info
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
102 lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103 genhtml coverage.info --output-directory coverage -q
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
104
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105 # target that removes all coverage output
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106 cleancov-clean:
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 rm -f `find . -type f -name "*.info" | xargs`
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108 rm -rf coverage/
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
109
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110 # cleans everything - coverage output and standard 'clean'
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
111 cleancov: cleancov-clean clean
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
112
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
113 clean:
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
114 rm -f *.gcda *.gcno *.gcov *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
115 *.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
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
116 rm -rf .libs/
1522
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
117 #${MAKE} -C etc/ clean MAKE=${MAKE}
47fcbdd12d9b Remove bad merged libtommmath "clean" rule and leftover makefile.include
Matt Johnston <matt@ucc.asn.au>
parents: 1470
diff changeset
118 #${MAKE} -C doc/ clean MAKE=${MAKE}