[file-roller] use git.mk to auto-generate .gitignore files



commit 9e114d38be5a3483881691897bd0a243c29d975f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Jun 15 19:34:34 2009 +0200

    use git.mk to auto-generate .gitignore files
    
    GNOME bug #584675

 .gitignore                           |  126 +++++++++++++++++------
 Makefile.am                          |   46 +++++++++
 copy-n-paste/Makefile.am             |    2 +
 data/Makefile.am                     |    2 +
 data/icons/16x16/Makefile.am         |    2 +
 data/icons/16x16/actions/Makefile.am |    3 +-
 data/icons/16x16/apps/Makefile.am    |    3 +-
 data/icons/22x22/Makefile.am         |    2 +
 data/icons/22x22/apps/Makefile.am    |    3 +-
 data/icons/24x24/Makefile.am         |    2 +
 data/icons/24x24/actions/Makefile.am |    3 +-
 data/icons/24x24/apps/Makefile.am    |    2 +
 data/icons/32x32/Makefile.am         |    2 +
 data/icons/32x32/apps/Makefile.am    |    3 +-
 data/icons/Makefile.am               |    2 +
 data/icons/scalable/Makefile.am      |    2 +
 data/icons/scalable/apps/Makefile.am |    3 +-
 data/ui/Makefile.am                  |    2 +
 git.mk                               |  182 ++++++++++++++++++++++++++++++++++
 help/C/Makefile.am                   |    2 +
 help/Makefile.am                     |    2 +
 nautilus/Makefile.am                 |    2 +
 src/Makefile.am                      |    2 +
 src/sh/Makefile.am                   |    3 +-
 24 files changed, 363 insertions(+), 40 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 7ca5ca1..dc9ada6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,33 +1,93 @@
