diff --git a/common/Makefile.am b/common/Makefile.am index a80dd14795..751176ef8e 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -47,11 +47,22 @@ $(top_builddir)/include/nut_version.h: libcommon_la_SOURCES = state.c str.c upsconf.c libcommonclient_la_SOURCES = state.c str.c + +# several other Makefiles include the two helpers common.c str.c (and +# perhaps some other string-related code), so make them a library too; +# note that LTLIBOBJS pulls in snprintf.c contents too. +noinst_LTLIBRARIES += libcommonstr.la +libcommonstr_la_SOURCES = str.c +libcommonstr_la_CFLAGS = $(AM_CFLAGS) -DWITHOUT_LIBSYSTEMD=1 +libcommonstr_la_LIBADD = @LTLIBOBJS@ @BSDKVMPROCLIBS@ + if BUILDING_IN_TREE libcommon_la_SOURCES += common.c + libcommonstr_la_SOURCES += common.c libcommonclient_la_SOURCES += common.c else !BUILDING_IN_TREE nodist_libcommon_la_SOURCES = common.c + nodist_libcommonstr_la_SOURCES = common.c nodist_libcommonclient_la_SOURCES = common.c CLEANFILES += $(top_builddir)/common/common.c BUILT_SOURCES = common.c @@ -62,6 +73,7 @@ if HAVE_STRPTIME else !HAVE_STRPTIME # fall back to NetBSD implem libcommon_la_SOURCES += strptime.c + libcommonstr_la_SOURCES += strptime.c libcommonclient_la_SOURCES += strptime.c endif !HAVE_STRPTIME @@ -70,6 +82,7 @@ if HAVE_STRNLEN else !HAVE_STRNLEN # fall back to FreeBSD implem libcommon_la_SOURCES += strnlen.c + libcommonstr_la_SOURCES += strnlen.c libcommonclient_la_SOURCES += strnlen.c endif !HAVE_STRNLEN @@ -78,6 +91,7 @@ if HAVE_STRSEP else !HAVE_STRSEP # fall back to simple implem libcommon_la_SOURCES += strsep.c + libcommonstr_la_SOURCES += strsep.c libcommonclient_la_SOURCES += strsep.c endif !HAVE_STRSEP @@ -92,6 +106,7 @@ if HAVE_WINDOWS noinst_LTLIBRARIES += libnutwincompat.la libcommon_la_SOURCES += wincompat.c $(top_srcdir)/include/wincompat.h + libcommonstr_la_SOURCES += wincompat.c $(top_srcdir)/include/wincompat.h libcommonclient_la_SOURCES += wincompat.c $(top_srcdir)/include/wincompat.h endif HAVE_WINDOWS @@ -112,6 +127,9 @@ if HAVE_LIBREGEX libcommon_la_CFLAGS += $(LIBREGEX_CFLAGS) libcommon_la_LIBADD += $(LIBREGEX_LIBS) + libcommonstr_la_CFLAGS += $(LIBREGEX_CFLAGS) + libcommonstr_la_LIBADD += $(LIBREGEX_LIBS) + libcommonclient_la_CFLAGS += $(LIBREGEX_CFLAGS) libcommonclient_la_LIBADD += $(LIBREGEX_LIBS) endif HAVE_LIBREGEX diff --git a/tools/nut-scanner/Makefile.am b/tools/nut-scanner/Makefile.am index db2e645b09..05f0a6e95e 100644 --- a/tools/nut-scanner/Makefile.am +++ b/tools/nut-scanner/Makefile.am @@ -28,7 +28,7 @@ $(NUT_SCANNER_DEPS): dummy # Make sure out-of-dir dependencies exist (especially when dev-building parts): $(top_builddir)/include/nut_version.h \ -$(top_builddir)/common/libcommonclient.la \ +$(top_builddir)/common/libcommonstr.la \ $(top_builddir)/common/libcommon.la: dummy +@cd $(@D) && $(MAKE) $(AM_MAKEFLAGS) $(@F) @@ -68,7 +68,7 @@ libnutscan_la_LIBADD = $(NETLIBS) if WITH_LIBLTDL libnutscan_la_LIBADD += $(LIBLTDL_LIBS) endif WITH_LIBLTDL -libnutscan_la_LIBADD += $(top_builddir)/common/libcommonclient.la + if HAVE_SEMAPHORE_LIBS # Are additional libraries needed for semaphore support? libnutscan_la_LIBADD += $(SEMLIBS) @@ -104,6 +104,8 @@ libnutscan_la_LDFLAGS += -export-symbols-regex '^(nutscan_|nut_debug_level|s_ups libnutscan_la_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include \ $(LIBLTDL_CFLAGS) -I$(top_srcdir)/drivers +libnutscan_la_LIBADD += $(top_builddir)/common/libcommonstr.la + nut_scanner_SOURCES = nut-scanner.c nut_scanner_CFLAGS = -I$(top_srcdir)/clients -I$(top_srcdir)/include nut_scanner_LDADD = libnutscan.la