[libgdata] Auto-generate .gitignore file using git.mk from Pango



commit 4122109f69a71e49cbe314b0f5f15b4c6e7c4af2
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Apr 18 15:46:21 2009 +0100

    Auto-generate .gitignore file using git.mk from Pango
    
    The .gitignore files are now auto-generated using git.mk. A few cleanups have
    been made to the Makefiles to ensure everything's cleaned up properly.
---
 .gitignore                          |   37 --------
 Makefile.am                         |   28 +++++-
 docs/Makefile.am                    |    2 +
 docs/reference/.gitignore           |   16 ---
 docs/reference/Makefile.am          |   19 ++++
 gdata/Makefile.am                   |   23 +++--
 gdata/services/Makefile.am          |    2 +
 gdata/services/calendar/Makefile.am |    2 +
 gdata/services/youtube/Makefile.am  |    2 +
 gdata/tests/Makefile.am             |    2 +
 git.mk                              |  174 +++++++++++++++++++++++++++++++++++
 11 files changed, 242 insertions(+), 65 deletions(-)

diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index e3359c6..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,37 +0,0 @@
-Makefile
-Makefile.in
-aclocal.m4
-compile
-config.guess
-config.h
-config.log
-config.status
-config.sub
-configure
-depcomp
-install-sh
-libtool
-ltmain.sh
-missing
-mkinstalldirs
-stamp-*
-autom4te.cache
-version.xml
-.deps
-.libs
-po/POTFILES
-config.status.lineno
-libgdata.pc
-*-marshal.c
-*-marshal.h
-*-enums.c
-*-enums.h
-*.lo
-*.la
-gdata/tests/general
-gdata/tests/youtube
-gdata/tests/calendar
-gdata/tests/memory
-gtk-doc.make
-*~
-*.o
diff --git a/Makefile.am b/Makefile.am
index 6a23f07..da0f0e4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,9 +6,12 @@ EXTRA_DIST = \
 	intltool-extract.in	\
 	intltool-merge.in	\
 	intltool-update.in	\
-	AUTHORS NEWS		\
+	AUTHORS 		\
+	NEWS			\
+	MAINTAINERS		\
 	gtk-doc.make		\
-	libgdata.pc.in
+	libgdata.pc.in		\
+	libgdata.doap
 
 CLEANFILES = gdata.pc
 
@@ -19,10 +22,27 @@ DISTCLEANFILES = \
 	gnome-doc-utils.make	\
 	gtk-doc.make
 
+MAINTAINERCLEANFILES = \
+	INSTALL		\
+	aclocal.m4	\
+	compile		\
+	config.guess	\
+	config.h.in	\
+	config.sub	\
+	depcomp		\
+	install-sh	\
+	ltmain.sh	\
+	missing		\
+	mkinstalldirs	\
+	omf.make	\
+	gtk-doc.make	\
+	ChangeLog	\
+	`find "$(srcdir)" -type f -name Makefile.in -print`
+
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgdata.pc
 
-DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper --enable-gtk-doc
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc
 
 # ChangeLog
 ChangeLog:
@@ -39,3 +59,5 @@ ChangeLog:
 	  echo A git checkout and git-log is required to generate this file >> $@); \
 	fi
 .PHONY: ChangeLog
+
+-include $(top_srcdir)/git.mk
diff --git a/docs/Makefile.am b/docs/Makefile.am
index f3ddc22..034926c 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = reference
+
+-include $(top_srcdir)/git.mk
diff --git a/docs/reference/.gitignore b/docs/reference/.gitignore
deleted file mode 100644
index 0c66ad3..0000000
--- a/docs/reference/.gitignore
+++ /dev/null
@@ -1,16 +0,0 @@
-gdata-decl-list.txt
-gdata-decl.txt
-gdata-undeclared.txt
-gdata-undocumented.txt
-gdata-unused.txt
-gdata.args
-gdata.hierarchy
-gdata.interfaces
-gdata.prerequisites
-gdata.signals
-gdata.types
-*.stamp
-*.bak
-html/
-tmpl/
-xml/
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index a81a2a9..6453ede 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -73,6 +73,23 @@ GTKDOC_LIBS=$(top_builddir)/gdata/libgdata.la
 # This includes the standard gtk-doc make rules, copied by gtkdocize.
 include $(top_srcdir)/gtk-doc.make
 
