--- old/usr/src/tools/quick/make-smbsrv	Mon Aug  5 17:25:49 2019
+++ new/usr/src/tools/quick/make-smbsrv	Mon Aug  5 17:25:49 2019
@@ -11,11 +11,11 @@
 #
 
 #
-# Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
+# Copyright 2018 Nexenta Systems, Inc.  All rights reserved.
 #
 
-# Use distributed make (dmake) by default.
-make=${MAKE:-dmake}
+# Use normal make (not dmake) by default.
+make=${MAKE:-make}
 
 CLOSED_IS_PRESENT=no
 export CLOSED_IS_PRESENT
@@ -32,12 +32,14 @@
 case $cpu in
 i386)
 	x=intel
+	kmdb_arch="amd64"
 	mdb_arch="ia32 amd64"
 	arch64=amd64
 	;;
 sparc)
 	x=sparc
-	mdb_arch=v9
+	kmdb_arch=v9
+	mdb_arch="v7 v9"
 	arch64=sparcv9
 	;;
 *)  echo "Huh?" ; exit 1;;
@@ -78,22 +80,29 @@
     (cd $SRC/uts && $make -k all_h)
 
   test -f $SRC/head/rpcsvc/nispasswd.h ||
-    (cd $SRC/head && $make -k install_h)
+    (cd $SRC/head && $make -k $targ)
 
   # ... stuff under $ROOT (proto area)
   test -d $ROOT/usr/include/sys ||
     (cd $SRC && $make rootdirs)
   test -f $ROOT/usr/include/sys/types.h ||
-    (cd $SRC/uts && $make -k install_h)
+    (cd $SRC/uts && $make -k $targ)
   test -f $ROOT/usr/include/rpcsvc/daemon_utils.h ||
-    (cd $SRC/head && $make install_h)
+    (cd $SRC/head && $make $targ)
 
   # always update the smbsrv headers to be safe
-  (cd $SRC/uts/common/gssapi && $make -k install_h)
-  (cd $SRC/uts/common/sys && $make -k install_h)
-  (cd $SRC/uts/common/smb && $make -k install_h)
-  (cd $SRC/uts/common/smbsrv && $make -k install_h)
+  (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 ]
+then
+  targ=check
+  (cd $SRC/uts/common/smb && $make -k $targ)
+  (cd $SRC/uts/common/smbsrv && $make -k $targ)
 fi
 
 # Need some library headers too...
@@ -105,8 +114,9 @@
   libdevid \
   libfakekernel	\
   libgss \
-  libkrb5 \
   libidmap \
+  libkrb5 \
+  libmlrpc \
   libpam \
   libsec \
   libscf \
@@ -114,7 +124,10 @@
   libsmbfs \
   libsqlite \
   libuutil \
+  libzfs_core \
+  libzfs \
   passwdutil \
+  pkcs11 \
   smbsrv
 do
   (cd $SRC/lib/$lib && $make $targ)
@@ -162,7 +175,8 @@
 for lib in \
   libfakekernel \
   libads \
-  libsmbfs
+  libsmbfs \
+  libmlrpc
 do
   (cd $SRC/lib/$lib && $make $1)
 done
@@ -182,20 +196,19 @@
 install)
   # mount programs need fslib.o
   (cd $SRC/cmd/fs.d && $make fslib.o)
-  (cd $SRC/cmd/fs.d/smbclnt && $make $1 catalog)
   ;;
 clean|clobber)
-  (cd $SRC/cmd/fs.d/smbclnt && $make $1)
   (cd $SRC/cmd/fs.d && $make ${1}_local)
   ;;
 esac
 
-(cd $SRC/cmd/devfsadm && $make $1)
 (cd $SRC/cmd/smbsrv && $make $1)
 
 # Build the MDB modules, WITH the linktest
 (cd $SRC/cmd/mdb/tools && $make $1)
-for a in $mdb_arch
+
+# kmdb_arch is 64-bit only
+for a in $kmdb_arch
 do
   case $1 in
   install|lint)
@@ -207,7 +220,6 @@
 	$make -k $1 )
     ;;
   esac
