2 #@ Out-of-tree compilation support, à la
3 #@ $ cd /tmp && mkdir build && cd build &&
4 #@ ~/src/nail.git/make-emerge.sh && make tangerine DESTDIR=.ddir
8 ## Upon interest see mk/make-config.sh, the source of all this!
10 # For heaven's sake auto-redirect on SunOS/Solaris
11 if [ -z "${__MAKE_EMERGE_UP}" ] && [ -d /usr
/xpg4
]; then
13 PATH
=/usr
/xpg
4/bin
:${PATH}
14 SHELL
=/usr
/xpg
4/bin
/sh
15 export __MAKE_EMERGE_UP PATH SHELL
16 echo >&2 'SunOS/Solaris, redirecting through $SHELL=/usr/xpg4/bin/sh'
17 exec /usr
/xpg
4/bin
/sh
"${0}" "${@}"
21 if [ ${#} -gt 0 ]; then
22 echo >&2 "ERROR: ${*}"
25 echo >&2 'Synopsis: SOURCEDIR/make-emerge.sh [from within target directory]'
30 </dev
/null
${awk} -v X
="${1}" '
34 X = substr(X, 1, RSTART - 1)
41 [ ${#} -eq 0 ] || syno
43 SU_FIND_COMMAND_INCLUSION
= .
${0%/*}/mk
/su-find-command.sh
44 thecmd_testandset_fail
awk awk
45 thecmd_testandset_fail
cp cp
46 thecmd_testandset_fail
dirname dirname
47 thecmd_testandset_fail mkdir mkdir
48 thecmd_testandset_fail
pwd pwd
50 topdir
=`${dirname} ${0}`
51 if [ "${topdir}" = .
]; then
52 msg
'This is not out of tree?!'
55 topdir
=`cd ${topdir}; oneslash "\`${pwd}\
`"`
56 blddir
=`oneslash "\`${pwd}\
`"`
57 echo 'Initializing out-of-tree build.'
58 echo 'Source directory: '"${topdir}"
59 echo 'Build directory : '"${blddir}"
62 ${mkdir} -p include
/mx
63 ${cp} "${topdir}"mx-config.h .
/
64 ${awk} -v topdir="${topdir}" -v blddir="${blddir}" '
65 /^CWDDIR=.*$/{ print "CWDDIR
=" blddir; next}
66 /^TOPDIR=.*$/{ print "TOPDIR
=" topdir; next}
67 /^OBJDIR=.*$/{ print "OBJDIR
=" blddir ".obj
"; next}
69 ' < "${topdir}"makefile > ./makefile
70 ${cp} "${topdir}"make.rc "${topdir}"mime.types .
/
71 ${cp} "${topdir}"include
/mx
/gen-version.h include
/mx
/
74 echo 'You should now be able to proceed as normal (e.g., "$ make all")'