2014-01-05 11:55:43 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
src_dir="${0%/*}"
|
|
|
|
|
2014-01-05 12:27:35 -05:00
|
|
|
if [ -z "$CC" ]; then
|
|
|
|
if type -p gcc >/dev/null; then
|
|
|
|
CC=gcc
|
|
|
|
else
|
|
|
|
echo "warning: gcc not found; using CC=cc" >&2
|
|
|
|
CC=cc
|
|
|
|
fi
|
|
|
|
fi
|
2014-01-05 11:55:43 -05:00
|
|
|
|
2014-01-05 12:27:35 -05:00
|
|
|
if ! type -p "$CC" >/dev/null; then
|
|
|
|
echo "aborted: compiler not found: $CC" >&2
|
2014-01-05 11:55:43 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$(uname -s)" in
|
|
|
|
Darwin* )
|
|
|
|
host_os="darwin$(uname -r)"
|
|
|
|
;;
|
2016-08-08 16:24:07 -04:00
|
|
|
FreeBSD* )
|
|
|
|
host_os="freebsd$(uname -r)"
|
|
|
|
;;
|
2014-01-05 11:55:43 -05:00
|
|
|
OpenBSD* )
|
|
|
|
host_os="openbsd$(uname -r)"
|
|
|
|
;;
|
|
|
|
* )
|
|
|
|
host_os="linux-gnu"
|
|
|
|
esac
|
|
|
|
|
|
|
|
eval "$("$src_dir"/shobj-conf -C "$CC" -o "$host_os")"
|
|
|
|
|
|
|
|
sed "
|
2017-08-07 07:12:37 -04:00
|
|
|
s#@CC@#${CC}#
|
|
|
|
s#@CFLAGS@#${CFLAGS}#
|
|
|
|
s#@LOCAL_CFLAGS@#${LOCAL_CFLAGS}#
|
|
|
|
s#@DEFS@#${DEFS}#
|
|
|
|
s#@LOCAL_DEFS@#${LOCAL_DEFS}#
|
|
|
|
s#@SHOBJ_CC@#${SHOBJ_CC}#
|
|
|
|
s#@SHOBJ_CFLAGS@#${SHOBJ_CFLAGS}#
|
|
|
|
s#@SHOBJ_LD@#${SHOBJ_LD}#
|
|
|
|
s#@SHOBJ_LDFLAGS@#${SHOBJ_LDFLAGS}#
|
|
|
|
s#@SHOBJ_XLDFLAGS@#${SHOBJ_XLDFLAGS}#
|
|
|
|
s#@SHOBJ_LIBS@#${SHOBJ_LIBS}#
|
|
|
|
s#@SHOBJ_STATUS@#${SHOBJ_STATUS}#
|
2014-01-05 11:55:43 -05:00
|
|
|
" "$src_dir"/Makefile.in > "$src_dir"/Makefile
|