[caribou] build: use git.mk



commit 4e2469f73fa1f6c0112275b1eadba104f867dd0c
Author: Daiki Ueno <ueno unixuser org>
Date:   Wed Oct 31 15:37:30 2012 +0900

    build: use git.mk
    
    Use git.mk to generate .gitignore files upon building.
    Also remove *.[ch] from CLEANFILES since it makes little sense
    with automake Vala support.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=687315

 .gitignore                         |   48 --------
 Makefile.am                        |   16 +++
 bin/Makefile.am                    |    2 +
 caribou/Makefile.am                |    2 +
 caribou/antler/Makefile.am         |    2 +
 caribou/daemon/Makefile.am         |    2 +
 caribou/settings/Makefile.am       |    2 +
 data/Makefile.am                   |    2 +
 data/antler/Makefile.am            |    2 +
 data/layouts/Makefile.am           |    2 +
 data/layouts/fullscale/Makefile.am |    2 +
 data/layouts/scan/Makefile.am      |    2 +
 data/layouts/touch/Makefile.am     |    4 +-
 docs/Makefile.am                   |    2 +
 git.mk                             |  227 ++++++++++++++++++++++++++++++++++++
 libcaribou/Makefile.am             |    9 +-
 m4/.gitignore                      |    1 -
 modules/Makefile.am                |    2 +
 modules/gtk2/Makefile.am           |    6 +
 modules/gtk3/Makefile.am           |    6 +
 tools/Makefile.am                  |    2 +
 21 files changed, 291 insertions(+), 52 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index a507570..3cd2140 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,3 +9,19 @@ endif
 DISTCHECK_CONFIGURE_FLAGS = \
 	--enable-docs \
 	$(NULL)
+
+GITIGNOREFILES = \
+        INSTALL \
+	aclocal.m4 \
+	config.guess \
+	config.sub \
+	depcomp \
+	git.mk \
+	install-sh \
+	ltmain.sh \
+	m4 \
+	missing \
+	mkinstalldirs \
+	py-compile
+
+-include $(top_srcdir)/git.mk
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 3ab07a7..b001b10 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -5,3 +5,5 @@ DISTCLEANFILES = $(bin_SCRIPTS) $(libexec_SCRIPTS)
 
 all: $(bin_SCRIPTS) $(libexec_SCRIPTS)
 	@chmod +x $(bin_SCRIPTS) $(libexec_SCRIPTS)
+
+-include $(top_srcdir)/git.mk
diff --git a/caribou/Makefile.am b/caribou/Makefile.am
index cdc57be..cdb7045 100644
--- a/caribou/Makefile.am
+++ b/caribou/Makefile.am
@@ -10,3 +10,5 @@ SUBDIRS = \
 	daemon/
 
 DISTCLEANFILES = i18n.py
+
+-include $(top_srcdir)/git.mk
diff --git a/caribou/antler/Makefile.am b/caribou/antler/Makefile.am
index f3c8fef..5309fe9 100644
--- a/caribou/antler/Makefile.am
+++ b/caribou/antler/Makefile.am
@@ -6,3 +6,5 @@ caribou_antler_PYTHON = \
 	keyboard_view.py  \
 	main.py \
 	window.py
+
+-include $(top_srcdir)/git.mk
diff --git a/caribou/daemon/Makefile.am b/caribou/daemon/Makefile.am
index bb89cca..0bf6268 100644
--- a/caribou/daemon/Makefile.am
+++ b/caribou/daemon/Makefile.am
@@ -3,3 +3,5 @@ caribou_daemondir = $(pkgpythondir)/daemon/
 caribou_daemon_PYTHON = \
 	__init__.py \
 	main.py
+
+-include $(top_srcdir)/git.mk
diff --git a/caribou/settings/Makefile.am b/caribou/settings/Makefile.am
index 94a0f1d..dd68c52 100644
--- a/caribou/settings/Makefile.am
+++ b/caribou/settings/Makefile.am
@@ -6,3 +6,5 @@ caribou_settings_PYTHON = \
 	settings_manager.py \
 	caribou_settings.py  \
 	setting_types.py
