dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / tools / quick / make-smbsrv
blob0a17372fcfe89b57720652797376fcdd855982b4
1 #!/bin/ksh
3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
6 # 1.0 of the CDDL.
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2014 Nexenta Systems, Inc. All rights reserved.
17 # Use distributed make (dmake) by default.
18 make=${MAKE:-dmake}
20 CLOSED_IS_PRESENT=no
21 export CLOSED_IS_PRESENT
23 # Do this if you want to use dbx or gdb
24 # export SOURCEDEBUG=yes
26 [ -n "$SRC" ] || {
27 echo "SRC not set. Run 'ws' or 'bldenv' first."
28 exit 1
31 cpu=`uname -p`
32 case $cpu in
33 i386)
34 x=intel
35 mdb_arch="ia32 amd64"
36 arch64=amd64
38 sparc)
39 x=sparc
40 mdb_arch=v9
41 arch64=sparcv9
43 *) echo "Huh?" ; exit 1;;
44 esac
46 ################################################################
48 build_tools() {
49 test -f $SRC/tools/proto/root_i386-nd/opt/onbld/bin/genoffsets ||
50 (cd $SRC/tools && $make install)
51 (cd $SRC/common/mapfiles; $make install)
54 clobber_tools() {
55 (cd $SRC/tools && $make clobber)
56 (cd $SRC/common/mapfiles; $make clobber)
59 ################################################################
61 do_hdrs() {
63 targ=$1
64 if [ "$targ" = clobber ]
65 then
66 (cd $SRC/uts && $make -k clobber_h)
67 (cd $SRC/head && $make clobber)
70 if [ "$targ" = install ]
71 then
72 targ=install_h
74 # Just the parts of "make sgs" we need, and
75 # skip them if they appear to be done.
76 # ... stuff under $SRC
77 test -f $SRC/uts/common/sys/priv_names.h ||
78 (cd $SRC/uts && $make -k all_h)
80 test -f $SRC/head/rpcsvc/nispasswd.h ||
81 (cd $SRC/head && $make -k install_h)
83 # ... stuff under $ROOT (proto area)
84 test -d $ROOT/usr/include/sys ||
85 (cd $SRC && $make rootdirs)
86 test -f $ROOT/usr/include/sys/types.h ||
87 (cd $SRC/uts && $make -k install_h)
88 test -f $ROOT/usr/include/rpcsvc/daemon_utils.h ||
89 (cd $SRC/head && $make install_h)
91 # always update the smbsrv headers to be safe
92 (cd $SRC/uts/common/gssapi && $make -k install_h)
93 (cd $SRC/uts/common/sys && $make -k install_h)
94 (cd $SRC/uts/common/smb && $make -k install_h)
95 (cd $SRC/uts/common/smbsrv && $make -k install_h)
99 # Need some library headers too...
100 for lib in \
101 libads \
102 libbsm \
103 libcmdutils \
104 libcryptoutil \
105 libdevid \
106 libgss \
107 libkrb5 \
108 libidmap \
109 libpam \
110 libsec \
111 libscf \
112 libshare \
113 libsmbfs \
114 libsqlite \
115 libuutil \
116 passwdutil \
117 smbsrv
119 (cd $SRC/lib/$lib && $make $targ)
120 done
123 ################################################################
125 do_kern() {
126 case $1 in
127 lint) targ=modlintlib ;;
128 *) targ=$1 ;;
129 esac
130 ( unset SOURCEDEBUG ;
131 (cd $SRC/uts/$x/nsmb && $make $targ) ;
132 (cd $SRC/uts/$x/smbfs && $make $targ) ;
133 (cd $SRC/uts/$x/smbsrv && $make $targ) )
136 ################################################################
138 # Note lib1 builds prerequisite libraries not delivered by the
139 # tar file we create below. To accelerate clean/install, we
140 # skip these on clean (but still nuke them for clobber)
142 do_lib1() {
144 for lib in \
145 libavl \
146 libgss \
147 libkrb5 \
148 libcmdutils \
149 libsqlite \
150 libuutil
152 (cd $SRC/lib/$lib && $make $1)
153 done
156 # lib2 builds stuff we include in the tar file,
157 # or that we don't mind rebuilding after clean.
159 do_lib2() {
161 for lib in \
162 libads \
163 libsmbfs
165 (cd $SRC/lib/$lib && $make $1)
166 done
168 (cd $SRC/lib/libshare && $make $1 PLUGINS=smb)
169 (cd $SRC/lib/smbsrv && $make $1)
170 (cd $SRC/lib/passwdutil && $make $1)
171 (cd $SRC/lib/pam_modules/smb && $make $1)
175 ################################################################
177 do_cmds() {
179 case $1 in
180 install)
181 # mount programs need fslib.o
182 (cd $SRC/cmd/fs.d && $make fslib.o)
183 (cd $SRC/cmd/fs.d/smbclnt && $make $1 catalog)
185 clean|clobber)
186 (cd $SRC/cmd/fs.d/smbclnt && $make $1)
187 (cd $SRC/cmd/fs.d && $make ${1}_local)
189 esac
191 (cd $SRC/cmd/devfsadm && $make $1)
192 (cd $SRC/cmd/smbsrv && $make $1)
194 # Build the MDB modules, WITH the linktest
195 (cd $SRC/cmd/mdb/tools && $make $1)
196 for a in $mdb_arch
198 case $1 in
199 install|lint)
200 (cd $SRC/cmd/mdb/$x/$a/kmdb &&
201 $make kmdb_modlinktest.o )
203 clean|clobber)
204 (cd $SRC/cmd/mdb/$x/$a/kmdb &&
205 $make -k $1 )
207 esac
209 (cd $SRC/cmd/mdb/$x/$a/nsmb &&
210 $make $1 KMDB_LINKTEST_ENABLE= )
211 (cd $SRC/cmd/mdb/$x/$a/smbfs &&
212 $make $1 KMDB_LINKTEST_ENABLE= )
213 (cd $SRC/cmd/mdb/$x/$a/smbsrv &&
214 $make $1 KMDB_LINKTEST_ENABLE= )
216 # We build these libraries (to the proto area), so we need to
217 # build the mdb modules too so mdb will load them.
218 (cd $SRC/cmd/mdb/$x/$a/libcmdutils &&
219 $make $1 )
220 (cd $SRC/cmd/mdb/$x/$a/libavl &&
221 $make $1 )
223 done
225 (cd $SRC/cmd/Adm/sun && $make $1)
227 # Deal with mode 0400 file annoyance...
228 # See usr/src/cmd/Adm/sun/Makefile
229 if [ $1 = install ]; then
230 chmod a+r $ROOT/var/smb/smbpasswd
235 ################################################################
236 # This builds $SRC/TAGS (and cscope.files) in a helpful order.
238 do_tags() {
239 (cd $SRC ;
240 find uts/common/smb -name '*.[ch]' -print |sort
241 find uts/common/smbsrv -name '*.ndl' -print |sort
242 find uts/common/smbsrv -name '*.[ch]' -print |sort
243 find uts/common/fs/smbsrv -name '*.[ch]' -print |sort
244 find uts/common/gssapi -name '*.[ch]' -print |sort
245 find .../../include -name '*.h' -print |sort
246 find lib/smbsrv -name '*.[ch]' -print |sort
247 find lib/libsmbfs -name '*.[ch]' -print |sort
248 find lib/libads -name '*.[ch]' -print |sort
249 find lib/libgss -name '*.[ch]' -print |sort
250 find cmd/smbsrv -name '*.[ch]' -print |sort
251 find common/smbsrv -name '*.[ch]' -print |sort
252 ) > $SRC/cscope.files
254 (cd $SRC ;
255 exctags -e --langmap=c:+.ndl -h ndl -L - < cscope.files
256 cscope -b )
259 ################################################################
260 # This creates a tarfile one can use to update a test machine.
262 do_tar() {
263 git_rev=`git rev-parse --short=8 HEAD`
264 files="
265 lib/svc/manifest/network/smb/server.xml
266 usr/kernel/drv/$arch64/smbsrv
267 usr/kernel/drv/smbsrv
268 usr/kernel/kmdb/$arch64/smbsrv
269 usr/kernel/kmdb/smbsrv
270 usr/lib/fs/smb/$arch64/libshare_smb.so.1
271 usr/lib/fs/smb/libshare_smb.so.1
272 usr/lib/libsmbfs.so.1
273 usr/lib/mdb/kvm/$arch64/smbsrv.so
274 usr/lib/mdb/kvm/smbsrv.so
275 usr/lib/reparse/libreparse_smb.so.1
276 usr/lib/security/pam_smb_passwd.so.1
277 usr/lib/smbsrv/dtrace
278 usr/lib/smbsrv/libmlrpc.so.1
279 usr/lib/smbsrv/libmlsvc.so.1
280 usr/lib/smbsrv/libsmb.so.1
281 usr/lib/smbsrv/libsmbns.so.1
282 usr/lib/smbsrv/smbd
283 usr/sbin/devfsadm
284 usr/sbin/smbadm
285 usr/sbin/smbstat
288 (cd $ROOT && tar cfj ../../smbsrv-${git_rev}.tar.bz2 $files)
291 ################################################################
293 if [ "$1" = "" ]; then
294 set '?' # force usage
297 set -x
299 for arg
301 case "$arg" in
302 install)
303 build_tools
304 set -e
305 do_hdrs $arg
306 do_kern $arg
307 do_lib1 $arg
308 do_lib2 $arg
309 do_cmds $arg
311 lint)
312 do_kern $arg
313 do_lib1 $arg
314 do_lib2 $arg
315 do_cmds $arg
317 clean)
318 # intentionally skip: lib1, hdrs, tools
319 do_cmds $arg
320 do_lib2 $arg
321 do_kern $arg
323 clobber)
324 do_cmds $arg
325 do_lib2 $arg
326 do_lib1 $arg
327 do_kern $arg
328 do_hdrs $arg
329 clobber_tools
331 tags)
332 do_tags
334 tar)
335 do_tar
338 echo "Usage: $0 {install|lint|clean|clobber|tags|tar}";
339 exit 1;
341 esac
342 done