From: Theodore Ts'o Date: Fri, 6 May 2005 13:42:34 +0000 (-0400) Subject: If the .c and .h file already exist, and they have not changed, use the X-Git-Tag: E2FSPROGS-1_38-WIP-0509~15 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=153b4495c1bdf38e84f75986563dbae336000fad;p=tools%2Fe2fsprogs.git If the .c and .h file already exist, and they have not changed, use the original versions of the files, so as to avoid rebuilding files when not necessary. Also fixes a potential SMP/Parallel build problem when one make process runs compile_et to generate the .h file, and a partially generated .c file is compiled by another make process. (Addresses Sourceforge Bug: #1157933) --- diff --git a/lib/et/compile_et.sh.in b/lib/et/compile_et.sh.in index e41b51b..27bb3cd 100644 --- a/lib/et/compile_et.sh.in +++ b/lib/et/compile_et.sh.in @@ -32,5 +32,15 @@ if test ! -f "$ROOT.et" ; then exit 1; fi -$AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h" "$ROOT.et" -$AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c" "$ROOT.et" +$AWK -f "${DIR}/et_h.awk" "outfile=${BASE}.h.$$" "outfn=${BASE}.h" "$ROOT.et" +if test -f ${BASE}.h && cmp -s ${BASE}.h.$$ ${BASE}.h ; then + rm ${BASE}.h.$$ +else + mv ${BASE}.h.$$ ${BASE}.h +fi +$AWK -f "${DIR}/et_c.awk" "outfile=${BASE}.c.$$" "outfn=${BASE}.c" "$ROOT.et" +if test -f ${BASE}.c && cmp -s ${BASE}.c.$$ ${BASE}.c ; then + rm ${BASE}.c.$$ +else + mv ${BASE}.c.$$ ${BASE}.c +fi diff --git a/lib/et/et_c.awk b/lib/et/et_c.awk index ab0079f..1769b79 100644 --- a/lib/et/et_c.awk +++ b/lib/et/et_c.awk @@ -1,4 +1,7 @@ BEGIN { +if ( length(outfn) == 0) { + outfn = outfile +} char_shift=64 ## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; c2n["A"]=1 @@ -119,7 +122,7 @@ c2n["_"]=63 } } print "/*" > outfile - print " * " outfile ":" > outfile + print " * " outfn ":" > outfile print " * This file is automatically generated; please do not edit it." > outfile print " */" > outfile diff --git a/lib/et/et_h.awk b/lib/et/et_h.awk index 73caffc..8337121 100644 --- a/lib/et/et_h.awk +++ b/lib/et/et_h.awk @@ -1,4 +1,7 @@ BEGIN { +if ( length(outfn) == 0) { + outfn = outfile +} char_shift=64 ## "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"; c2n["A"]=1 @@ -123,7 +126,7 @@ c2n["_"]=63 curr_high = tab_base_high curr_sign = tab_base_sign print "/*" > outfile - print " * " outfile ":" > outfile + print " * " outfn ":" > outfile print " * This file is automatically generated; please do not edit it." > outfile print " */" > outfile print "" > outfile