Skip to content

Commit

Permalink
Added target for shared liubrary creation
Browse files Browse the repository at this point in the history
Added target for install
Fixes ntop#593
  • Loading branch information
lucaderi committed Aug 25, 2018
1 parent 2f83375 commit a98c0a8
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 119 deletions.
7 changes: 1 addition & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
ACLOCAL_AMFLAGS = -I m4

SUBDIRS = src/lib example tests

pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libndpi.pc

EXTRA_DIST = libndpi.sym autogen.sh
EXTRA_DIST = autogen.sh
2 changes: 1 addition & 1 deletion autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ NDPI_MINOR="5"
NDPI_PATCH="0"
NDPI_VERSION_SHORT="$NDPI_MAJOR.$NDPI_MINOR.$NDPI_PATCH"

rm -f configure config.h config.h.in src/lib/Makefile.in
rm -f configure config.h config.h.in

AUTOCONF=$(command -v autoconf)
AUTOMAKE=$(command -v automake)
Expand Down
4 changes: 3 additions & 1 deletion configure.seed
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ AC_PROG_CC
AM_PROG_CC_C_O
AX_PTHREAD

NDPI_VERSION_SHORT="@NDPI_VERSION_SHORT@"
NDPI_MAJOR="@NDPI_MAJOR@"
NDPI_MINOR="@NDPI_MINOR@"
NDPI_PATCH="@NDPI_PATCH@"
Expand Down Expand Up @@ -127,12 +128,13 @@ AC_ARG_ENABLE([debug-messages],

AC_CHECK_LIB(pthread, pthread_setaffinity_np, AC_DEFINE_UNQUOTED(HAVE_PTHREAD_SETAFFINITY_NP, 1, [libc has pthread_setaffinity_np]))

AC_CONFIG_FILES([Makefile example/Makefile tests/Makefile libndpi.pc src/include/ndpi_define.h])
AC_CONFIG_FILES([Makefile example/Makefile tests/Makefile src/include/ndpi_define.h src/lib/Makefile])
AC_CONFIG_HEADERS(src/include/ndpi_config.h)
AC_SUBST(GIT_RELEASE)
AC_SUBST(NDPI_MAJOR)
AC_SUBST(NDPI_MINOR)
AC_SUBST(NDPI_PATCH)
AC_SUBST(NDPI_VERSION_SHORT)
AC_SUBST(SVN_DATE)
AC_SUBST(JSON_C_LIB)
AC_SUBST(PCAP_INC)
Expand Down
10 changes: 0 additions & 10 deletions libndpi.pc.in

This file was deleted.

75 changes: 0 additions & 75 deletions libndpi.sym

This file was deleted.

26 changes: 0 additions & 26 deletions src/lib/Makefile

This file was deleted.

49 changes: 49 additions & 0 deletions src/lib/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#
# Simple non-autotools dependent makefile
#
# ./autogen.sh
# cd src/lib
# make Makefile
#

#
# Installation directories
#
prefix = /usr/local
libdir = ${prefix}/lib
includedir = ${prefix}/include/ndpi

CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -g
RANLIB = ranlib

OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) ndpi_main.o
HEADERS = $(wildcard ../include/*.h)
NDPI_LIB_STATIC = libndpi.a
NDPI_LIB_SHARED_BASE = libndpi.so
NDPI_LIB_SHARED = $(NDPI_LIB_SHARED_BASE).@NDPI_VERSION_SHORT@
NDPI_LIBS = $(NDPI_LIB_STATIC) $(NDPI_LIB_SHARED)

all: $(NDPI_LIBS)

ndpi_main.c: ndpi_content_match.c.inc

$(NDPI_LIB_STATIC): $(OBJECTS)
ar rc $@ $(OBJECTS)
$(RANLIB) $@

$(NDPI_LIB_SHARED): $(OBJECTS)
gcc -shared -fPIC -o $@ $(OBJECTS)
ln -Fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE)

%.o: %.c $(HEADERS) Makefile
$(CC) $(CFLAGS) -c $< -o $@

clean:
/bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo

install: $(NDPI_LIBS)
mkdir -p $(DESTDIR)$(libdir)
cp $(NDPI_LIBS) $(DESTDIR)$(libdir)/
ln -Fs $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED) $(DESTDIR)$(libdir)/$(NDPI_LIB_SHARED_BASE)
mkdir -p $(DESTDIR)$(includedir)
cp ../include/*.h $(DESTDIR)$(includedir)
3 changes: 3 additions & 0 deletions tests/result/ssdp-m-search.pcap.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SSDP 19 1197 1

1 UDP 192.168.242.8:42253 -> 192.168.242.255:32412 [proto: 12/SSDP][cat: System/18][19 pkts/1197 bytes -> 0 pkts/0 bytes]

0 comments on commit a98c0a8

Please sign in to comment.