diff options
author | Luca <deri@ntop.org> | 2018-08-25 10:50:16 +0200 |
---|---|---|
committer | Luca <deri@ntop.org> | 2018-08-25 10:50:16 +0200 |
commit | a98c0a81be86936e96be7d2312ae11ef85b785b2 (patch) | |
tree | a49dc35a225cb61d8b480b84ac7b884ed3bccd69 | |
parent | 2f83375eec070acf5c5bad87e2bcf319f39103f0 (diff) |
Added target for shared liubrary creation
Added target for install
Fixes #593
-rw-r--r-- | Makefile.am | 7 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.seed | 4 | ||||
-rw-r--r-- | libndpi.pc.in | 10 | ||||
-rw-r--r-- | libndpi.sym | 75 | ||||
-rw-r--r-- | src/lib/Makefile | 26 | ||||
-rw-r--r-- | src/lib/Makefile.in | 49 | ||||
-rw-r--r-- | tests/result/ssdp-m-search.pcap.out | 3 |
8 files changed, 57 insertions, 119 deletions
diff --git a/Makefile.am b/Makefile.am index 17c674812..0642aec9d 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 diff --git a/autogen.sh b/autogen.sh index ea5ed6694..20bf400ab 100755 --- a/autogen.sh +++ b/autogen.sh @@ -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) diff --git a/configure.seed b/configure.seed index 6b85c66e9..946557a33 100644 --- a/configure.seed +++ b/configure.seed @@ -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@" @@ -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) diff --git a/libndpi.pc.in b/libndpi.pc.in deleted file mode 100644 index 291429cc7..000000000 --- a/libndpi.pc.in +++ /dev/null @@ -1,10 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libndpi -Description: deep packet inspection library -Version: @VERSION@ -Libs: -L${libdir} -lndpi -Cflags: -I${includedir}/libndpi-@VERSION@ diff --git a/libndpi.sym b/libndpi.sym deleted file mode 100644 index 66cffbb18..000000000 --- a/libndpi.sym +++ /dev/null @@ -1,75 +0,0 @@ -ndpi_dump_protocols -ndpi_strnstr -ndpi_detection_giveup -ndpi_get_proto_name -ndpi_free -ndpi_flow_free -ndpi_guess_undetected_protocol -ndpi_tfind -ndpi_tsearch -ndpi_set_protocol_detection_bitmask2 -ndpi_detection_get_sizeof_ndpi_id_struct -ndpi_detection_get_sizeof_ndpi_flow_struct -ndpi_load_protocols_file -ndpi_tdestroy -ndpi_exit_detection_module -ndpi_l4_detection_process_packet -ndpi_detection_process_packet -ndpi_process_extra_packet -ndpi_twalk -ndpi_tdelete -ndpi_revision -ndpi_init_detection_module -ndpi_get_num_supported_protocols -ndpi_set_proto_defaults -ndpi_get_protocol_id -ndpi_get_category_id -ndpi_find_port_based_protocol -ndpi_get_http_method -ndpi_get_http_url -ndpi_get_http_content_type -ndpi_free_flow -ndpi_get_proto_breed -ndpi_get_proto_breed_name -ndpi_get_proto_by_id -ndpi_get_proto_by_name -ndpi_get_protocol_id_master_proto -ndpi_guess_protocol_id -ndpi_protocol2name -ndpi_get_lower_proto -ndpi_is_proto -ndpi_malloc -ndpi_calloc -ndpi_set_detected_protocol -ndpi_match_string_subprotocol -ndpi_init_automa -ndpi_free_automa -ndpi_add_string_value_to_automa -ndpi_add_string_to_automa -ndpi_finalize_automa -ndpi_match_string -ndpi_match_string_id -set_ndpi_malloc -set_ndpi_flow_malloc -set_ndpi_free -set_ndpi_flow_free -set_ndpi_debug_function -ndpi_category_str -ndpi_get_proto_category -ndpi_netbios_name_interpret -ndpi_category_set_name -ndpi_category_get_name -ndpi_is_custom_category -ndpi_is_subprotocol_informative -ndpi_set_proto_category -ndpi_get_api_version -ndpi_network_ptree_match -ndpi_check_flow_func -ndpi_fill_protocol_category -ndpi_load_hostname_category -ndpi_enable_loaded_categories -ndpi_set_detection_preferences -ndpi_get_proto_defaults -ndpi_get_ndpi_num_supported_protocols -ndpi_get_ndpi_num_custom_protocols -ndpi_get_ndpi_detection_module_size diff --git a/src/lib/Makefile b/src/lib/Makefile deleted file mode 100644 index 19c6f1cfe..000000000 --- a/src/lib/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Simple non-autotools dependent makefile -# -# ./autogen.sh -# cd src/lib -# make -f Makefile.simple -# -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) - -all: libndpi.a - -ndpi_main.c: ndpi_content_match.c.inc - -libndpi.a: $(OBJECTS) - ar rc $@ $(OBJECTS) - $(RANLIB) $@ - -%.o: %.c $(HEADERS) Makefile - $(CC) $(CFLAGS) -c $< -o $@ - -clean: - /bin/rm -f libndpi.a $(OBJECTS) diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in new file mode 100644 index 000000000..1bbc4095e --- /dev/null +++ b/src/lib/Makefile.in @@ -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) diff --git a/tests/result/ssdp-m-search.pcap.out b/tests/result/ssdp-m-search.pcap.out new file mode 100644 index 000000000..e975bfeb4 --- /dev/null +++ b/tests/result/ssdp-m-search.pcap.out @@ -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] |