-# Since this directory contains two parsers, using bison without -y
-# is the only way to reliably do a parallel make.
+extract_stat = sed 's/@l@//g; s/@L@//g; /@LSTAT_ONLY@/d'
+extract_lstat = sed 's/@l@/l/g; s/@L@/L/g; s/ *@LSTAT_ONLY@//'
+
+safe-lstat.c: safe-xstat.cin
+ $(extract_lstat) $(srcdir)/safe-xstat.cin > $@-t
+ mv $@-t $@
+
+safe-lstat.h: safe-xstat.hin
+ $(extract_lstat) $(srcdir)/safe-xstat.hin > $@-t
+ mv $@-t $@
+
+safe-stat.c: safe-xstat.cin
+ $(extract_stat) $(srcdir)/safe-xstat.cin > $@-t
+ mv $@-t $@
+
+safe-stat.h: safe-xstat.hin
+ $(extract_stat) $(srcdir)/safe-xstat.hin > $@-t
+ mv $@-t $@
+
+safe-stat.o: safe-stat.h
+safe-lstat.o: safe-lstat.h safe-stat.h
+
+# Since this directory contains two parsers, we have to be careful to avoid
+# running two $(YACC)s during parallel makes. See below.