From dbae17dbc04f87f8463b02e11d1361fb6b1d84dc Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Thu, 11 Feb 2021 16:10:02 -0600 Subject: [PATCH] install: makefile target to install libraries As we don't install the libraries by default, provide a make target, "install-library" to install the libsuricata library files. If shared library support exists, both the static and shared libraries will be installed, otherwise only the static libraries will be installed. --- Makefile.am | 4 ++++ configure.ac | 1 + rust/Makefile.am | 7 +++++++ src/Makefile.am | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/Makefile.am b/Makefile.am index d6c4503c05..5bcf9280a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -54,3 +54,7 @@ endif @echo "For more information please see:" @echo " https://suricata.readthedocs.io/en/latest/rule-management/index.html" @echo "" + +install-library: + cd src && $(MAKE) $@ + cd rust && $(MAKE) $@ diff --git a/configure.ac b/configure.ac index 4662fc64e3..2caccc4cfd 100644 --- a/configure.ac +++ b/configure.ac @@ -2680,6 +2680,7 @@ AC_SUBST(CONFIGURE_DATAROOTDIR) AC_SUBST(PACKAGE_VERSION) AC_SUBST(RUST_FEATURES) AC_SUBST(RUST_SURICATA_LIBDIR) +AC_SUBST(RUST_SURICATA_LIBNAME) AM_CONDITIONAL([BUILD_SHARED_LIBRARY], [test "x$enable_shared" = "xyes"] && [test "x$can_build_shared_library" = "xyes"]) diff --git a/rust/Makefile.am b/rust/Makefile.am index 10dbb30519..a8c360e423 100644 --- a/rust/Makefile.am +++ b/rust/Makefile.am @@ -51,6 +51,13 @@ endif fi $(MAKE) gen/rust-bindings.h +install-library: + $(MKDIR_P) "$(DESTDIR)$(libdir)" + $(INSTALL_DATA) $(RUST_SURICATA_LIB) "$(DESTDIR)$(libdir)" + +uninstall-local: + rm -f "$(DESTDIR)$(libdir)/$(RUST_SURICATA_LIBNAME)" + clean-local: rm -rf target if HAVE_CBINDGEN diff --git a/src/Makefile.am b/src/Makefile.am index 27577ec1c7..6be971733a 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -608,6 +608,23 @@ libsuricata.so: @exit 1 endif +if BUILD_SHARED_LIBRARY +install-library: libsuricata.so.$(VERSION) +else +install-library: +endif + $(MKDIR_P) "$(DESTDIR)$(libdir)" + $(INSTALL_DATA) libsuricata_c.a "$(DESTDIR)$(libdir)" +if BUILD_SHARED_LIBRARY + $(INSTALL) libsuricata.so.$(VERSION) "$(DESTDIR)$(libdir)" + ln -sf libsuricata.so.$(VERSION) "$(DESTDIR)$(libdir)/libsuricata.so" +endif + +uninstall-local: + rm -f "$(DESTDIR)$(libdir)/libsuricata_c.a" + rm -f "$(DESTDIR)$(libdir)/libsuricata.so" + rm -f "$(DESTDIR)$(libdir)/libsuricata.$(VERSION)" + if BUILD_FUZZTARGETS LDFLAGS_FUZZ = $(all_libraries) $(SECLDFLAGS) -- 2.47.2