1470
|
1 # |
|
2 # Include makefile for libtommath |
|
3 # |
|
4 |
|
5 #version of library |
|
6 VERSION=1.0.1 |
|
7 VERSION_PC=1.0.1 |
|
8 VERSION_SO=1:1 |
|
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 |
|
20 ifeq ($(CC),cc) |
|
21 CC = $(CROSS_COMPILE)gcc |
|
22 endif |
|
23 LD=$(CROSS_COMPILE)ld |
|
24 AR=$(CROSS_COMPILE)ar |
|
25 RANLIB=$(CROSS_COMPILE)ranlib |
|
26 |
|
27 ifndef MAKE |
|
28 MAKE=make |
|
29 endif |
|
30 |
|
31 CFLAGS += -I./ -Wall -Wsign-compare -Wextra -Wshadow |
|
32 |
|
33 ifndef NO_ADDTL_WARNINGS |
|
34 # additional warnings |
|
35 CFLAGS += -Wsystem-headers -Wdeclaration-after-statement -Wbad-function-cast -Wcast-align |
|
36 CFLAGS += -Wstrict-prototypes -Wpointer-arith |
|
37 endif |
|
38 |
|
39 ifdef COMPILE_DEBUG |
|
40 #debug |
|
41 CFLAGS += -g3 |
|
42 else |
|
43 |
|
44 ifdef COMPILE_SIZE |
|
45 #for size |
|
46 CFLAGS += -Os |
|
47 else |
|
48 |
|
49 ifndef IGNORE_SPEED |
|
50 #for speed |
|
51 CFLAGS += -O3 -funroll-loops |
|
52 |
|
53 #x86 optimizations [should be valid for any GCC install though] |
|
54 CFLAGS += -fomit-frame-pointer |
|
55 endif |
|
56 |
|
57 endif # COMPILE_SIZE |
|
58 endif # COMPILE_DEBUG |
|
59 |
|
60 ifneq ($(findstring clang,$(CC)),) |
|
61 CFLAGS += -Wno-typedef-redefinition -Wno-tautological-compare -Wno-builtin-requires-header |
|
62 endif |
|
63 ifeq ($(PLATFORM), Darwin) |
|
64 CFLAGS += -Wno-nullability-completeness |
|
65 endif |
|
66 |
|
67 # adjust coverage set |
|
68 ifneq ($(filter $(shell arch), i386 i686 x86_64 amd64 ia64),) |
|
69 COVERAGE = test_standalone timing |
|
70 COVERAGE_APP = ./test && ./ltmtest |
|
71 else |
|
72 COVERAGE = test_standalone |
|
73 COVERAGE_APP = ./test |
|
74 endif |
|
75 |
|
76 HEADERS_PUB=tommath.h tommath_class.h tommath_superclass.h |
|
77 HEADERS=tommath_private.h $(HEADERS_PUB) |
|
78 |
|
79 test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0 |
|
80 |
|
81 #LIBPATH The directory for libtommath to be installed to. |
|
82 #INCPATH The directory to install the header files for libtommath. |
|
83 #DATAPATH The directory to install the pdf docs. |
|
84 DESTDIR ?= |
|
85 PREFIX ?= /usr/local |
|
86 LIBPATH ?= $(PREFIX)/lib |
|
87 INCPATH ?= $(PREFIX)/include |
|
88 DATAPATH ?= $(PREFIX)/share/doc/libtommath/pdf |
|
89 |
|
90 #make the code coverage of the library |
|
91 # |
|
92 coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS |
|
93 coverage: LFLAGS += -lgcov |
|
94 coverage: LDFLAGS += -lgcov |
|
95 |
|
96 coverage: $(COVERAGE) |
|
97 $(COVERAGE_APP) |
|
98 |
|
99 lcov: coverage |
|
100 rm -f coverage.info |
|
101 lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q |
|
102 genhtml coverage.info --output-directory coverage -q |
|
103 |
|
104 # target that removes all coverage output |
|
105 cleancov-clean: |
|
106 rm -f `find . -type f -name "*.info" | xargs` |
|
107 rm -rf coverage/ |
|
108 |
|
109 # cleans everything - coverage output and standard 'clean' |
|
110 cleancov: cleancov-clean clean |
|
111 |
|
112 clean: |
|
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 \ |
|
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 |
|
115 rm -rf .libs/ |
|
116 ${MAKE} -C etc/ clean MAKE=${MAKE} |
|
117 ${MAKE} -C doc/ clean MAKE=${MAKE} |