diff --git a/contrib/gana-update.sh b/contrib/gana-update.sh index 8fcf18852..db122b9a3 100755 --- a/contrib/gana-update.sh +++ b/contrib/gana-update.sh @@ -3,32 +3,32 @@ # Run from exchange/ main directory. set -eu -# Generate taler-error-codes.h in gana and copy it to -# src/include/taler_error_codes.h -cd contrib/gana/gnu-taler-error-codes -make -cd ../../.. -for n in taler_error_codes.c -do - if ! diff contrib/gana/gnu-taler-error-codes/${n} src/util/${n} > /dev/null +domake () +{ + # $1 -- dir under contrib/gana/ + dir="contrib/gana/$1" + + make -C $dir +} + +ensure () +{ + # $1 -- filename + # $2 -- src dir under contrib/gana/ + # $3 -- dst dir under ./ + fn="$1" + src="contrib/gana/$2" + dst="./$3" + + if ! diff $src/$fn $dst/$fn > /dev/null then - cp contrib/gana/gnu-taler-error-codes/$n src/util/$n + cp $src/$fn $dst/$fn fi -done -for n in taler_error_codes.h -do - if ! diff contrib/gana/gnu-taler-error-codes/${n} src/include/${n} > /dev/null - then - cp contrib/gana/gnu-taler-error-codes/$n src/include/$n - fi -done -cd contrib/gana/gnu-taler-db-events -make -cd ../../.. -for n in taler_dbevents.h -do - if ! diff contrib/gana/gnu-taler-db-events/${n} src/include/${n} > /dev/null - then - cp contrib/gana/gnu-taler-db-events/$n src/include/$n - fi -done +} + +domake gnu-taler-error-codes +ensure taler_error_codes.c gnu-taler-error-codes src/util +ensure taler_error_codes.h gnu-taler-error-codes src/include + +domake gnu-taler-db-events +ensure taler_dbevents.h gnu-taler-db-events src/include