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
7 ## Upon interest see mk/make-config.sh, the source of all this!
9 # For heaven's sake auto-redirect on SunOS/Solaris
10 if [ -z "${__MAKE_EMERGE_UP}" ] && [ -d /usr
/xpg4
]; then
12 PATH
=/usr
/xpg
4/bin
:${PATH}
13 SHELL
=/usr
/xpg
4/bin
/sh
14 export __MAKE_EMERGE_UP PATH SHELL
15 echo >&2 'SunOS/Solaris, redirecting through $SHELL=/usr/xpg4/bin/sh'
16 exec /usr
/xpg
4/bin
/sh
"${0}" "${@}"
24 if [ ${#} -gt 0 ]; then
25 echo >&2 "ERROR: ${*}"
28 echo >&2 'Synopsis: SOURCEDIR/make-emerge.sh [from within target directory]'
33 </dev
/null
${awk} -v X
="${1}" '
37 X = substr(X, 1, RSTART - 1)
44 [ ${#} -eq 0 ] || syno
46 SU_FIND_COMMAND_INCLUSION
=1 .
${0%/*}/mk
/su-find-command.sh
48 thecmd_testandset_fail
awk awk
49 thecmd_testandset_fail
cp cp
50 thecmd_testandset_fail
dirname dirname
51 thecmd_testandset_fail mkdir mkdir
52 thecmd_testandset_fail
pwd pwd
54 topdir
=`${dirname} ${0}`
55 if [ "${topdir}" = .
]; then
56 msg
'This is not out of tree?!'
59 topdir
=`cd ${topdir}; oneslash "\`${pwd}\
`"`
60 blddir
=`oneslash "\`${pwd}\
`"`
61 echo 'Initializing out-of-tree build.'
62 echo 'Source directory: '"${topdir}"
63 echo 'Build directory : '"${blddir}"
66 ${mkdir} -p include
/mx
67 ${cp} "${topdir}"mx-config.h .
/
68 ${awk} -v topdir="${topdir}" -v blddir="${blddir}" '
69 /^CWDDIR=.*$/{ print "CWDDIR
=" blddir; next}
70 /^TOPDIR=.*$/{ print "TOPDIR
=" topdir; next}
71 /^OBJDIR=.*$/{ print "OBJDIR
=" blddir ".obj
"; next}
73 ' < "${topdir}"makefile > ./makefile
74 ${cp} "${topdir}"make.rc ./
75 ${cp} "${topdir}"mime.types ./
76 ${cp} "${topdir}"include/mx/gen-version.h include/mx/
79 echo 'You should now be able to proceed as normal (e.g., "$
make all
")'