Portability fix: 'if ! diff ...' is not always supported in sh.
[gedcom-parse.git] / Makefile.inc
index f86ad01d7b2867f6d5869c446567a5b52557c61a..aa01812cf7e657818cd3b060b17d25fef09da4e0 100644 (file)
@@ -1,4 +1,4 @@
-## File to include in other Makefile's, defining common commands
+## File to include in other Makefile's, defining common commands and rules
 # $Id$
 # $Name$
 
@@ -10,3 +10,16 @@ define replace-VERSION
   mv $$file.new $$file; \
   done
 endef
+
+%.tabgen.h:    %.tab.h
+       if [ ! -r $(srcdir)/$@ ] ; \
+       then \
+         touch $(srcdir)/$@; \
+       fi
+       if diff $< $(srcdir)/$@ > /dev/null 2>&1; \
+       then \
+         : ; \
+       else \
+         rm $(srcdir)/$@; \
+         cp $(srcdir)/$< $(srcdir)/$@; \
+       fi