dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / tools / quick / make-idmap
blob12e037ba13a2e23aef4c2a14eb23e772225b1e58
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 and smbsrv headers (we need to build libsmb)
92 (cd $SRC/uts/common/sys && $make -k install_h)
93 (cd $SRC/uts/common/smb && $make -k install_h)
94 (cd $SRC/uts/common/smbsrv && $make -k install_h)
98 # Need some library headers too...
99 for lib in \
100 libads \
101 libbsm \
102 libcmdutils \
103 libcryptoutil \
104 libdevid \
105 libgss \
106 libkrb5 \
107 libldap5 \
108 libidmap \
109 libsmbfs \
110 libsqlite \
111 libuutil
113 (cd $SRC/lib/$lib && $make $targ)
114 done
117 ################################################################
119 do_kern() {
120 case $1 in
121 lint) targ=modlintlib ;;
122 *) targ=$1 ;;
123 esac
124 ( unset SOURCEDEBUG ;
125 (cd $SRC/uts/$x/idmap && $make $targ) )
128 ################################################################
130 do_libs() {
132 for lib in \
133 libavl \
134 libcmdutils \
135 libldap5 \
136 libadutils \
137 libuutil \
138 libidmap \
139 libads \
140 libsmbfs \
141 libsqlite \
142 nsswitch/ad
144 (cd $SRC/lib/$lib && $make $1)
145 done
147 # need libsmb for cmd/idmap/idmapd (and libsmbfs for libsmb)
148 (cd $SRC/lib/smbsrv/libsmb && $make $1)
152 ################################################################
154 do_cmds() {
156 (cd $SRC/cmd/idmap && $make $1)
161 ################################################################
162 # This builds $SRC/TAGS (and cscope.files) in a helpful order.
164 do_tags() {
165 (cd $SRC ;
166 find uts/common/rpcsvc -name '*.[ch]' -print |sort
167 find uts/common/idmap -name '*.[ch]' -print |sort
168 find ../../include -name '*.h' -print |sort
169 find lib/libidmap -name '*.[ch]' -print |sort
170 find lib/libadutils -name '*.[ch]' -print |sort
171 find lib/libldap5 -name '*.[ch]' -print |sort
172 find cmd/idmap -name '*.[ch]' -print |sort
173 ) > $SRC/cscope.files
175 (cd $SRC ;
176 exctags -e --langmap=c:+.ndl -h ndl -L - < cscope.files
177 cscope -b )
180 ################################################################
181 # This creates a tarfile one can use to update a test machine.
183 do_tar() {
184 git_rev=`git rev-parse --short=8 HEAD`
185 files="
186 lib/svc/manifest/system/idmap.xml
187 usr/lib/idmapd
188 usr/lib/libads.so.1
189 usr/lib/$arch64/libads.so.1
190 usr/lib/libadutils.so.1
191 usr/lib/$arch64/libadutils.so.1
192 usr/lib/libidmap.so.1
193 usr/lib/$arch64/libidmap.so.1
194 usr/lib/libldap.so.5
195 usr/lib/$arch64/libldap.so.5
196 usr/lib/nss_ad.so.1
197 usr/lib/$arch64/nss_ad.so.1
198 usr/bin/test-getdc
199 usr/sbin/idmap
200 usr/sbin/nltest
203 (cd $ROOT && tar cfj ../../idmap-${git_rev}.tar.bz2 $files)
206 ################################################################
208 if [ "$1" = "" ]; then
209 set '?' # force usage
212 set -x
214 for arg
216 case "$arg" in
217 build|install)
218 arg=install
219 build_tools
220 set -e
221 do_hdrs $arg
222 do_kern $arg
223 do_libs $arg
224 do_cmds $arg
226 lint)
227 do_kern $arg
228 do_libs $arg
229 do_cmds $arg
231 clean)
232 do_cmds $arg
233 do_libs $arg
234 do_kern $arg
236 clobber)
237 do_cmds $arg
238 do_libs $arg
239 do_kern $arg
240 do_hdrs $arg
241 clobber_tools
243 tags)
244 do_tags
246 tar)
247 do_tar
250 echo "Usage: $0 {build|lint|clean|clobber|tags|tar}";
251 exit 1;
253 esac
254 done