summaryrefslogtreecommitdiff
path: root/lib/et
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2005-05-06 09:42:34 -0400
committerTheodore Ts'o <tytso@mit.edu>2005-05-06 09:42:34 -0400
commit153b4495c1bdf38e84f75986563dbae336000fad (patch)
tree805456dd4d9b4c6e3ffd943f1666c9b500fcd132 /lib/et
parent75e93ab0975f042edc25dde6f5d9496360207a94 (diff)
downloade2fsprogs-153b4495c1bdf38e84f75986563dbae336000fad.tar.gz
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)
Diffstat (limited to 'lib/et')
-rw-r--r--lib/et/compile_et.sh.in14
-rw-r--r--lib/et/et_c.awk5
-rw-r--r--lib/et/et_h.awk5
3 files changed, 20 insertions, 4 deletions
diff --git a/lib/et/compile_et.sh.in b/lib/et/compile_et.sh.in
index e41b51b9..27bb3cdb 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 ab0079f0..1769b79a 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 73caffc0..8337121a 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