Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common/Makefile.am, tools/nut-scanner/Makefile.am: Introduce libcommonstr.la #2478

Merged
merged 2 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions common/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions tools/nut-scanner/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Loading