annotate make/aix/adlc_updater @ 10840:0dc4e30985d4

Merge
author fparain
date Fri, 08 Apr 2016 10:39:53 +0200
parents b83f7d608548
children
rev   line source
simonis@5966 1 #! /bin/sh
simonis@5966 2 #
simonis@5966 3 # This file is used by adlc.make to selectively update generated
simonis@5966 4 # adlc files. Because source and target diretories are relative
simonis@5966 5 # paths, this file is copied to the target build directory before
simonis@5966 6 # use.
simonis@5966 7 #
simonis@5966 8 # adlc-updater <file> <source-dir> <target-dir>
simonis@5966 9 #
simonis@5966 10 fix_lines() {
simonis@5966 11 # repair bare #line directives in $1 to refer to $2
erikj@10645 12 # and add an override of __FILE__ with just the basename on the
erikj@10645 13 # first line of the file.
erikj@10645 14 awk < $1 > $1+ -v F2=$2 '
erikj@10645 15 BEGIN { print "#line 1 \"" F2 "\""; }
simonis@5966 16 /^#line 999999$/ {print "#line " (NR+1) " \"" F2 "\""; next}
simonis@5966 17 {print}
erikj@10645 18 '
simonis@5966 19 mv $1+ $1
simonis@5966 20 }
erikj@10645 21 fix_lines $2/$1 $1
simonis@5966 22 [ -f $3/$1 ] && cmp -s $2/$1 $3/$1 || \
simonis@5966 23 ( [ -f $3/$1 ] && echo Updating $3/$1 ; touch $2/made-change ; mv $2/$1 $3/$1 )