-
   (cd $SRC/cmd/mdb/$x/$a/nsmb &&
 	$make $1 KMDB_LINKTEST_ENABLE= )
   (cd $SRC/cmd/mdb/$x/$a/smbfs &&
@@ -214,25 +226,20 @@
 	$make $1 KMDB_LINKTEST_ENABLE= )
   (cd $SRC/cmd/mdb/$x/$a/smbsrv &&
 	$make $1 KMDB_LINKTEST_ENABLE= )
-  (cd $SRC/cmd/mdb/$x/$a/libfksmbsrv &&
-	$make $1 KMDB_LINKTEST_ENABLE= )
-
-# We build these libraries (to the proto area), so we need to
-# build the mdb modules too so mdb will load them.
-  (cd $SRC/cmd/mdb/$x/$a/libcmdutils &&
-	$make $1 )
-  (cd $SRC/cmd/mdb/$x/$a/libavl &&
-	$make $1 )
-
 done
 
-(cd $SRC/cmd/Adm/sun && $make $1)
+# mdb_arch is both 32-bit & 64-bit
+for a in $mdb_arch
+do
+  # We build these libraries (to the proto area), so we need to
+  # build the mdb modules for all dependent libraries too.
 
-# Deal with mode 0400 file annoyance...
-# See usr/src/cmd/Adm/sun/Makefile
-if [ $1 = install ]; then
-  chmod a+r $ROOT/var/smb/smbpasswd
-fi
+  for lib in libfksmbsrv libmlsvc libcmdutils libavl
+  do
+    (cd $SRC/cmd/mdb/$x/$a/$lib && $make $1 )
+
+  done
+done
 }
 
 
@@ -249,13 +256,15 @@
 	find uts/common/smbsrv -name '*.[ch]' -print |sort
 	find uts/common/fs/smbsrv -name '*.[ch]' -print |sort
 	find uts/common/gssapi -name '*.[ch]' -print |sort
+	find common/smbsrv -name '*.[ch]' -print |sort
 	find head -name '*.h' -print |sort
 	find lib/smbsrv -name '*.[ch]' -print |sort
 	find lib/libsmbfs -name '*.[ch]' -print |sort
+	find lib/libmlrpc -name '*.ndl' -print |sort
+	find lib/libmlrpc -name '*.[ch]' -print |sort
 	find lib/libads -name '*.[ch]' -print |sort
 	find lib/libgss -name '*.[ch]' -print |sort
 	find cmd/smbsrv -name '*.[ch]' -print |sort
-	find common/smbsrv -name '*.[ch]' -print |sort
 	) > $SRC/cscope.files
 
 	(cd $SRC ;
@@ -271,23 +280,22 @@
 	files="
 lib/svc/manifest/network/smb/server.xml
 usr/kernel/drv/$arch64/smbsrv
-usr/kernel/drv/smbsrv
 usr/kernel/kmdb/$arch64/smbsrv
-usr/kernel/kmdb/smbsrv
 usr/lib/fs/smb/$arch64/libshare_smb.so.1
 usr/lib/fs/smb/libshare_smb.so.1
 usr/lib/libsmbfs.so.1
 usr/lib/mdb/kvm/$arch64/smbsrv.so
 usr/lib/mdb/kvm/smbsrv.so
+usr/lib/mdb/proc/libmlsvc.so
 usr/lib/reparse/libreparse_smb.so.1
 usr/lib/security/pam_smb_passwd.so.1
 usr/lib/smbsrv/dtrace
-usr/lib/smbsrv/libmlrpc.so.1
+usr/lib/libmlrpc.so.2
 usr/lib/smbsrv/libmlsvc.so.1
 usr/lib/smbsrv/libsmb.so.1
 usr/lib/smbsrv/libsmbns.so.1
+usr/lib/smbsrv/nvlprint
 usr/lib/smbsrv/smbd
-usr/sbin/devfsadm
 usr/sbin/smbadm
 usr/sbin/smbstat
 "
@@ -316,6 +324,7 @@
     do_cmds $arg
     ;;
   lint)
+    do_hdrs $arg
     do_kern $arg
     do_lib1 $arg
     do_lib2 $arg
