refactor & clean-up makefiles
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
diff --git a/makefile b/makefile
index 3981c0c..432bb7e 100644
--- a/makefile
+++ b/makefile
@@ -14,17 +14,14 @@ ifneq ($V,1)
endif
${silent} ${CC} -c ${CFLAGS} $^ -o $@
-#version of library
-VERSION=0.43.0
-
-include makefile.include
-
#default files to install
ifndef LIBNAME
LIBNAME=libtommath.a
endif
-default: ${LIBNAME}
+include makefile.include
+
+LCOV_ARGS=--directory .
#START_INS
OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
@@ -58,24 +55,6 @@ $(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
-
-#make the code coverage of the library
-#
-coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS
-coverage: LFLAGS += -lgcov
-
-coverage: test_standalone timing
- ./test
- ./ltmtest
-
-lcov: coverage
- rm -f coverage.info
- lcov --capture --no-external --no-recursion --directory . --output-file coverage.info -q
- genhtml coverage.info --output-directory coverage -q
-
-coveralls: coverage
- cpp-coveralls
-
#make a profiled library (takes a while!!!)
#
# This will build the library with profile generation
@@ -100,10 +79,10 @@ profiled_single:
ranlib $(LIBNAME)
install: $(LIBNAME)
- install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(LIBPATH)
- install -d -g $(GROUP) -o $(USER) $(DESTDIR)$(INCPATH)
- install -g $(GROUP) -o $(USER) $(LIBNAME) $(DESTDIR)$(LIBPATH)
- install -g $(GROUP) -o $(USER) $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
+ install -d $(DESTDIR)$(LIBPATH)
+ install -d $(DESTDIR)$(INCPATH)
+ install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)
+ install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test
@@ -177,13 +156,6 @@ manual: mandvi
pretty:
perl pretty.build
-clean:
- rm -f *.gcda *.gcno *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
- *.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
- rm -rf .libs
- cd etc ; MAKE=${MAKE} ${MAKE} clean
- cd pics ; MAKE=${MAKE} ${MAKE} clean
-
#zipup the project (take that!)
no_oops: clean
cd .. ; cvs commit
diff --git a/makefile.include b/makefile.include
index 7f12de6..d4e2322 100644
--- a/makefile.include
+++ b/makefile.include
@@ -2,6 +2,13 @@
# Include makefile for libtommath
#
+#version of library
+VERSION=0.43.0
+VERSION_SO=0:43
+
+# default make target
+default: ${LIBNAME}
+
# Compiler and Linker Names
ifndef PREFIX
PREFIX=
@@ -52,19 +59,6 @@ HEADERS=tommath_private.h $(HEADERS_PUB)
test_standalone: CFLAGS+=-DLTM_DEMO_TEST_VS_MTEST=0
-#install as this user
-ifndef INSTALL_GROUP
- GROUP=wheel
-else
- GROUP=$(INSTALL_GROUP)
-endif
-
-ifndef INSTALL_USER
- USER=root
-else
- USER=$(INSTALL_USER)
-endif
-
#LIBPATH-The directory for libtommath to be installed to.
#INCPATH-The directory to install the header files for libtommath.
#DATAPATH-The directory to install the pdf docs.
@@ -72,3 +66,35 @@ LIBPATH?=/usr/lib
INCPATH?=/usr/include
DATAPATH?=/usr/share/doc/libtommath/pdf
+#make the code coverage of the library
+#
+coverage: CFLAGS += -fprofile-arcs -ftest-coverage -DTIMING_NO_LOGS
+coverage: LFLAGS += -lgcov
+coverage: LDFLAGS += -lgcov
+
+coverage: test_standalone timing
+ ./test
+ ./ltmtest
+
+lcov: coverage
+ rm -f coverage.info
+ lcov --capture --no-external --no-recursion $(LCOV_ARGS) --output-file coverage.info -q
+ genhtml coverage.info --output-directory coverage -q
+
+coveralls: coverage
+ cpp-coveralls
+
+# target that removes all coverage output
+cleancov-clean:
+ rm -f `find . -type f -name "*.info" | xargs`
+ rm -rf coverage/
+
+# cleans everything - coverage output and standard 'clean'
+cleancov: cleancov-clean clean
+
+clean:
+ rm -f *.gcda *.gcno *.bat *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
+ *.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
+ rm -rf .libs/
+ cd etc ; MAKE=${MAKE} ${MAKE} clean
+ cd pics ; MAKE=${MAKE} ${MAKE} clean
diff --git a/makefile.shared b/makefile.shared
index f8b7760..559720e 100644
--- a/makefile.shared
+++ b/makefile.shared
@@ -1,22 +1,18 @@
#Makefile for GCC
#
#Tom St Denis
-VERSION=0:42
+
+#default files to install
+ifndef LIBNAME
+ LIBNAME=libtommath.la
+endif
include makefile.include
LT ?= libtool
LTCOMPILE = $(LT) --mode=compile --tag=CC $(CC)
-default: libtommath.la
-
-#default files to install
-ifndef LIBNAME
- LIBNAME=libtommath.la
-endif
-ifndef LIBNAME_S
- LIBNAME_S=libtommath.a
-endif
+LCOV_ARGS=--directory .libs --directory .
#START_INS
OBJECTS=bncore.o bn_error.o bn_fast_mp_invmod.o bn_fast_mp_montgomery_reduce.o bn_fast_s_mp_mul_digs.o \
@@ -52,12 +48,12 @@ objs: $(OBJECTS)
$(LTCOMPILE) $(CFLAGS) $(LDFLAGS) -o $@ -c $<
$(LIBNAME): $(OBJECTS)
- $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION)
+ $(LT) --mode=link --tag=CC $(CC) $(LDFLAGS) *.lo -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO)
install: $(LIBNAME)
install -d $(DESTDIR)$(LIBPATH)
- $(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
install -d $(DESTDIR)$(INCPATH)
+ $(LT) --mode=install install -c $(LIBNAME) $(DESTDIR)$(LIBPATH)/$(LIBNAME)
install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
test: $(LIBNAME) demo/demo.o
@@ -72,4 +68,4 @@ mtest:
cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest
timing: $(LIBNAME)
- $(LT) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME_S) -o ltmtest
+ $(LT) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o ltmtest