Whamcloud - gitweb
If the .c and .h file already exist, and they have not changed, use the
authorTheodore Ts'o <tytso@mit.edu>
Fri, 6 May 2005 13:42:34 +0000 (09:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 6 May 2005 13:42:34 +0000 (09:42 -0400)
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)

lib/et/compile_et.sh.in
lib/et/et_c.awk
lib/et/et_h.awk

index e41b51b..27bb3cd 100644 (file)
@@ -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
index ab0079f..1769b79 100644 (file)
@@ -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
 
index 73caffc..8337121 100644 (file)
@@ -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