#! /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/openldap/lib" CHECK_SUBDIRS="lib/csu" # lib/csu is spsecial # lib/libm needs to be special -- i387 # gnu/lib/libsupc++ -- fails to get NOPROFILE properly for _dir in ${CHECK_SUBDIRS}; do if [ ${_dir} = "lib/csu" ]; then _subdirs="i386_elf sparc_elf" 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 echo "creating stuff for subdir: $_sd" mkdir -p ${rwsrcdir}/compat/${_dir}/${_sd} ( cat <<'EOF' # $NetBSD: build-makefiles,v 1.1 2008/10/26 07:38:28 mrg Exp $ NOLINT= # defined NOMAN= # defined NONLS= # defined NOINFO= # defined NOSHARE= # defined EOF if [ "${_sd}" = "libsupc++4" ]; then echo "NOPROFILE= # defined" fi cat <<'EOF' NOCHECKVER= # defined # XXX .if ${MACHINE_ARCH} == "sparc64" ARCHSUBDIR= sparc COMMON_ARCHSUBDIR= sparc .elif ${MACHINE_ARCH} == "sparc64" ARCHSUBDIR= i386 COMMON_ARCHSUBDIR= i386 .endif .include # Resolve pathnames in variables. _RESOLVE_VARS= CFLAGS CPPFLAGS DPADD LDADD .for var in ${_RESOLVE_VARS} ${var}:= ${${var}} .endfor _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 (printf '# $'NetBSD'$\n\n' #printf ".include \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 "_CURDIR:= \${.CURDIR}\n\n" printf ".include "'"'"\${NETBSDSRCDIR}/${_dir}/Makefile.inc"'"'"\n\n" printf ".CURDIR:= \${_CURDIR}\n" ) > ${rwsrcdir}/compat/${_dir}/Makefile.inc fi done