annotate libtommath/makefile_include.mk @ 1503:78d8c3ffdfe1

use NULL instead of 0
author Francois Perrad <francois.perrad@gadz.org>
date Thu, 25 Jan 2018 18:19:49 +0100
parents 8bba51a55704
children 47fcbdd12d9b
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
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
20 ifeq ($(CC),cc)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
21 CC = $(CROSS_COMPILE)gcc
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
22 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
23 LD=$(CROSS_COMPILE)ld
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
24 AR=$(CROSS_COMPILE)ar
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
25 RANLIB=$(CROSS_COMPILE)ranlib
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
26
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
27 ifndef MAKE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
28 MAKE=make
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
29 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
30
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
31 CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
32
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
33 ifndef NO_ADDTL_WARNINGS
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
34 # additional warnings
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
35 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
36 CFLAGS += -Wstrict-prototypes -Wpointer-arith
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
37 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
38
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
39 ifdef COMPILE_DEBUG
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
40 #debug
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
41 CFLAGS += -g3
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
42 else
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
43
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
44 ifdef COMPILE_SIZE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
45 #for size
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
46 CFLAGS += -Os
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
47 else
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
48
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
49 ifndef IGNORE_SPEED
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
50 #for speed
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
51 CFLAGS += -O3 -funroll-loops
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
52
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
53 #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
54 CFLAGS += -fomit-frame-pointer
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
55 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
56
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
57 endif # COMPILE_SIZE
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
58 endif # COMPILE_DEBUG
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
59
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
60 ifneq ($(findstring clang,$(CC)),)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
61 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
62 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
63 ifeq ($(PLATFORM), Darwin)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
64 CFLAGS += -Wno-nullability-completeness
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
65 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
66
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
67 # adjust coverage set
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
68 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
69 COVERAGE = test_standalone timing
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
70 COVERAGE_APP = ./test && ./ltmtest
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
71 else
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
72 COVERAGE = test_standalone
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
73 COVERAGE_APP = ./test
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
74 endif
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
75
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
76 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
77 HEADERS=tommath_private.h $(HEADERS_PUB)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
78
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
79 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
80
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
81 #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
82 #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
83 #DATAPATH The directory to install the pdf docs.
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
84 DESTDIR ?=
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
85 PREFIX ?= /usr/local
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
86 LIBPATH ?= $(PREFIX)/lib
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
87 INCPATH ?= $(PREFIX)/include
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
88 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
89
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
90 #make the code coverage of the library
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
91 #
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
92 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
93 coverage: LFLAGS += -lgcov
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
94 coverage: LDFLAGS += -lgcov
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
95
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
96 coverage: $(COVERAGE)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
97 $(COVERAGE_APP)
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
98
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
99 lcov: coverage
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
100 rm -f coverage.info
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
101 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
102 genhtml coverage.info --output-directory coverage -q
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
103
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
104 # target that removes all coverage output
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
105 cleancov-clean:
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
106 rm -f `find . -type f -name "*.info" | xargs`
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
107 rm -rf coverage/
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
108
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
109 # cleans everything - coverage output and standard 'clean'
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
110 cleancov: cleancov-clean clean
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
111
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
112 clean:
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
113 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
114 *.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
115 rm -rf .libs/
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
116 ${MAKE} -C etc/ clean MAKE=${MAKE}
8bba51a55704 Update to libtommath v1.0.1
Matt Johnston <matt@ucc.asn.au>
parents:
diff changeset
117 ${MAKE} -C doc/ clean MAKE=${MAKE}