Merge commit '80d5689f5d4588adc071138e25e9d0d5252d9b55'
[unleashed.git] / usr / src / tools / quick / make-gss
blob868f3c991e3b3c84300d99da0f33d5903d8ebd13
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 # system headers
92 (cd $SRC/uts/common/sys && $make -k install_h)
96 # Need some library headers too...
97 for lib in \
98 libgss \
99 libkrb5
101 (cd $SRC/lib/$lib && $make $targ)
102 done
105 ################################################################
107 do_kern() {
108 case $1 in
109 lint) targ=modlintlib ;;
110 *) targ=$1 ;;
111 esac
112 ( unset SOURCEDEBUG ;
113 (cd $SRC/uts/$x/kgssapi && $make $targ) )
116 ################################################################
118 do_libs() {
120 for lib in \
121 libgss
123 (cd $SRC/lib/$lib && $make $1)
124 done
126 # For some reason, mech_krb5 does not build for debug.
127 # It also takes forever to lint. skip that.
128 if [ "$1" != "lint" ]; then
129 (cd $SRC/lib/gss_mechs/mech_krb5 && unset SOURCEDEBUG && $make $1)
130 (cd $SRC/lib/gss_mechs/mech_spnego && $make $1)
135 ################################################################
137 do_cmds() {
139 (cd $SRC/cmd/gss && $make $1)
144 ################################################################
145 # This builds $SRC/TAGS (and cscope.files) in a helpful order.
147 do_tags() {
148 (cd $SRC ;
149 find uts/common/gssapi -name '*.[ch]' -print |sort
150 find ../../include -name '*.h' -print |sort
151 find lib/gss_mechs -name '*.[ch]' -print |sort
152 find cmd/gss -name '*.[ch]' -print |sort
153 ) > $SRC/cscope.files
155 (cd $SRC ;
156 exctags -e --langmap=c:+.ndl -h ndl -L - < cscope.files
157 cscope -b )
160 ################################################################
161 # This creates a tarfile one can use to update a test machine.
163 do_tar() {
164 git_rev=`git rev-parse --short=8 HEAD`
165 files="
166 usr/lib/gss/gssd
167 usr/lib/gss/mech_krb5.so.1
168 usr/lib/$arch64/gss/mech_krb5.so.1
169 usr/lib/gss/mech_spnego.so.1
170 usr/lib/$arch64/gss/mech_spnego.so.1
171 usr/lib/libgss.so.1
172 usr/lib/$arch64/libgss.so.1
175 (cd $ROOT && tar cfj ../../gss-${git_rev}.tar.bz2 $files)
178 ################################################################
180 if [ "$1" = "" ]; then
181 set '?' # force usage
184 set -x
186 for arg
188 case "$arg" in
189 build|install)
190 arg=install
191 build_tools
192 set -e
193 do_hdrs $arg
194 do_kern $arg
195 do_libs $arg
196 do_cmds $arg
198 lint)
199 do_kern $arg
200 do_libs $arg
201 do_cmds $arg
203 clean)
204 do_cmds $arg
205 do_libs $arg
206 do_kern $arg
208 clobber)
209 do_cmds $arg
210 do_libs $arg
211 do_kern $arg
212 do_hdrs $arg
213 clobber_tools
215 tags)
216 do_tags
218 tar)
219 do_tar
222 echo "Usage: $0 {build|lint|clean|clobber|tags|tar}";
223 exit 1;
225 esac
226 done