When trying to add an "ndctl test" user of the util/log.c and
util/sysfs.c routines, automake complained about util/log.o being
already built for a library when trying to include it in the utility.
Move the library build into ndctl/lib/ rather than re-using ndctl/.

Signed-off-by: Dan Williams <dan.j.willi...@intel.com>
---
 Makefile.am            |    2 +-
 configure.ac           |    3 ++-
 daxctl/Makefile.am     |   27 ---------------------------
 daxctl/lib/Makefile.am |   28 ++++++++++++++++++++++++++++
 ndctl/Makefile.am      |   48 ------------------------------------------------
 ndctl/lib/Makefile.am  |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 78 insertions(+), 77 deletions(-)
 delete mode 100644 daxctl/Makefile.am
 create mode 100644 daxctl/lib/Makefile.am
 create mode 100644 ndctl/lib/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index ce1032e3381d..9eb396639efe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
 include Makefile.am.in
 
 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-SUBDIRS = . daxctl ndctl
+SUBDIRS = . daxctl/lib ndctl/lib ndctl
 if ENABLE_DOCS
 SUBDIRS += Documentation
 endif
diff --git a/configure.ac b/configure.ac
index 7bc97be9039d..7b4af616cf2b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -260,7 +260,8 @@ AC_SUBST([my_CFLAGS])
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_FILES([
         Makefile
-        daxctl/Makefile
+        daxctl/lib/Makefile
+        ndctl/lib/Makefile
         ndctl/Makefile
         test/Makefile
         Documentation/Makefile
diff --git a/daxctl/Makefile.am b/daxctl/Makefile.am
deleted file mode 100644
index 67ae5aed4a18..000000000000
--- a/daxctl/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-include $(top_srcdir)/Makefile.am.in
-
-%.pc: %.pc.in Makefile
-       $(SED_PROCESS)
-
-lib_LTLIBRARIES = lib/libdaxctl.la
-
-lib_libdaxctl_la_SOURCES =\
-       libdaxctl.h \
-       lib/libdaxctl-private.h \
-       ../util/sysfs.c \
-       ../util/sysfs.h \
-       ../util/log.c \
-       ../util/log.h \
-       lib/libdaxctl.c
-
-EXTRA_DIST += lib/libdaxctl.sym
-
-lib_libdaxctl_la_LDFLAGS = $(AM_LDFLAGS) \
-       -version-info 
$(LIBDAXCTL_CURRENT):$(LIBDAXCTL_REVISION):$(LIBDAXCTL_AGE) \
-       -Wl,--version-script=$(top_srcdir)/daxctl/lib/libdaxctl.sym
-lib_libdaxctl_la_DEPENDENCIES = lib/libdaxctl.sym
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = lib/libdaxctl.pc
-EXTRA_DIST += lib/libdaxctl.pc.in
-CLEANFILES += lib/libdaxctl.pc
diff --git a/daxctl/lib/Makefile.am b/daxctl/lib/Makefile.am
new file mode 100644
index 000000000000..92783847266a
--- /dev/null
+++ b/daxctl/lib/Makefile.am
@@ -0,0 +1,28 @@
+include $(top_srcdir)/Makefile.am.in
+
+%.pc: %.pc.in Makefile
+       $(SED_PROCESS)
+
+pkginclude_HEADERS = ../libdaxctl.h
+lib_LTLIBRARIES = libdaxctl.la
+
+libdaxctl_la_SOURCES =\
+       ../libdaxctl.h \
+       libdaxctl-private.h \
+       ../../util/sysfs.c \
+       ../../util/sysfs.h \
+       ../../util/log.c \
+       ../../util/log.h \
+       libdaxctl.c
+
+EXTRA_DIST += libdaxctl.sym
+
+libdaxctl_la_LDFLAGS = $(AM_LDFLAGS) \
+       -version-info 
$(LIBDAXCTL_CURRENT):$(LIBDAXCTL_REVISION):$(LIBDAXCTL_AGE) \
+       -Wl,--version-script=$(top_srcdir)/daxctl/lib/libdaxctl.sym
+libdaxctl_la_DEPENDENCIES = libdaxctl.sym
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libdaxctl.pc
+EXTRA_DIST += libdaxctl.pc.in
+CLEANFILES += libdaxctl.pc
diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
index a84595b0f5e1..f6cd3f1c235b 100644
--- a/ndctl/Makefile.am
+++ b/ndctl/Makefile.am
@@ -1,39 +1,5 @@
 include $(top_srcdir)/Makefile.am.in
 
-BUILT_SOURCES = libndctl.h
-lib/libndctl.h: libndctl.h.in
-       touch $(top_srcdir)/version.m4
-
-%.pc: %.pc.in Makefile
-       $(SED_PROCESS)
-
-pkginclude_HEADERS = libndctl.h
-lib_LTLIBRARIES = lib/libndctl.la
-
-lib_libndctl_la_SOURCES =\
-       libndctl.h \
-       lib/libndctl-private.h \
-       ../util/log.c \
-       ../util/log.h \
-       ../util/sysfs.c \
-       ../util/sysfs.h \
-       lib/libndctl.c
-
-lib_libndctl_la_LIBADD =\
-       ../daxctl/lib/libdaxctl.la \
-       $(UDEV_LIBS) \
-       $(UUID_LIBS) \
-       $(KMOD_LIBS)
-
-if ENABLE_ARS
-lib_libndctl_la_SOURCES += lib/libndctl-ars.c
-endif
-
-if ENABLE_SMART
-lib_libndctl_la_SOURCES += lib/libndctl-smart.c
-lib_libndctl_la_SOURCES += lib/libndctl-hpe1.c
-endif
-
 bin_PROGRAMS = ndctl
 
 ndctl_SOURCES = ndctl.c \
@@ -72,17 +38,3 @@ ndctl_SOURCES += ../test/libndctl.c \
                 ../test/parent-uuid.c \
                 ../test/core.c
 endif
-
-
-
-EXTRA_DIST += lib/libndctl.sym
-
-lib_libndctl_la_LDFLAGS = $(AM_LDFLAGS) \
-       -version-info $(LIBNDCTL_CURRENT):$(LIBNDCTL_REVISION):$(LIBNDCTL_AGE) \
-       -Wl,--version-script=$(top_srcdir)/ndctl/lib/libndctl.sym
-lib_libndctl_la_DEPENDENCIES = lib/libndctl.sym
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = lib/libndctl.pc
-EXTRA_DIST += lib/libndctl.pc.in
-CLEANFILES += lib/libndctl.pc
diff --git a/ndctl/lib/Makefile.am b/ndctl/lib/Makefile.am
new file mode 100644
index 000000000000..58a0bb3c667b
--- /dev/null
+++ b/ndctl/lib/Makefile.am
@@ -0,0 +1,47 @@
+include $(top_srcdir)/Makefile.am.in
+
+BUILT_SOURCES = ../libndctl.h
+../libndctl.h: ../libndctl.h.in
+       touch $(top_srcdir)/version.m4
+
+%.pc: %.pc.in Makefile
+       $(SED_PROCESS)
+
+pkginclude_HEADERS = ../libndctl.h
+lib_LTLIBRARIES = libndctl.la
+
+libndctl_la_SOURCES =\
+       libndctl.h \
+       libndctl-private.h \
+       ../../util/log.c \
+       ../../util/log.h \
+       ../../util/sysfs.c \
+       ../../util/sysfs.h \
+       libndctl.c
+
+libndctl_la_LIBADD =\
+       ../../daxctl/lib/libdaxctl.la \
+       $(UDEV_LIBS) \
+       $(UUID_LIBS) \
+       $(KMOD_LIBS)
+
+if ENABLE_ARS
+libndctl_la_SOURCES += libndctl-ars.c
+endif
+
+if ENABLE_SMART
+libndctl_la_SOURCES += libndctl-smart.c
+libndctl_la_SOURCES += libndctl-hpe1.c
+endif
+
+EXTRA_DIST += libndctl.sym
+
+libndctl_la_LDFLAGS = $(AM_LDFLAGS) \
+       -version-info $(LIBNDCTL_CURRENT):$(LIBNDCTL_REVISION):$(LIBNDCTL_AGE) \
+       -Wl,--version-script=$(top_srcdir)/ndctl/lib/libndctl.sym
+libndctl_la_DEPENDENCIES = libndctl.sym
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libndctl.pc
+EXTRA_DIST += libndctl.pc.in
+CLEANFILES += libndctl.pc

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

Reply via email to