Proper handling of versions of the library

This commit is contained in:
Mohamed Boussaffa
2016-03-13 06:38:59 +08:00
parent d33acbe3c7
commit 4c5c87c1f3
6 changed files with 30 additions and 39 deletions

2
.gitignore vendored
View File

@@ -4,5 +4,5 @@ TAGS
*.o
*~
nethogs.project
libnethogs.so
libnethogs.so.*
libnethogs.a

View File

@@ -1,3 +1,7 @@
VERSION := 0
SUBVERSION := 8
MINORVERSION := 2-SNAPSHOT
#prefix := /usr
prefix := /usr/local

View File

@@ -1,10 +1,18 @@
LIBVERSION := 0
LIBSUBVERSION := 1
LIBMINORVERSION := 0
LIBRARY=libnethogs.so
LIBNAME=$(LIBRARY).$(LIBVERSION).$(LIBSUBVERSION).$(LIBMINORVERSION)
SO_NAME=$(LIBRARY).$(LIBVERSION)
prefix := /usr/local
libdir := $(prefix)/lib
incdir := $(prefix)/include
all: libnethogs.so libnethogs.a
all: $(LIBNAME) libnethogs.a
LDFLAGS:= -shared
LDFLAGS:= -shared -Wl,-soname,$(SO_NAME)
CXXINCLUDES :=
VISIBILITY=-fvisibility=hidden
ODIR_BASE := obj
@@ -31,10 +39,14 @@ OBJS=$(addprefix $(ODIR)/,$(OBJ_NAMES))
.PHONY: uninstall
install: libnethogs.so
install: $(LIBNAME)
install -d -m 755 $(DESTDIR)$(libdir)
install -m 755 libnethogs.so $(DESTDIR)$(libdir)
@echo "Installed libnethogs.so to $(DESTDIR)$(libdir)"
install -m 755 $(LIBNAME) $(DESTDIR)$(libdir)
@echo "Installed $(LIBNAME) to $(DESTDIR)$(libdir)"
ldconfig
install_dev: install
@ln -s $(DESTDIR)$(libdir)/$(LIBNAME) $(DESTDIR)$(libdir)/$(LIBRARY)
install -m 755 libnethogs.a $(DESTDIR)$(libdir)
@echo "Installed libnethogs.a to $(DESTDIR)$(libdir)"
install -d -m 755 $(DESTDIR)$(incdir)
@@ -43,12 +55,13 @@ install: libnethogs.so
ldconfig
uninstall:
rm $(DESTDIR)$(libdir)/libnethogs.so
rm $(DESTDIR)$(libdir)/libnethogs.a
rm $(DESTDIR)$(incdir)/libnethogs.h
rm -f $(DESTDIR)$(libdir)/$(LIBNAME)
rm -f $(DESTDIR)$(libdir)/$(LIBRARY)
rm -f $(DESTDIR)$(libdir)/libnethogs.a
rm -f $(DESTDIR)$(incdir)/libnethogs.h
ldconfig
libnethogs.so: $(OBJS)
$(LIBNAME): $(OBJS)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJS) -o $@ -lpcap
libnethogs.a: $(OBJS)
@@ -86,12 +99,12 @@ $(ODIR)/devices.o: devices.cpp devices.h
$(ODIR)/libnethogs.o: libnethogs.cpp libnethogs.h
@mkdir -p $(ODIR)
$(CXX) $(CXXFLAGS) -o $@ -c libnethogs.cpp -DVERSION=\"$(VERSION)\" -DSUBVERSION=\"$(SUBVERSION)\" -DMINORVERSION=\"$(MINORVERSION)\"
$(CXX) $(CXXFLAGS) -o $@ -c libnethogs.cpp -DVERSION=\"$(LIBVERSION)\" -DSUBVERSION=\"$(LIBSUBVERSION)\" -DMINORVERSION=\"$(LIBMINORVERSION)\"
.PHONY: clean
clean:
rm -f $(OBJS)
rm -f libnethogs.so
rm -f $(LIBNAME)
rm -f libnethogs.a
mkdir -p $(ODIR)
rmdir -p --ignore-fail-on-non-empty $(ODIR)

View File

@@ -1,7 +1,3 @@
export VERSION := 0
export SUBVERSION := 8
export MINORVERSION := 2-SNAPSHOT
all: nethogs decpcap_test
$(MAKE) -f MakeApp.mk $@
$(MAKE) -f MakeLib.mk $@

View File

@@ -37,7 +37,7 @@ typedef void(*NethogsMonitorCallback)(NethogsMonitorUpdate const*);
/**
* @brief Enter the process monitoring loop and reports updates using the
* callback provided as parameter.
* This call will block until nethogsmonitor_stop is called or a failure occurs.
* This call will block until nethogsmonitor_breakloop is called or a failure occurs.
* @param cb A pointer to a callback function following the NethogsMonitorCallback definition
*/

View File

@@ -1,22 +0,0 @@
/*
* refresh.h
*
* Copyright (c) 2004 Arnout Engelen
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
void alarm_cb (int i);