From d8621b3ea82b7fc1937b0eefb2b1316b2ce361a5 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 2 Apr 2021 15:19:51 -0400 Subject: [PATCH] Add an internal 'libcommon' for utils Replicate the setup in tools and create a convenience library for internal utils. Move the 'snprintf' component to this internal lib. This is part of an effort to standardize our autotools setup across projects to simplify maintenance. Change-Id: I4e8ad48eda64a093b7e169474ad454b74a237e09 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- .gitignore | 2 +- configure.ac | 1 - src/Makefile.am | 1 - src/common/Makefile.am | 36 +++++++++++++++++++ src/{snprintf/core.c => common/logging.c} | 0 .../patient_write.c => common/patient.c} | 0 src/{ => common}/snprintf/README | 0 src/{ => common}/snprintf/fflush.c | 0 src/{ => common}/snprintf/fileext.h | 0 src/{ => common}/snprintf/floatio.h | 0 src/{ => common}/snprintf/fvwrite.c | 0 src/{ => common}/snprintf/fvwrite.h | 0 src/{ => common}/snprintf/local.h | 0 src/{ => common}/snprintf/mbrtowc_sb.c | 0 src/{ => common}/snprintf/snprintf.c | 0 src/{ => common}/snprintf/various.h | 0 src/{ => common}/snprintf/vfprintf.c | 0 src/{ => common}/snprintf/wcio.h | 0 src/{ => common}/snprintf/wsetup.c | 0 src/liblttng-ust-ctl/Makefile.am | 2 +- src/liblttng-ust-dl/Makefile.am | 2 +- src/liblttng-ust/Makefile.am | 4 +-- src/snprintf/Makefile.am | 26 -------------- tests/unit/libringbuffer/Makefile.am | 2 +- tests/unit/snprintf/Makefile.am | 2 +- 25 files changed, 43 insertions(+), 35 deletions(-) rename src/{snprintf/core.c => common/logging.c} (100%) rename src/{snprintf/patient_write.c => common/patient.c} (100%) rename src/{ => common}/snprintf/README (100%) rename src/{ => common}/snprintf/fflush.c (100%) rename src/{ => common}/snprintf/fileext.h (100%) rename src/{ => common}/snprintf/floatio.h (100%) rename src/{ => common}/snprintf/fvwrite.c (100%) rename src/{ => common}/snprintf/fvwrite.h (100%) rename src/{ => common}/snprintf/local.h (100%) rename src/{ => common}/snprintf/mbrtowc_sb.c (100%) rename src/{ => common}/snprintf/snprintf.c (100%) rename src/{ => common}/snprintf/various.h (100%) rename src/{ => common}/snprintf/vfprintf.c (100%) rename src/{ => common}/snprintf/wcio.h (100%) rename src/{ => common}/snprintf/wsetup.c (100%) delete mode 100644 src/snprintf/Makefile.am diff --git a/.gitignore b/.gitignore index 37d46f9f..0e4a2464 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ Makefile.in *.info *.class cscope.* +.dirstamp /configure /aclocal.m4 @@ -148,7 +149,6 @@ cscope.* /src/libmsgpack/Makefile /src/libringbuffer/Makefile /src/python-lttngust/Makefile -/src/snprintf/Makefile /src/Makefile /tests/Makefile /tests/benchmark/Makefile diff --git a/configure.ac b/configure.ac index 00b70f2a..4c6eac89 100644 --- a/configure.ac +++ b/configure.ac @@ -548,7 +548,6 @@ AC_CONFIG_FILES([ src/python-lttngust/lttngust/version.py src/python-lttngust/Makefile src/python-lttngust/setup.py - src/snprintf/Makefile tests/benchmark/Makefile tests/compile/ctf-types/Makefile tests/compile/hello.cxx/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index d9253053..28a32ba5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,6 @@ SUBDIRS = \ common \ - snprintf \ libringbuffer \ liblttng-ust-comm \ libcounter \ diff --git a/src/common/Makefile.am b/src/common/Makefile.am index 276c06a5..e73cc1fa 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -1,5 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-only +AUTOMAKE_OPTIONS = subdir-objects + ### ### ### Global private headers ### ### ### @@ -30,3 +32,37 @@ noinst_HEADERS += \ # Used by liblttng-ust-fd noinst_HEADERS += \ ust-fd.h + +### ### +## Convenience libraries ## +### ### + +noinst_LTLIBRARIES = \ + snprintf/libsnprintf.la \ + libcommon.la + +# snprintf +snprintf_libsnprintf_la_SOURCES = \ + snprintf/fflush.c \ + snprintf/fileext.h \ + snprintf/floatio.h \ + snprintf/fvwrite.c \ + snprintf/fvwrite.h \ + snprintf/local.h \ + snprintf/mbrtowc_sb.c \ + snprintf/snprintf.c \ + snprintf/various.h \ + snprintf/vfprintf.c \ + snprintf/wcio.h \ + snprintf/wsetup.c + +# Common library +libcommon_la_SOURCES = \ + logging.c \ + logging.h \ + patient.c + +libcommon_la_LIBADD = \ + snprintf/libsnprintf.la + +EXTRA_DIST = snprintf/README diff --git a/src/snprintf/core.c b/src/common/logging.c similarity index 100% rename from src/snprintf/core.c rename to src/common/logging.c diff --git a/src/snprintf/patient_write.c b/src/common/patient.c similarity index 100% rename from src/snprintf/patient_write.c rename to src/common/patient.c diff --git a/src/snprintf/README b/src/common/snprintf/README similarity index 100% rename from src/snprintf/README rename to src/common/snprintf/README diff --git a/src/snprintf/fflush.c b/src/common/snprintf/fflush.c similarity index 100% rename from src/snprintf/fflush.c rename to src/common/snprintf/fflush.c diff --git a/src/snprintf/fileext.h b/src/common/snprintf/fileext.h similarity index 100% rename from src/snprintf/fileext.h rename to src/common/snprintf/fileext.h diff --git a/src/snprintf/floatio.h b/src/common/snprintf/floatio.h similarity index 100% rename from src/snprintf/floatio.h rename to src/common/snprintf/floatio.h diff --git a/src/snprintf/fvwrite.c b/src/common/snprintf/fvwrite.c similarity index 100% rename from src/snprintf/fvwrite.c rename to src/common/snprintf/fvwrite.c diff --git a/src/snprintf/fvwrite.h b/src/common/snprintf/fvwrite.h similarity index 100% rename from src/snprintf/fvwrite.h rename to src/common/snprintf/fvwrite.h diff --git a/src/snprintf/local.h b/src/common/snprintf/local.h similarity index 100% rename from src/snprintf/local.h rename to src/common/snprintf/local.h diff --git a/src/snprintf/mbrtowc_sb.c b/src/common/snprintf/mbrtowc_sb.c similarity index 100% rename from src/snprintf/mbrtowc_sb.c rename to src/common/snprintf/mbrtowc_sb.c diff --git a/src/snprintf/snprintf.c b/src/common/snprintf/snprintf.c similarity index 100% rename from src/snprintf/snprintf.c rename to src/common/snprintf/snprintf.c diff --git a/src/snprintf/various.h b/src/common/snprintf/various.h similarity index 100% rename from src/snprintf/various.h rename to src/common/snprintf/various.h diff --git a/src/snprintf/vfprintf.c b/src/common/snprintf/vfprintf.c similarity index 100% rename from src/snprintf/vfprintf.c rename to src/common/snprintf/vfprintf.c diff --git a/src/snprintf/wcio.h b/src/common/snprintf/wcio.h similarity index 100% rename from src/snprintf/wcio.h rename to src/common/snprintf/wcio.h diff --git a/src/snprintf/wsetup.c b/src/common/snprintf/wsetup.c similarity index 100% rename from src/snprintf/wsetup.c rename to src/common/snprintf/wsetup.c diff --git a/src/liblttng-ust-ctl/Makefile.am b/src/liblttng-ust-ctl/Makefile.am index 30c3879a..43a88566 100644 --- a/src/liblttng-ust-ctl/Makefile.am +++ b/src/liblttng-ust-ctl/Makefile.am @@ -12,5 +12,5 @@ liblttng_ust_ctl_la_LDFLAGS = \ liblttng_ust_ctl_la_LIBADD = \ $(top_builddir)/src/liblttng-ust-comm/liblttng-ust-comm.la \ $(top_builddir)/src/liblttng-ust/liblttng-ust-support.la \ - $(top_builddir)/src/snprintf/libustsnprintf.la \ + $(top_builddir)/src/common/libcommon.la \ $(DL_LIBS) diff --git a/src/liblttng-ust-dl/Makefile.am b/src/liblttng-ust-dl/Makefile.am index 3e919f7d..75149ea4 100644 --- a/src/liblttng-ust-dl/Makefile.am +++ b/src/liblttng-ust-dl/Makefile.am @@ -10,7 +10,7 @@ liblttng_ust_dl_la_SOURCES = \ liblttng_ust_dl_la_LIBADD = \ $(top_builddir)/src/liblttng-ust/liblttng-ust.la \ - $(top_builddir)/src/snprintf/libustsnprintf.la \ + $(top_builddir)/src/common/libcommon.la \ $(DL_LIBS) liblttng_ust_dl_la_CFLAGS = -DUST_COMPONENT=liblttng-ust-dl $(AM_CFLAGS) diff --git a/src/liblttng-ust/Makefile.am b/src/liblttng-ust/Makefile.am index 5d94be61..8892ff32 100644 --- a/src/liblttng-ust/Makefile.am +++ b/src/liblttng-ust/Makefile.am @@ -22,7 +22,7 @@ liblttng_ust_tracepoint_la_SOURCES = \ liblttng_ust_tracepoint_la_LIBADD = \ liblttng-ust-common.la \ - $(top_builddir)/src/snprintf/libustsnprintf.la \ + $(top_builddir)/src/common/libcommon.la \ $(DL_LIBS) liblttng_ust_tracepoint_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION) @@ -135,7 +135,7 @@ liblttng_ust_support_la_LIBADD = \ liblttng_ust_la_LIBADD = \ -lrt \ liblttng-ust-common.la \ - $(top_builddir)/src/snprintf/libustsnprintf.la \ + $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/src/liblttng-ust-comm/liblttng-ust-comm.la \ liblttng-ust-tracepoint.la \ liblttng-ust-runtime.la liblttng-ust-support.la \ diff --git a/src/snprintf/Makefile.am b/src/snprintf/Makefile.am deleted file mode 100644 index 7d9e2b64..00000000 --- a/src/snprintf/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-only - -AM_CPPFLAGS += -I$(top_srcdir)/libustcomm -AM_CFLAGS += -fno-strict-aliasing - -noinst_LTLIBRARIES = libustsnprintf.la -libustsnprintf_la_SOURCES = \ - fflush.c \ - fileext.h \ - floatio.h \ - fvwrite.c \ - fvwrite.h \ - local.h \ - mbrtowc_sb.c \ - snprintf.c \ - various.h \ - vfprintf.c \ - wcio.h \ - wsetup.c \ - core.c \ - patient_write.c - -libustsnprintf_la_LDFLAGS = -no-undefined -static -libustsnprintf_la_CFLAGS = -DUST_COMPONENT="lttng_ust_snprintf" -fPIC $(AM_CFLAGS) - -EXTRA_DIST = README diff --git a/tests/unit/libringbuffer/Makefile.am b/tests/unit/libringbuffer/Makefile.am index 134bcb1c..1954e454 100644 --- a/tests/unit/libringbuffer/Makefile.am +++ b/tests/unit/libringbuffer/Makefile.am @@ -7,5 +7,5 @@ test_shm_SOURCES = shm.c test_shm_LDADD = \ $(top_builddir)/src/libringbuffer/libringbuffer.la \ $(top_builddir)/src/liblttng-ust-comm/liblttng-ust-comm.la \ - $(top_builddir)/src/snprintf/libustsnprintf.la \ + $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/tests/utils/libtap.a diff --git a/tests/unit/snprintf/Makefile.am b/tests/unit/snprintf/Makefile.am index e4af591a..cfc232a6 100644 --- a/tests/unit/snprintf/Makefile.am +++ b/tests/unit/snprintf/Makefile.am @@ -5,7 +5,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/tests/utils noinst_PROGRAMS = test_snprintf test_snprintf_SOURCES = snprintf.c test_snprintf_LDADD = \ - $(top_builddir)/src/snprintf/libustsnprintf.la \ + $(top_builddir)/src/common/snprintf/libsnprintf.la \ $(top_builddir)/tests/utils/libtap.a EXTRA_DIST = README -- 2.34.1