+# This should be in gtk-doc.make, since we are calling gtkdoc-scan with
+# --rebuild-types
+SCANOBJ_FILES += $(DOC_MODULE).types
+
+# This should also be dealt with elsewhere, but we can't call gtkdocize
+# with --flavour=no-tmpl because of gnome-autogen.sh being out of our
+# control. Grrr.
+distclean-local:
+	cd $(srcdir) && \
+	  rm -rf xml tmpl $(REPORT_FILES) \
+	         $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt
+
+maintainer-clean-local: clean
+	cd $(srcdir) && rm -rf xml tmpl html
+
+GITIGNOREFILES = tmpl/
+
 # Other files to distribute
 # e.g. EXTRA_DIST += version.xml.in
 EXTRA_DIST += version.xml.in
@@ -81,3 +98,5 @@ if ENABLE_GTK_DOC
 TESTS_ENVIRONMENT = cd $(srcdir) && 
 TESTS = $(GTKDOC_CHECK)
 endif
+
+-include $(top_srcdir)/git.mk
diff --git a/gdata/Makefile.am b/gdata/Makefile.am
index e9c5a1e..689ed01 100644
--- a/gdata/Makefile.am
+++ b/gdata/Makefile.am
@@ -18,44 +18,47 @@ GDATA_ENUM_FILES = \
 	gdata-enums.c	\
 	gdata-enums.h
 
-gdata-enums.h: $(gdatainclude_HEADERS) Makefile
+gdata-enums.h: $(gdata_headers) Makefile
 	(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#ifndef GDATA_ENUMS_H\n#define GDATA_ENUMS_H\n\n#include <glib-object.h>\n\nG_BEGIN_DECLS\n" \
 			--fprod "/* enumerations from \"@filename \" */\n" \
 			--vhead "GType @enum_name _get_type (void) G_GNUC_CONST;\n#define GDATA_TYPE_ ENUMSHORT@ (@enum_name _get_type())\n" \
-			--ftail "G_END_DECLS\n\n#endif /* !GDATA_ENUMS_H */" $(gdatainclude_HEADERS)) > gdata-enums.h.tmp \
+			--ftail "G_END_DECLS\n\n#endif /* !GDATA_ENUMS_H */" $(gdata_headers)) > gdata-enums.h.tmp \
 	&& sed "s/g_data/gdata/" gdata-enums.h.tmp > gdata-enums.h \
 	&& rm -f gdata-enums.h.tmp
 
-gdata-enums.c: $(gdatainclude_HEADERS) Makefile gdata-enums.h
+gdata-enums.c: $(gdata_headers) Makefile gdata-enums.h
 	(cd $(srcdir) && $(GLIB_MKENUMS) \
 			--fhead "#include \"gdata.h\"\n#include \"gdata-enums.h\"" \
 			--fprod "\n/* enumerations from \"@filename \" */" \
 			--vhead "GType\n enum_name@_get_type (void)\n{\n  static GType etype = 0;\n  if (etype == 0) {\n    static const G Type@Value values[] = {" \
 			--vprod "      { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
 			--vtail "      { 0, NULL, NULL }\n    };\n    etype = g_ type@_register_static (\"@EnumName \", values);\n  }\n  return etype;\n}\n" \
-		$(gdatainclude_HEADERS)) > gdata-enums.c.tmp \
+		$(gdata_headers)) > gdata-enums.c.tmp \
 	&& sed "s/g_data/gdata/" gdata-enums.c.tmp > gdata-enums.c \
 	&& rm -f gdata-enums.c.tmp
 
 # libgdata library
 lib_LTLIBRARIES = libgdata.la
 
-gdataincludedir = $(pkgincludedir)/gdata
-gdatainclude_HEADERS = \
+gdata_headers = \
 	gdata.h			\
 	gdata-entry.h		\
-	gdata-enums.h		\
 	gdata-feed.h		\
 	gdata-service.h		\
-	gdata-types.h		\
 	gdata-query.h		\
-	gdata-marshal.h		\
 	gdata-atom.h		\
 	gdata-media-rss.h	\
 	gdata-gdata.h		\
 	gdata-parser.h
 
+gdataincludedir = $(pkgincludedir)/gdata
+gdatainclude_HEADERS = \
+	$(gdata_headers)	\
+	gdata-enums.h		\
+	gdata-types.h		\
+	gdata-marshal.h
+
 libgdata_la_SOURCES = \
 	$(GDATA_MARSHAL_FILES)	\
 	$(GDATA_ENUM_FILES)	\
@@ -100,3 +103,5 @@ CLEANFILES = \
 EXTRA_DIST = \
 	gdata.symbols	\
 	gdata-marshal.list
