13853 Some SMB commands missing CTF support
Reviewed by: Evan Layton <elayton@tintri.com>
Reviewed by: Joyce McIntosh <jmcintosh@tintri.com>
Reviewed by: Matt Barden <mbarden@tintri.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
diff --git a/usr/src/cmd/smbsrv/smbadm/Makefile b/usr/src/cmd/smbsrv/smbadm/Makefile
index 9011799..ce22971 100644
--- a/usr/src/cmd/smbsrv/smbadm/Makefile
+++ b/usr/src/cmd/smbsrv/smbadm/Makefile
@@ -30,6 +30,7 @@
 SRCS=	smbadm.c
 
 include ../../Makefile.cmd
+include ../../Makefile.ctf
 include ../Makefile.smbsrv.defs
 
 LDLIBS += -L$(ROOT)/usr/lib/smbsrv -lsmb -lsmbns -lsecdb -lumem
diff --git a/usr/src/cmd/smbsrv/smbd/Makefile b/usr/src/cmd/smbsrv/smbd/Makefile
index a33dac8..3258557 100644
--- a/usr/src/cmd/smbsrv/smbd/Makefile
+++ b/usr/src/cmd/smbsrv/smbd/Makefile
@@ -45,6 +45,7 @@
 SRCS=	$(OBJS:%.o=%.c)
 
 include ../../Makefile.cmd
+include ../../Makefile.ctf
 
 MANIFEST=	server.xml
 SVCMETHOD=	svc-smbd
diff --git a/usr/src/cmd/smbsrv/smbstat/Makefile b/usr/src/cmd/smbsrv/smbstat/Makefile
index 64268cc..f0d8378 100644
--- a/usr/src/cmd/smbsrv/smbstat/Makefile
+++ b/usr/src/cmd/smbsrv/smbstat/Makefile
@@ -26,6 +26,7 @@
 SRCS=	smbstat.c
 
 include ../../Makefile.cmd
+include ../../Makefile.ctf
 
 OBJS=	$(SRCS:%.c=%.o)
 
diff --git a/usr/src/tools/quick/make-smbsrv b/usr/src/tools/quick/make-smbsrv
index 0aabee3..f4c93ea 100755
--- a/usr/src/tools/quick/make-smbsrv
+++ b/usr/src/tools/quick/make-smbsrv
@@ -11,7 +11,7 @@
 #
 
 #
-# Copyright 2019 Nexenta Systems, Inc.  All rights reserved.
+# Copyright 2020 Tintri by DDN, Inc.  All rights reserved.
 #
 
 # Use normal make (not dmake) by default.
@@ -90,11 +90,12 @@
   test -f $ROOT/usr/include/rpcsvc/daemon_utils.h ||
     (cd $SRC/head && $make $targ)
 
-  # always update the smbsrv headers to be safe
+  # always update the sys,smbsrv headers to be safe
   (cd $SRC/uts/common/gssapi && $make -k $targ)
   (cd $SRC/uts/common/sys && $make -k $targ)
   (cd $SRC/uts/common/smb && $make -k $targ)
   (cd $SRC/uts/common/smbsrv && $make -k $targ)
+  (cd $SRC/uts/common/c2 && $make -k $targ)
 fi
 
 if [ "$targ" = lint ]
@@ -106,17 +107,27 @@
 
 # Need some library headers too...
 for lib in \
+  libc \
+  libnsl \
+  libnvpair \
+  libsocket \
+  \
   libads \
+  libbrand \
   libbsm \
   libcmdutils \
   libcryptoutil \
   libdevid \
+  libdisasm \
   libfakekernel	\
   libgss \
   libidmap \
+  libinetutil \
+  libipsecutil \
   libkrb5 \
   libmlrpc \
   libpam \
+  libsaveargs \
   libsec \
   libscf \
   libshare \
@@ -141,35 +152,67 @@
   *) targ=$1 ;;
   esac
   ( unset SOURCEDEBUG ;
-  (cd $SRC/uts/$x/nsmb && $make $targ) ;
-  (cd $SRC/uts/$x/smbfs && $make $targ) ;
   (cd $SRC/uts/$x/smbsrv && $make $targ) )
 }
 
 ################################################################
+#
+# Build all libraries used by the other targets in here.
+#
+# Run this once (at least) in each new workspace where you
+# will run "make-smbsrv install", if you want to avoid linking
+# against the libraries from your build host.
+#
+do_deplibs() {
 
-# Note lib1 builds prerequisite libraries not delivered by the
-# tar file we create below.  To accelerate clean/install, we
-# skip these on clean (but still nuke them for clobber)
-
-do_lib1() {
+(cd $SRC/lib/ssp_ns && $make $1)
+(cd $SRC/lib/libc && $make $1)
 
 for lib in \
+  libm \
+  libmd \
+  libnsl \
+  libnvpair \
+  libsocket \
   libavl \
   libgss \
+  libgen \
   libkrb5 \
+  libkstat \
   libcmdutils \
+  libresolv2 \
+  libldap5 \
+  libsldap \
+  libreparse \
+  libpam \
+  libuutil \
+  libidmap \
+  libinetutil \
+  libdlpi \
+  libbsm \
+  libsec \
+  libsecdb \
   libsqlite \
-  libuutil
+  libumem \
+  libuuid \
+  libsaveargs \
+  libproc \
+  libscf \
+  libcryptoutil \
+  libmd5 \
+  libzfs_core \
+  libzfs \
+  pkcs11/libpkcs11
 do
-  (cd $SRC/lib/$lib && $make $1)
+  # So we don't have to build EVERYTHING, set LDCHECKS=
+  # when building the dependent libraries.
+  (cd $SRC/lib/$lib && LDCHECKS='' $make $1)
 done
 }
 
-# lib2 builds stuff we include in the tar file,
-# or that we don't mind rebuilding after clean.
+################################################################
 
-do_lib2() {
+do_libs() {
 
 for lib in \
   libfakekernel \
@@ -227,7 +270,6 @@
 done
 }
 
-
 ################################################################
 # This builds $SRC/TAGS (and cscope.files) in a helpful order.
 
@@ -283,7 +325,6 @@
 usr/sbin/smbadm
 usr/sbin/smbstat
 "
-
 	(cd $ROOT && tar cfj ../../smbsrv-${git_rev}.tar.bz2 $files)
 }
 
@@ -303,31 +344,35 @@
     set -e
     do_hdrs $arg
     do_kern $arg
-    do_lib1 $arg
-    do_lib2 $arg
+    do_libs $arg
     do_cmds $arg
     ;;
   lint)
     do_hdrs $arg
     do_kern $arg
-    do_lib1 $arg
-    do_lib2 $arg
+    do_libs $arg
     do_cmds $arg
     ;;
   clean)
     # intentionally skip: lib1, hdrs, tools
     do_cmds $arg
-    do_lib2 $arg
+    do_libs $arg
     do_kern $arg
     ;;
   clobber)
     do_cmds $arg
-    do_lib2 $arg
-    do_lib1 $arg
+    do_libs $arg
     do_kern $arg
     do_hdrs $arg
+    do_deplibs $arg
     clobber_tools
     ;;
+  deplibs)
+    build_tools
+    set -e
+    do_hdrs install
+    do_deplibs install
+    ;;
   tags)
     do_tags
     ;;
@@ -335,7 +380,7 @@
     do_tar
     ;;
   *)
-    echo "Usage: $0 {install|lint|clean|clobber|tags|tar}";
+    echo "Usage: $0 {install|lint|clean|clobber|deplibs|tags|tar}";
     exit 1;
     ;;
   esac