btxld: Makefile fix and revert to use endian.h
[unleashed.git] / usr / src / tools / quick / make-gss
blob1957a99211d222566da1ba16dd34d84bb18410e4
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/sys -name '*.[ch]' -print |sort
150 find uts/common/net -name '*.[ch]' -print |sort
151 find uts/common/netinet -name '*.[ch]' -print |sort
152 find uts/common/gssapi -name '*.[ch]' -print |sort
153 find head -name '*.h' -print |sort
154 find lib/gss_mechs -name '*.[ch]' -print |sort
155 find cmd/gss -name '*.[ch]' -print |sort
156 ) > $SRC/cscope.files
158 (cd $SRC ;
159 exctags -e --langmap=c:+.ndl -h ndl -L - < cscope.files
160 cscope -b )
163 ################################################################
164 # This creates a tarfile one can use to update a test machine.
166 do_tar() {
167 git_rev=`git rev-parse --short=8 HEAD`
168 files="
169 usr/lib/gss/gssd
170 usr/lib/gss/mech_krb5.so.1
171 usr/lib/$arch64/gss/mech_krb5.so.1
172 usr/lib/gss/mech_spnego.so.1
173 usr/lib/$arch64/gss/mech_spnego.so.1
174 usr/lib/libgss.so.1
175 usr/lib/$arch64/libgss.so.1
178 (cd $ROOT && tar cfj ../../gss-${git_rev}.tar.bz2 $files)
181 ################################################################
183 if [ "$1" = "" ]; then
184 set '?' # force usage
187 set -x
189 for arg
191 case "$arg" in
192 build|install)
193 arg=install
194 build_tools
195 set -e
196 do_hdrs $arg
197 do_kern $arg
198 do_libs $arg
199 do_cmds $arg
201 lint)
202 do_kern $arg
203 do_libs $arg
204 do_cmds $arg
206 clean)
207 do_cmds $arg
208 do_libs $arg
209 do_kern $arg
211 clobber)
212 do_cmds $arg
213 do_libs $arg
214 do_kern $arg
215 do_hdrs $arg
216 clobber_tools
218 tags)
219 do_tags
221 tar)
222 do_tar
225 echo "Usage: $0 {build|lint|clean|clobber|tags|tar}";
226 exit 1;
228 esac
229 done