+
+-include $(top_srcdir)/git.mk
diff --git a/data/Makefile.am b/data/Makefile.am
index 6d686a7..16e9b1f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -41,3 +41,5 @@ CLEANFILES = $(desktop_DATA) \
 	$(gsettings_schemas_in_files) \
 	$(gsettings_SCHEMAS) \
 	$(servicefile_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/data/antler/Makefile.am b/data/antler/Makefile.am
index f703037..9296728 100644
--- a/data/antler/Makefile.am
+++ b/data/antler/Makefile.am
@@ -3,3 +3,5 @@ cssfiles_DATA = \
 	style.css \
 	dark-key-border.svg
 EXTRA_DIST = $(cssfiles_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/data/layouts/Makefile.am b/data/layouts/Makefile.am
index 3613053..fd73610 100644
--- a/data/layouts/Makefile.am
+++ b/data/layouts/Makefile.am
@@ -1 +1,3 @@
 SUBDIRS = scan touch fullscale
+
+-include $(top_srcdir)/git.mk
diff --git a/data/layouts/fullscale/Makefile.am b/data/layouts/fullscale/Makefile.am
index c560f7b..7d3eae9 100644
--- a/data/layouts/fullscale/Makefile.am
+++ b/data/layouts/fullscale/Makefile.am
@@ -16,3 +16,5 @@ common_files = \
 EXTRA_DIST = $(fullscalelayouts_in_files) $(common_files)
 
 CLEANFILES = $(fullscalelayouts_DATA) $(fullscalelayouts_in_files:.xml.in=.xsl)
+
+-include $(top_srcdir)/git.mk
diff --git a/data/layouts/scan/Makefile.am b/data/layouts/scan/Makefile.am
index 39f7fce..4c1ebc7 100644
--- a/data/layouts/scan/Makefile.am
+++ b/data/layouts/scan/Makefile.am
@@ -4,3 +4,5 @@ scanlayouts_DATA = \
     us.xml
 
 EXTRA_DIST = $(scanlayouts_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/data/layouts/touch/Makefile.am b/data/layouts/touch/Makefile.am
index a3389d8..755107f 100644
--- a/data/layouts/touch/Makefile.am
+++ b/data/layouts/touch/Makefile.am
@@ -17,4 +17,6 @@ common_files = \
 
 EXTRA_DIST = $(touchlayouts_in_files) $(common_files)
 
-CLEANFILES = $(touchlayouts_DATA) $(touchlayouts_in_files:.xml.in=.xsl)
\ No newline at end of file
+CLEANFILES = $(touchlayouts_DATA) $(touchlayouts_in_files:.xml.in=.xsl)
+
+-include $(top_srcdir)/git.mk
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 4f4fe6d..3668228 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -97,3 +97,5 @@ caribou-gtk-doc: $(caribou_doc_files)
 distclean-local: distclean-docs
 distclean-docs:
 	rm -rf $(distclean_dirs)
+
+-include $(top_srcdir)/git.mk
diff --git a/git.mk b/git.mk
new file mode 100644
index 0000000..d5bf7b8
--- /dev/null
+++ b/git.mk
@@ -0,0 +1,227 @@
+# git.mk
+#
+# Copyright 2009, Red Hat, Inc.
+# Copyright 2010,2011 Behdad Esfahbod
+# Written by Behdad Esfahbod
+#
+# Copying and distribution of this file, with or without modification,
+# is permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+#
+# The latest version of this file can be downloaded from:
+#   https://raw.github.com/behdad/git.mk/master/git.mk
+# Bugs, etc, should be reported upstream at:
+#   https://github.com/behdad/git.mk
+#
+# 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.  Remember to add that line to new
+# Makefile.am files you create in your project, or just rerun the
+# "make -f 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 make targets.
+#
+# 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 and I'll diagnose.
+#
+# For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
+# Makefile.am.sample in the git.mk git repo.
+#
+# 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, yelp.m4, mallard, intltool, gsettings, dejagnu.
+#
+# This makefile provides the following targets:
+#
+# - all: "make all" will build all gitignore files.
+# - gitignore: makes all gitignore files in the current dir and subdirs.
+# - .gitignore: make gitignore file for the current dir.
+# - gitignore-recurse: makes all gitignore files in the subdirs.
+#
+# 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 "`test -z "$(top_srcdir)" && echo . || echo "$(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
+	$(AM_V_GEN) \
+	{ \
+		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)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
+			for lc in $(DOC_LINGUAS); do \
+				for x in \
+					$(if $(DOC_MODULE),$(DOC_MODULE).xml) \
+					$(DOC_PAGES) \
+					$(DOC_INCLUDES) \
+				; do echo /$$lc/$$x; done; \
+			done; \
+			for x in \
+				$(_DOC_OMF_ALL) \
+				$(_DOC_DSK_ALL) \
+				$(_DOC_HTML_ALL) \
+				$(_DOC_MOFILES) \
+				$(DOC_H_FILE) \
+				"*/.xml2po.mo" \
+				"*/*.omf.out" \
+			; do echo /$$x; done; \
+		fi; \
+		if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
+			for lc in $(HELP_LINGUAS); do \
+				for x in \
+					$(HELP_FILES) \
+					"$$lc.stamp" \
+					"$$lc.mo" \
+				; do echo /$$lc/$$x; done; \
+			done; \
+		fi; \
+		if test "x$(gsettings_SCHEMAS)" = x; then :; else \
+			for x in \
+				$(gsettings_SCHEMAS:.xml=.valid) \
+				$(gsettings__enum_file) \
+			; 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" \
+				po/$(GETTEXT_PACKAGE).pot \
+				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; \
+		if test "x$(DEJATOOL)" = x; then :; else \
+			for x in \
+				$(DEJATOOL) \
+			; do echo /$$x.sum; echo /$$x.log; done; \
+			echo /site.exp; \
+		fi; \
+		for x in \
+			.gitignore \
+			$(GITIGNOREFILES) \
+			$(CLEANFILES) \
+			$(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
+			$(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
+			$(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_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]" \
+			".dirstamp" \
+		; do echo /$$x; done; \
+	} | \
+	sed "s ^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
+	sed 's@/[.]/@/@g' | \
+	LC_ALL=C sort | uniq > $  tmp && \
+	mv $  tmp $@;
+
+all: $(srcdir)/.gitignore gitignore-recurse-maybe
+gitignore: $(srcdir)/.gitignore gitignore-recurse
+
+gitignore-recurse-maybe:
+	@for subdir in $(DIST_SUBDIRS); do \
+	  case " $(SUBDIRS) " in \
+	    *" $$subdir "*) :;; \
+	    *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \
+	  esac; \
+	done
+gitignore-recurse:
+	@for subdir in $(DIST_SUBDIRS); do \
+	    test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \
+	done
+
+maintainer-clean: gitignore-clean
+gitignore-clean:
+	-rm -f $(srcdir)/.gitignore
+
+.PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
diff --git a/libcaribou/Makefile.am b/libcaribou/Makefile.am
index 6d936a5..eef3d02 100644
--- a/libcaribou/Makefile.am
+++ b/libcaribou/Makefile.am
@@ -86,7 +86,12 @@ CLEANFILES = \
 	Caribou-1.0.typelib \
 	Caribou-1.0.gir \
 	_Caribou-1.0.gir \
-	caribou.pc \
-	*.[ch]
+	caribou.pc
 
 MAINTAINERCLEANFILES = libcaribou.symbols
+
+GITIGNOREFILES = \
+        $(libcaribou_la_SOURCES:.vala=.c) \
+        libcaribou_la_vala.stamp
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/Makefile.am b/modules/Makefile.am
index ca20e3b..d0933e0 100644
--- a/modules/Makefile.am
+++ b/modules/Makefile.am
@@ -14,3 +14,5 @@ gtk_modules_DATA = caribou-gtk-module.desktop
 endif
 
 EXTRA_DIST = caribou-gtk-module.desktop
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/gtk2/Makefile.am b/modules/gtk2/Makefile.am
index 83019e5..049cc82 100644
--- a/modules/gtk2/Makefile.am
+++ b/modules/gtk2/Makefile.am
@@ -34,3 +34,9 @@ libcaribou_gtk_module_la_LDFLAGS = \
 EXTRA_DIST = \
 	vapi-fixes.vapi \
 	$(NULL)
+
+GITIGNOREFILES = \
+        $(libcaribou_gtk_module_la_SOURCES:.vala=.c) \
+        libcaribou_gtk_module_la_vala.stamp
+
+-include $(top_srcdir)/git.mk
diff --git a/modules/gtk3/Makefile.am b/modules/gtk3/Makefile.am
index e2d819b..7b0cfa9 100644
--- a/modules/gtk3/Makefile.am
+++ b/modules/gtk3/Makefile.am
@@ -33,3 +33,9 @@ libcaribou_gtk_module_la_LDFLAGS = \
 EXTRA_DIST = \
 	vapi-fixes.vapi \
 	$(NULL)
+
+GITIGNOREFILES = \
+        $(libcaribou_gtk_module_la_SOURCES:.vala=.c) \
+        libcaribou_gtk_module_la_vala.stamp
+
+-include $(top_srcdir)/git.mk
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 407519d..ba84708 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -2,3 +2,5 @@ EXTRA_DIST = \
 	fix_gir.py \
 	make_schema.py \
 	basic.xsl
+
+-include $(top_srcdir)/git.mk



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