1#!/bin/sh 2PATH=/bin:/usr/bin 3export PATH 4 5script_name=`basename $0` 6script_dir=`dirname $0` 7script_dir=`(cd "${script_dir}" ; pwd)` 8. ${script_dir}/../common.sh 9 10top_srcdir=`(cd "$script_dir/../../.." && pwd)` 11build_root=$1 12builddir=$build_root/build 13output=$2 14 15inum() { 16 ls -i $1 2>/dev/null | cut -d' ' -f1 17} 18 19different_file() { 20 # echo "different_file $@" >&2 21 if [ "`inum $1`" = "`inum $2`" ]; then 22 # be paranoid, as device numbers may somehow differ... 23 if cmp -s $1 $2; then 24 return 1 25 else 26 return 0 27 fi 28 else 29 return 0 30 fi 31} 32 33case $output in 34 /*) ;; 35 *) output=`pwd`/$output ;; 36esac 37 38ohead=`dirname $output` 39otail=`basename $output` 40 41[ -d $ohead ] || mkdir -p $ohead 42[ -f $output ] || touch -t 197607040000 $output 43 44while different_file $builddir/$otail $output; do 45 case "$ohead" in [./]) break ;; esac 46 otail=`basename $ohead`/$otail 47 ohead=`dirname $ohead` 48done 49 50if different_file $builddir/$otail $output; then 51 fmt >&2 <<EOF 52$script_name: Ignoring $output, which seems not to belong to the build 53tree rooted at $builddir. 54EOF 55 exit 0 56fi 57 58case $otail in 59 */* | Makefile ) 60 CONFIG_FILES=$builddir/$otail:./src/$otail.in 61 ;; 62 * ) 63 CONFIG_FILES=$builddir/$otail:./src/build-system/$otail.in 64 ;; 65esac 66 67cd $top_srcdir 68CONFIG_HEADERS= 69CONFIG_LINKS= 70CONFIG_COMMANDS= 71export CONFIG_FILES CONFIG_HEADERS CONFIG_LINKS CONFIG_COMMANDS 72$build_root/status/config.status 73status=$? 74 75case $output in 76 */Makefile.mk) 77 scripts/common/impl/supplement_makefile_mk.sh . "$builddir" 78 ;; 79 80 *.sh | *.py ) 81 chmod +x $output 82 ;; 83 84 *.[ch] | *.[ch]pp) 85 if cmp -s $output $output.last; then 86 echo $output is unchanged. 87 touch -r $output.last $output 88 else 89 cp -p $output $output.last 90 fi 91 ;; 92esac 93 94exit $status 95