154 lines
3.8 KiB
Bash
Executable File
154 lines
3.8 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
# generate src/compat/* Makefile's based on SUBDIR values in
|
|
# the main source tree
|
|
|
|
srcdir=/usr/src
|
|
rwsrcdir=/home/current/src
|
|
MAKE=${MAKE-make}
|
|
|
|
CHECK_SUBDIRS="gnu/lib gnu/lib/libgcc4 lib lib/csu lib/i18n_module external/bsd/atf/lib external/bsd/openldap/lib lib/libpam/modules external/bsd/bind/lib external/bsd/iscsi crypto/external/bsd/openssl/lib crypto/external/bsd/netpgp crypto/external/bsd/openssh"
|
|
|
|
# lib/csu is spsecial
|
|
# lib/libm needs to be special -- i387
|
|
# gnu/lib/libsupc++ -- fails to get NOPROFILE properly
|
|
|
|
tmpdir=`mktemp -d /var/tmp/build-makefiles-$$.XXXXXX` || exit 1
|
|
|
|
write_if_new() {
|
|
_file="$1"
|
|
_new="$2"
|
|
}
|
|
|
|
for _dir in ${CHECK_SUBDIRS}; do
|
|
|
|
# set this to true if the needs to be no master subdir Makefile
|
|
_need_no_subdir=false
|
|
|
|
if [ ${_dir} = "lib/csu" ]; then
|
|
_subdirs="i386_elf sparc_elf"
|
|
_need_no_subdir=true
|
|
else
|
|
_subdirs=`cd ${srcdir}/${_dir}; ${MAKE} -V SUBDIR`
|
|
fi
|
|
|
|
echo "looking in: $_dir: subdirs $_subdirs"
|
|
for _sd in $_subdirs; do
|
|
# skip lib/csu --
|
|
if [ "$_dir" = "lib" -a "$_sd" = "csu" ]; then
|
|
continue
|
|
fi
|
|
|
|
# skip .WAIT --
|
|
if [ "$_sd" = ".WAIT" ]; then
|
|
continue
|
|
fi
|
|
|
|
# skip a bunch of non-lib subdirs --
|
|
case "$_dir" in
|
|
external/bsd/fetch | \
|
|
external/bsd/file | \
|
|
external/bsd/iscsi | \
|
|
external/bsd/libarchive | \
|
|
crypto/external/bsd/netpgp | \
|
|
crypto/external/bsd/openssh )
|
|
if [ "$_sd" != "lib" ]; then
|
|
continue;
|
|
fi
|
|
_need_no_subdir=true
|
|
esac
|
|
|
|
_libdplibs="`cd ${srcdir}/${_dir}/${_sd}; ${MAKE} -V LIBDPLIBS | sed 's,\({NETBSDSRCDIR}\),\1/compat,g'`"
|
|
echo "creating stuff for subdir: $_sd"
|
|
echo " - libdplibs = ${_libdplibs}"
|
|
mkdir -p ${rwsrcdir}/compat/${_dir}/${_sd}
|
|
(
|
|
echo -n '# $Net'
|
|
echo 'BSD$'
|
|
echo '# Generated from: $NetBSD: build-makefiles,v 1.8 2009/07/21 01:05:35 mrg Exp $' | sed -e 's/\$//g'
|
|
cat <<'EOF'
|
|
|
|
NOLINT= # defined
|
|
NOMAN= # defined
|
|
NONLS= # defined
|
|
NOINFO= # defined
|
|
NOSHARE= # defined
|
|
EOF
|
|
# XXX various hacks
|
|
case "${_sd}" in
|
|
libsupc++4)
|
|
echo "NOPROFILE= # defined"
|
|
;;
|
|
libc)
|
|
echo "# XXX"
|
|
echo "nsparser.h: nsparser.c"
|
|
;;
|
|
libpcap)
|
|
echo "# XXX"
|
|
echo "grammar.h: grammar.c"
|
|
;;
|
|
libipsec)
|
|
echo "# XXX"
|
|
echo "policy_parse.h: policy_parse.c"
|
|
;;
|
|
esac
|
|
|
|
if [ -n "${_libdplibs}" ]; then
|
|
echo "LIBDPLIBS= ${_libdplibs}"
|
|
fi
|
|
cat <<'EOF'
|
|
|
|
NOCHECKVER= # defined
|
|
|
|
.include <bsd.obj.mk>
|
|
|
|
# Resolve pathnames in variables.
|
|
_RESOLVE_VARS= CFLAGS CPPFLAGS DPADD LDADD LIBDPLIBS LIB_ROOT_DIR
|
|
.for var in ${_RESOLVE_VARS}
|
|
${var}:= ${${var}}
|
|
.endfor
|
|
|
|
.include <bsd.own.mk>
|
|
|
|
_CURDIR:= ${.CURDIR}
|
|
|
|
EOF
|
|
printf ".PATH: \${NETBSDSRCDIR}/${_dir}/${_sd}\n"
|
|
printf ".CURDIR:=\${NETBSDSRCDIR}/${_dir}/${_sd}\n\n"
|
|
cat <<'EOF'
|
|
.include "${NETBSDSRCDIR}/compat/Makefile.compat"
|
|
.include "${.CURDIR}/Makefile"
|
|
|
|
# Resolve pathnames from "real" Makefile, and switch .CURDIR back.
|
|
_RESOLVE_VARS= CFLAGS CPPFLAGS DPADD LDADD ARCHDIR COMPATDIR COMPATARCHDIR LIBCDIR RPC_INCS RPC_XDIR LIBEDITDIR MODOBJDIR RUMPTOP
|
|
.for var in ${_RESOLVE_VARS}
|
|
${var}:= ${${var}}
|
|
.endfor
|
|
|
|
.CURDIR:= ${_CURDIR}
|
|
.undef _CURDIR
|
|
EOF
|
|
) > ${rwsrcdir}/compat/${_dir}/${_sd}/Makefile
|
|
done
|
|
|
|
if [ "${_need_no_subdir}" != "true" ]; then
|
|
(printf '# $'NetBSD'$\n\n'
|
|
printf ".include <bsd.own.mk>\n\n"
|
|
printf "_CURDIR:= \${.CURDIR}\n\n"
|
|
printf ".CURDIR:=\${NETBSDSRCDIR}/${_dir}\n\n"
|
|
printf ".include "'"'"\${.CURDIR}/Makefile"'"'"\n\n"
|
|
printf ".CURDIR:= \${_CURDIR}\n"
|
|
) > ${rwsrcdir}/compat/${_dir}/Makefile
|
|
|
|
if [ -f "${srcdir}/${_dir}/Makefile.inc" ]; then
|
|
(printf '# $'NetBSD'$\n\n'
|
|
printf ".include <bsd.own.mk>\n\n"
|
|
printf "_CURDIR:= \${.CURDIR}\n\n"
|
|
printf ".include "'"'"\${NETBSDSRCDIR}/${_dir}/Makefile.inc"'"'"\n\n"
|
|
printf ".CURDIR:= \${_CURDIR}\n"
|
|
) > ${rwsrcdir}/compat/${_dir}/Makefile.inc
|
|
fi
|
|
fi
|
|
|
|
done
|