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