c_addrcodec(): fix: check parsed result is an email address
[s-mailx.git] / make-emerge.sh
blob22f4134baadb06447a7b870b4c703ca431d4a83f
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
6 # Public Domain
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
12 __MAKE_EMERGE_UP=y
13 PATH=/usr/xpg4/bin:${PATH}
14 SHELL=/usr/xpg4/bin/sh
15 export __MAKE_EMERGE_UP PATH SHELL
16 echo >&2 'SunOS/Solaris, redirecting through $SHELL=/usr/xpg4/bin/sh'
17 exec /usr/xpg4/bin/sh "${0}" "${@}"
20 syno() {
21 if [ ${#} -gt 0 ]; then
22 echo >&2 "ERROR: ${*}"
23 echo >&2
25 echo >&2 'Synopsis: SOURCEDIR/make-emerge.sh [from within target directory]'
26 exit 1
29 oneslash() {
30 </dev/null ${awk} -v X="${1}" '
31 BEGIN{
32 i = match(X, "/+$")
33 if(RSTART != 0)
34 X = substr(X, 1, RSTART - 1)
35 X = X "/"
36 print X
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?!'
53 exit
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}"
61 set -e
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}
68 {print}
69 ' < "${topdir}"makefile > ./makefile
70 ${cp} "${topdir}"make.rc "${topdir}"mime.types ./
71 ${cp} "${topdir}"include/mx/gen-version.h include/mx/
72 set +e
74 echo 'You should now be able to proceed as normal (e.g., "$ make all")'
76 # s-sh-mode