-*~
-aclocal.m4
-autom4te.cache
-build
-.cdtbuild
-.cdtproject
-config.guess
-config.h.in
-config.rpath
-config.sub
-configure
-depcomp
-gnome-doc-utils.make
-install-sh
-intltool-extract.in
-intltool-merge.in
-intltool-update.in
-ltmain.sh
-m4
-Makefile.in
-Makefile.in.in
-missing
-mkinstalldirs
-omf.make
-.project
-.settings
-xmldocs.make
-
-src/fr-enum-types.c
-src/fr-enum-types.h
-src/fr-marshal.c
-src/fr-marshal.h
-
+/*.bak
+/*.lo
+/*.o
+/*.orig
+/*.rej
+/*.tab.c
+/*~
+/.*.sw[nop]
+/.cdt*
+/.cproject
+/.deps
+/.gitignore
+/.libs
+/.project
+/.settings/
+/ChangeLog
+/GPATH
+/GRTAGS
+/GSYMS
+/GTAGS
+/ID
+/INSTALL
+/Makefile
+/Makefile.in
+/TAGS
+/_libs
+/aclocal.m4
+/autom4te.cache
+/autoscan.log
+/build
+/build/po/Makefile.in
+/compile
+/config.cache
+/config.guess
+/config.h
+/config.h.in
+/config.log
+/config.lt
+/config.status
+/config.status.lineno
+/config.sub
+/configure
+/configure.lineno
+/configure.scan
+/copy-n-paste/Makefile.in
+/data/Makefile.in
+/data/icons/16x16/Makefile.in
+/data/icons/16x16/actions/Makefile.in
+/data/icons/16x16/apps/Makefile.in
+/data/icons/22x22/Makefile.in
+/data/icons/22x22/apps/Makefile.in
+/data/icons/24x24/Makefile.in
+/data/icons/24x24/actions/Makefile.in
+/data/icons/24x24/apps/Makefile.in
+/data/icons/32x32/Makefile.in
+/data/icons/32x32/apps/Makefile.in
+/data/icons/Makefile.in
+/data/icons/scalable/Makefile.in
+/data/icons/scalable/apps/Makefile.in
+/data/ui/Makefile.in
+/depcomp
+/file-roller.spec
+/gnome-doc-utils.make
+/gtk-doc.make
+/help/Makefile.in
+/install-sh
+/intltool-extract
+/intltool-extract.in
+/intltool-merge
+/intltool-merge.in
+/intltool-update
+/intltool-update.in
+/libtool
+/ltmain.sh
+/m4
+/missing
+/mkinstalldirs
+/nautilus/Makefile.in
+/omf.make
+/po/*.gmo
+/po/*.mo
+/po/.intltool-merge-cache
+/po/Makefile
+/po/Makefile.in
+/po/Makefile.in.in
+/po/POTFILES
+/po/stamp-it
+/so_locations
+/src/Makefile.in
+/src/sh/Makefile.in
+/stamp-h1
+/tags
+/xmldocs.make
diff --git a/Makefile.am b/Makefile.am
index 4cc1e56..6b4090d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -39,3 +39,49 @@ DISTCLEANFILES =                        \
 	intltool-update
 
 DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper
+
+MAINTAINERCLEANFILES = \
+	$(srcdir)/INSTALL \
+	$(srcdir)/aclocal.m4 \
+	$(srcdir)/autoscan.log \
+	$(srcdir)/compile \
+	$(srcdir)/config.guess \
+	$(srcdir)/config.h.in \
+	$(srcdir)/config.sub \
+	$(srcdir)/configure.scan \
+	$(srcdir)/depcomp \
+ 	$(srcdir)/install-sh \
+	$(srcdir)/ltmain.sh \
+	$(srcdir)/m4 \
+	$(srcdir)/missing \
+	$(srcdir)/mkinstalldirs \
+	$(srcdir)/omf.make \
+	$(srcdir)/xmldocs.make \
+	$(srcdir)/gtk-doc.make \
+	$(srcdir)/ChangeLog \
+	`find "$(srcdir)" -type f -name Makefile.in -print`
+
+GITIGNOREFILES = build .cdt* .cproject .project .settings/
+
+CLEANFILES = ChangeLog
+
+# Build ChangeLog from GIT history
+ChangeLog:
+	@echo Creating $@
+	@if test -d $(top_srcdir)/.git; then \
+		(GIT_DIR=$(top_srcdir)/.git $(top_srcdir)/missing --run git log --stat -M -C --name-status  --date=short --no-color) | fmt --split-only > $  tmp \
+		 && mv -f $  tmp $@ \
+		 || ($(RM) $  tmp; \
+		     echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \
+		     (test -f $@ || echo git-log is required to generate this file >> $@)); \
+	else \
+		test -f $@ || \
+		(echo A git checkout and git-log is required to generate ChangeLog >&2 && \
+		echo A git checkout and git-log is required to generate this file >> $@); \
+	fi
+
+dist: ChangeLog
+
+.PHONY: ChangeLog
+
+-include $(top_srcdir)/git.mk
diff --git a/copy-n-paste/Makefile.am b/copy-n-paste/Makefile.am
index d21f63e..1a8e01a 100644
--- a/copy-n-paste/Makefile.am
+++ b/copy-n-paste/Makefile.am
@@ -13,3 +13,5 @@ libeggsmclient_la_SOURCES = eggdesktopfile.h \
 			    eggsmclient.c \
 			    eggsmclient-private.h \
 			    eggsmclient-xsmp.c
+
+-include $(top_srcdir)/git.mk
diff --git a/data/Makefile.am b/data/Makefile.am
index 550196b..7ac1e69 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -40,3 +40,5 @@ EXTRA_DIST = 			\
 DISTCLEANFILES =                \
 	$(desktop_in_files)	\
 	$(desktop_DATA)	
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/16x16/Makefile.am b/data/icons/16x16/Makefile.am
index 43de79e..c89b441 100644
--- a/data/icons/16x16/Makefile.am
+++ b/data/icons/16x16/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = actions apps	
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/16x16/actions/Makefile.am b/data/icons/16x16/actions/Makefile.am
index 53a59ab..479869f 100644
--- a/data/icons/16x16/actions/Makefile.am
+++ b/data/icons/16x16/actions/Makefile.am
@@ -13,4 +13,5 @@ noinst_DATA =
 
 EXTRA_DIST = \
 	$(icons_DATA)	\
-	$(noinst_DATA)
\ No newline at end of file
+	$(noinst_DATA)
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/16x16/apps/Makefile.am b/data/icons/16x16/apps/Makefile.am
index 0da64a8..c93d35a 100644
--- a/data/icons/16x16/apps/Makefile.am
+++ b/data/icons/16x16/apps/Makefile.am
@@ -22,4 +22,5 @@ install-data-hook:
 	else \
 		echo "*** Icon cache not updated.  After install, run this:"; \
 		echo "***   $(gtk_update_icon_cache)"; \
-	fi
\ No newline at end of file
+	fi
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/22x22/Makefile.am b/data/icons/22x22/Makefile.am
index bc8a443..c1213be 100644
--- a/data/icons/22x22/Makefile.am
+++ b/data/icons/22x22/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = apps	
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/22x22/apps/Makefile.am b/data/icons/22x22/apps/Makefile.am
index fcf4b2f..5387a25 100644
--- a/data/icons/22x22/apps/Makefile.am
+++ b/data/icons/22x22/apps/Makefile.am
@@ -22,4 +22,5 @@ install-data-hook:
 	else \
 		echo "*** Icon cache not updated.  After install, run this:"; \
 		echo "***   $(gtk_update_icon_cache)"; \
-	fi
\ No newline at end of file
+	fi
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/24x24/Makefile.am b/data/icons/24x24/Makefile.am
index 063f693..4497479 100644
--- a/data/icons/24x24/Makefile.am
+++ b/data/icons/24x24/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = actions apps
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/24x24/actions/Makefile.am b/data/icons/24x24/actions/Makefile.am
index 36b3d5c..0af6b6f 100644
--- a/data/icons/24x24/actions/Makefile.am
+++ b/data/icons/24x24/actions/Makefile.am
@@ -13,4 +13,5 @@ noinst_DATA =
 
 EXTRA_DIST = \
 	$(icons_DATA)	\
-	$(noinst_DATA)
\ No newline at end of file
+	$(noinst_DATA)
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/24x24/apps/Makefile.am b/data/icons/24x24/apps/Makefile.am
index 5b2a340..f42a2fd 100644
--- a/data/icons/24x24/apps/Makefile.am
+++ b/data/icons/24x24/apps/Makefile.am
@@ -23,3 +23,5 @@ install-data-hook:
 		echo "*** Icon cache not updated.  After install, run this:"; \
 		echo "***   $(gtk_update_icon_cache)"; \
 	fi
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/32x32/Makefile.am b/data/icons/32x32/Makefile.am
index bc8a443..c1213be 100644
--- a/data/icons/32x32/Makefile.am
+++ b/data/icons/32x32/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = apps	
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/32x32/apps/Makefile.am b/data/icons/32x32/apps/Makefile.am
index c845d06..0337805 100644
--- a/data/icons/32x32/apps/Makefile.am
+++ b/data/icons/32x32/apps/Makefile.am
@@ -22,4 +22,5 @@ install-data-hook:
 	else \
 		echo "*** Icon cache not updated.  After install, run this:"; \
 		echo "***   $(gtk_update_icon_cache)"; \
-	fi
\ No newline at end of file
+	fi
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/Makefile.am b/data/icons/Makefile.am
index ca48214..5a56f89 100644
--- a/data/icons/Makefile.am
+++ b/data/icons/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = 16x16 22x22 24x24 32x32 scalable
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/scalable/Makefile.am b/data/icons/scalable/Makefile.am
index bc8a443..c1213be 100644
--- a/data/icons/scalable/Makefile.am
+++ b/data/icons/scalable/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = apps	
+
+-include $(top_srcdir)/git.mk
diff --git a/data/icons/scalable/apps/Makefile.am b/data/icons/scalable/apps/Makefile.am
index 9148632..cb4ae9f 100644
--- a/data/icons/scalable/apps/Makefile.am
+++ b/data/icons/scalable/apps/Makefile.am
@@ -22,4 +22,5 @@ install-data-hook:
 	else \
 		echo "*** Icon cache not updated.  After install, run this:"; \
 		echo "***   $(gtk_update_icon_cache)"; \
-	fi
\ No newline at end of file
+	fi
+-include $(top_srcdir)/git.mk
diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am
index 429658b..728a233 100644
--- a/data/ui/Makefile.am
+++ b/data/ui/Makefile.am
@@ -11,3 +11,5 @@ ui_DATA = 			\
 	update.ui
 
 EXTRA_DIST = $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/git.mk b/git.mk
new file mode 100644
index 0000000..01bf288
--- /dev/null
+++ b/git.mk
@@ -0,0 +1,182 @@
+# git.mk
+#
+# Copyright 2009, Red Hat, Inc.
+# Written by Behdad Esfahbod
+#
+# 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.
+#
+# The canonical source for this file is pango/git.mk, or whereever the
+# header of pango/git.mk suggests in the future.
+#
+# To use in your project, import this file in your git repo's toplevel,
+# then do "make -f git.mk".  This modifies all Makefile.am files in
+# your project to include git.mk.
+#
+# This enables automatic .gitignore generation.  If you need to ignore
+# more files, add them to the GITIGNOREFILES variable in your Makefile.am.
+# But think twice before doing that.  If a file has to be in .gitignore,
+# chances are very high that it's a generated file and should be in one
+# of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
+#
+# The only case that you need to manually add a file to GITIGNOREFILES is
+# when remove files in one of mostlyclean-local, clean-local, distclean-local,
+# or maintainer-clean-local.
+#
+# Note that for files like editor backup, etc, there are better places to
+# ignore them.  See "man gitignore".
+#
+# If "make maintainer-clean" removes the files but they are not recognized
+# by this script (that is, if "git status" shows untracked files still), send
+# me the output of "git status" as well as your Makefile.am and Makefile for
+# the directories involved.
+#
+# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
+# pango/Makefile.am.
+#
+# Don't EXTRA_DIST this file.  It is supposed to only live in git clones,
+# not tarballs.  It serves no useful purpose in tarballs and clutters the
+# build dir.
+#
+# This file knows how to handle autoconf, automake, libtool, gtk-doc,
+# gnome-doc-utils, intltool.
+#
+#
+# KNOWN ISSUES:
+#
+# - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
+#   submodule doesn't find us.  If you have configure.{in,ac} files in
+#   subdirs, add a proxy git.mk file in those dirs that simply does:
+#   "include $(top_srcdir)/../git.mk".  Add more ..'s to your taste.
+#   And add those files to git.  See vte/gnome-pty-helper/git.mk for
+#   example.
+#
+
+git-all: git-mk-install
+
+git-mk-install:
+	@echo Installing git makefile
+	@any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \
+		if grep 'include .*/git.mk' $$x >/dev/null; then \
+			echo $$x already includes git.mk; \
+		else \
+			failed=; \
+			echo "Updating $$x"; \
+			{ cat $$x; \
+			  echo ''; \
+			  echo '-include $$(top_srcdir)/git.mk'; \
+			} > $$x.tmp || failed=1; \
+			if test x$$failed = x; then \
+				mv $$x.tmp $$x || failed=1; \
+			fi; \
+			if test x$$failed = x; then : else \
+				echo Failed updating $$x; >&2 \
+				any_failed=1; \
+			fi; \
+	fi; done; test -z "$$any_failed"
+
+.PHONY: git-all git-mk-install
+
+
+### .gitignore generation
+
+$(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
+	@echo Generating $@; \
+	{ \
+		if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
+			for x in \
+				$(DOC_MODULE)-decl-list.txt \
+				$(DOC_MODULE)-decl.txt \
+				tmpl/$(DOC_MODULE)-unused.sgml \
+				"tmpl/*.bak" \
+				xml html \
+			; do echo /$$x; done; \
+		fi; \
+		if test "x$(DOC_MODULE)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+			for x in \
+				$(_DOC_C_DOCS) \
+				$(_DOC_LC_DOCS) \
+				$(_DOC_OMF_ALL) \
+				$(_DOC_DSK_ALL) \
+				$(_DOC_HTML_ALL) \
+				$(_DOC_POFILES) \
+				"*/.xml2po.mo" \
+				"*/*.omf.out" \
+			; do echo /$$x; done; \
+		fi; \
+		if test -f $(srcdir)/po/Makefile.in.in; then \
+			for x in \
+				po/Makefile.in.in \
+				po/Makefile.in \
+				po/Makefile \
+				po/POTFILES \
+				po/stamp-it \
+				po/.intltool-merge-cache \
+				"po/*.gmo" \
+				"po/*.mo" \
+				intltool-extract.in \
+				intltool-merge.in \
+				intltool-update.in \
+			; do echo /$$x; done; \
+		fi; \
+		if test -f $(srcdir)/configure; then \
+			for x in \
+				autom4te.cache \
+				configure \
+				config.h \
+				stamp-h1 \
+				libtool \
+				config.lt \
+			; do echo /$$x; done; \
+		fi; \
+		for x in \
+			.gitignore \
+			$(GITIGNOREFILES) \
+			$(CLEANFILES) \
+			$(PROGRAMS) \
+			$(EXTRA_PROGRAMS) \
+			$(LTLIBRARIES) \
+			so_locations \
+			.libs _libs \
+			$(MOSTLYCLEANFILES) \
+			"*.$(OBJEXT)" \
+			"*.lo" \
+			$(DISTCLEANFILES) \
+			$(am__CONFIG_DISTCLEAN_FILES) \
+			$(CONFIG_CLEAN_FILES) \
+			TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
+			"*.tab.c" \
+			$(MAINTAINERCLEANFILES) \
+			$(BUILT_SOURCES) \
+			$(DEPDIR) \
+			Makefile \
+			Makefile.in \
+			"*.orig" \
+			"*.rej" \
+			"*.bak" \
+			"*~" \
+			".*.sw[nop]" \
+		; do echo /$$x; done; \
+	} | \
+	sed "s ^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
+	sed 's@/[.]/@/@g' | \
+	LANG=C sort | uniq > $  tmp && \
+	mv $  tmp $@;
+
+all: $(srcdir)/.gitignore gitignore-recurse-maybe
+gitignore-recurse-maybe:
+	@if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
+		$(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
+	fi;
+gitignore-recurse:
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \
+	done
+gitignore: $(srcdir)/.gitignore gitignore-recurse
+
+maintainer-clean: gitignore-clean
+gitignore-clean:
+	-rm -f $(srcdir)/.gitignore
+
+.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
diff --git a/help/C/Makefile.am b/help/C/Makefile.am
index 2cb7968..4671c82 100644
--- a/help/C/Makefile.am
+++ b/help/C/Makefile.am
@@ -5,3 +5,5 @@ omffile = file-roller-C.omf
 entities = legal.xml
 include $(top_srcdir)/xmldocs.make
 dist-hook: app-dist-hook
+
+-include $(top_srcdir)/git.mk
diff --git a/help/Makefile.am b/help/Makefile.am
index e52e0f1..f426abc 100644
--- a/help/Makefile.am
+++ b/help/Makefile.am
@@ -12,3 +12,5 @@ DOC_FIGURES = 					\
 	figures/file-roller_uparrow.png
 
 DOC_LINGUAS = bg ca de el en_GB es fi fr it oc nl ru sv vi uk
+
+-include $(top_srcdir)/git.mk
diff --git a/nautilus/Makefile.am b/nautilus/Makefile.am
index 47bf359..ca38cac 100644
--- a/nautilus/Makefile.am
+++ b/nautilus/Makefile.am
@@ -24,3 +24,5 @@ libnautilus_fileroller_la_SOURCES =     \
 
 libnautilus_fileroller_la_LDFLAGS = -module -avoid-version -no-undefined
 libnautilus_fileroller_la_LIBADD  = $(NAUTILUS_LIBS)
+
+-include $(top_srcdir)/git.mk
diff --git a/src/Makefile.am b/src/Makefile.am
index cf72b52..70447a7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -175,3 +175,5 @@ file_roller_LDADD =							\
 EXTRA_DIST = fr-marshal.list
 
 CLEANFILES = $(BUILT_SOURCES)
+
+-include $(top_srcdir)/git.mk
diff --git a/src/sh/Makefile.am b/src/sh/Makefile.am
index 24582d9..324222f 100644
--- a/src/sh/Makefile.am
+++ b/src/sh/Makefile.am
@@ -1,4 +1,5 @@
 shdir = $(libexecdir)/file-roller
 sh_DATA = isoinfo.sh 
 
-EXTRA_DIST = $(sh_DATA)
\ No newline at end of file
+EXTRA_DIST = $(sh_DATA)
+-include $(top_srcdir)/git.mk



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]