+
+-include $(top_srcdir)/git.mk
diff --git a/gdata/services/Makefile.am b/gdata/services/Makefile.am
index 54db943..061f7e5 100644
--- a/gdata/services/Makefile.am
+++ b/gdata/services/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = youtube calendar
+
+-include $(top_srcdir)/git.mk
diff --git a/gdata/services/calendar/Makefile.am b/gdata/services/calendar/Makefile.am
index f89b174..9b1466d 100644
--- a/gdata/services/calendar/Makefile.am
+++ b/gdata/services/calendar/Makefile.am
@@ -38,3 +38,5 @@ libgdatacalendar_la_LIBADD = \
 libgdatacalendar_la_LDFLAGS = \
 	-no-undefined	\
 	$(AM_LDFLAGS)
+
+-include $(top_srcdir)/git.mk
diff --git a/gdata/services/youtube/Makefile.am b/gdata/services/youtube/Makefile.am
index 8fee86a..c1540d9 100644
--- a/gdata/services/youtube/Makefile.am
+++ b/gdata/services/youtube/Makefile.am
@@ -66,3 +66,5 @@ libgdatayoutube_la_LDFLAGS = \
 
 # General cleanup
 CLEANFILES = $(GDATA_YOUTUBE_ENUM_FILES)
+
+-include $(top_srcdir)/git.mk
diff --git a/gdata/tests/Makefile.am b/gdata/tests/Makefile.am
index 8141717..07263b3 100644
--- a/gdata/tests/Makefile.am
+++ b/gdata/tests/Makefile.am
@@ -29,3 +29,5 @@ calendar_SOURCES		 = calendar.c $(TEST_SRCS)
 TEST_PROGS			+= memory
 memory_SOURCES			 = memory.c $(TEST_SRCS)
 
+
+-include $(top_srcdir)/git.mk
diff --git a/git.mk b/git.mk
new file mode 100644
index 0000000..3809d71
--- /dev/null
+++ b/git.mk
@@ -0,0 +1,174 @@
+# git.mk
+#
+# Copyright 2009 Red Hat, Inc.
+# Written by Behdad Esfahbod
+#
+# 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 stat" shows untracked files still), send
+# me the output of "git stat" 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
+
+.gitignore: Makefile.am $(top_srcdir)/git.mk
+	@echo Generating $@; \
+	GTKDOCGITIGNOREFILES=; \
+	test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x || \
+	GTKDOCGITIGNOREFILES=" \
+		$(DOC_MODULE)-decl-list.txt \
+		$(DOC_MODULE)-decl.txt \
+		tmpl/$(DOC_MODULE)-unused.sgml \
+		tmpl/*.bak \
+		xml html \
+		"; \
+	GNOMEDOCUTILSGITIGNOREFILES=; \
+	test "x$(DOC_MODULE)" = x -o "x$(DOC_LINGUAS)" = x || \
+	GNOMEDOCUTILSGITIGNOREFILES=" \
+		$(_DOC_C_DOCS) \
+		$(_DOC_LC_DOCS) \
+		$(_DOC_OMF_ALL) \
+		$(_DOC_DSK_ALL) \
+		$(_DOC_HTML_ALL) \
+		$(_DOC_POFILES) \
+		*/.xml2po.mo \
+		*/*.omf.out \
+		"; \
+	INTLTOOLGITIGNOREFILES=; test -f $(srcdir)/po/Makefile.in.in && \
+	INTLTOOLGITIGNOREFILES=" \
+		po/Makefile.in.in \
+		po/Makefile.in \
+		po/Makefile \
+		po/*.gmo \
+		po/*.mo \
+		po/POTFILES \
+		po/stamp-it \
+		po/.intltool-merge-cache \
+		intltool-extract.in \
+		intltool-merge.in \
+		intltool-update.in \
+		"; \
+	AUTOCONFGITIGNOREFILES=; test -f $(srcdir)/configure && \
+	AUTOCONFGITIGNOREFILES=" \
+		autom4te.cache \
+		configure \
+		config.h \
+		stamp-h1 \
+		libtool \
+		config.lt \
+		"; \
+	for x in \
+		.gitignore \
+		$$GTKDOCGITIGNOREFILES \
+		$$GNOMEDOCUTILSGITIGNOREFILES \
+		$$INTLTOOLGITIGNOREFILES \
+		$$AUTOCONFGITIGNOREFILES \
+		$(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" \
+		"*~" \
+		".*.swp" \
+	; do echo /$$x; done | \
+	grep -v '/[.][.]/' | \
+	sed 's@/[.]/@/@g' | \
+	LANG=C sort | uniq > $  tmp && \
+	mv $  tmp $@;
+
+all: .gitignore gitignore-recurse
+gitignore-recurse:
+	@if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
+		list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+		  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore); \
+		done; \
+	fi;
+maintainer-clean-local: gitignore-clean
+gitignore-clean:
+	rm -f .gitignore
+.PHONY: gitignore-clean gitignore-recurse
+



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