ndctl: fix ndctl linking with libkeyutils

Compilation on Ubuntu 18.04 fails with:

  /usr/bin/ld: util/keys.o: undefined reference to symbol 'keyctl_read_alloc@@KEYUTILS_0.3'
  /lib/x86_64-linux-gnu/libkeyutils.so.1: error adding symbols: DSO missing from command line

Seems like libkeyutils is incorrectly linked against libndctl,
where in reality it's the ndctl application that uses keyutils.

Fixes: 86b078b44275 ("ndctl: add passphrase management commands")
Cc: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Piotr Balcer <piotr.balcer@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
index 3287dbb..502271e 100644
--- a/ndctl/Makefile.am
+++ b/ndctl/Makefile.am
@@ -47,6 +47,10 @@
 	$(KMOD_LIBS) \
 	$(JSON_LIBS)
 
+if ENABLE_KEYUTILS
+ndctl_LDADD += -lkeyutils
+endif
+
 if ENABLE_TEST
 ndctl_SOURCES += ../test/libndctl.c \
 		 ../test/dsm-fail.c \
diff --git a/ndctl/lib/Makefile.am b/ndctl/lib/Makefile.am
index 99eaae0..7797039 100644
--- a/ndctl/lib/Makefile.am
+++ b/ndctl/lib/Makefile.am
@@ -30,10 +30,6 @@
 	$(UUID_LIBS) \
 	$(KMOD_LIBS)
 
-if ENABLE_KEYUTILS
-libndctl_la_LIBADD += -lkeyutils
-endif
-
 EXTRA_DIST += libndctl.sym
 
 libndctl_la_LDFLAGS = $(AM_LDFLAGS) \