*asksend*: indicate that envelope is pre-refinement (Geoff Clare)
[s-mailx.git] / make-emerge.sh
blob0299984eab4409d1418c68cf791facdb89f09c58
1 #!/bin/sh -
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
5 # Public Domain
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
11 __MAKE_EMERGE_UP=y
12 PATH=/usr/xpg4/bin:${PATH}
13 SHELL=/usr/xpg4/bin/sh
14 export __MAKE_EMERGE_UP PATH SHELL
15 echo >&2 'SunOS/Solaris, redirecting through $SHELL=/usr/xpg4/bin/sh'
16 exec /usr/xpg4/bin/sh "${0}" "${@}"
19 config_exit() {
20 exit ${1}
23 syno() {
24 if [ ${#} -gt 0 ]; then
25 echo >&2 "ERROR: ${*}"
26 echo >&2
28 echo >&2 'Synopsis: SOURCEDIR/make-emerge.sh [from within target directory]'
29 exit 1
32 oneslash() {
33 </dev/null ${awk} -v X="${1}" '
34 BEGIN{
35 i = match(X, "/+$")
36 if(RSTART != 0)
37 X = substr(X, 1, RSTART - 1)
38 X = X "/"
39 print X
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?!'
57 config_exit 1
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}"
65 set -e
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}
72 {print}
73 ' < "${topdir}"makefile > ./makefile
74 ${cp} "${topdir}"make.rc ./
75 ${cp} "${topdir}"mime.types ./
76 ${cp} "${topdir}"include/mx/gen-version.h include/mx/
77 set +e
79 echo 'You should now be able to proceed as normal (e.g., "$ make all")'
81 # s-sh-mode