Makefile.am: Add rule to make sure every file gets distributed.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 23 Dec 2013 17:02:54 +0000 (09:02 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 23 Dec 2013 17:02:54 +0000 (09:02 -0800)
This helps to prevent adding files to the Git repository but forgetting to
ensure that they get distributed.

Makefile.am

index 6e60789d2b860f89fc7245451853d94c188a2709..803ad08e2a01473ebb5db1ac4af6d0f727450859 100644 (file)
@@ -99,3 +99,39 @@ check-local: $(CHECK_LOCAL)
 
 # A convenience target to build all the binaries
 programs: $(PROGRAMS)
+
+# The following rules are from Open vSwitch.  The original copyright notice
+# and license are:
+#
+# Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without warranty of any kind.
+
+# If we're checked out from a Git repository, make sure that every
+# file that is in Git is distributed.
+ALL_LOCAL += dist-hook-git
+dist-hook-git: distfiles
+       @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
+         (cd $(srcdir) && git ls-files)                                    \
+           | grep -vE '\.gitignore|README.Git|Smake'                       \
+           | sort -u > gitfiles;                                           \
+         comm -1 -3 distfiles gitfiles > missing-distfiles;                \
+         if test -s missing-distfiles; then                                \
+           echo "The distribution is missing the following files:";        \
+           cat missing-distfiles;                                          \
+           exit 1;                                                         \
+         fi;                                                               \
+       fi
+# The following is based on commands for the Automake "distdir" target.
+distfiles: Makefile
+       @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+       list='$(DISTFILES)'; \
+       for file in $$list; do echo $$file; done | \
+         sed -e "s|^$$srcdirstrip/||;t" \
+             -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | sort -u > $@
+CLEANFILES += distfiles gitfiles missing-distfiles
+.PHONY: dist-hook-git