adlc_updater revision 1751
119N/A#! /bin/sh
119N/A#
119N/A# This file is used by adlc.make to selectively update generated
119N/A# adlc files. Because source and target diretories are relative
119N/A# paths, this file is copied to the target build directory before
119N/A# use.
119N/A#
119N/A# adlc-updater <file> <source-dir> <target-dir>
119N/A#
119N/Afix_lines() {
119N/A # repair bare #line directives in $1 to refer to $2
119N/A awk < $1 > $1+ '
119N/A /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next}
119N/A {print}
119N/A ' F2=$2
119N/A mv $1+ $1
119N/A}
119N/Afix_lines $2/$1 $3/$1
119N/A[ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \
119N/A( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 )
119N/A