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