Automatically generate .gitignore files with git.mk

Add git.mk and include it in all Makefiles to generate .gitignore files
This commit is contained in:
Thomas Wood 2009-07-16 00:38:51 +01:00
parent 2aa0c3ed1b
commit 5d882a3bdd
25 changed files with 228 additions and 9 deletions

8
.gitignore vendored
View file

@ -1,8 +0,0 @@
Makefile
Makefile.in
po/*.gmo
*.deps
*.libs
*.o
*.lo
*.la

View file

@ -18,3 +18,5 @@ EXTRA_DIST = \
gnome-doc-utils.make gnome-doc-utils.make
DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper --disable-update-mimedb DISTCHECK_CONFIGURE_FLAGS = --disable-scrollkeeper --disable-update-mimedb
-include $(top_srcdir)/git.mk

View file

@ -21,3 +21,5 @@ endif
DIST_SUBDIRS = \ DIST_SUBDIRS = \
$(always_built_SUBDIRS) display about-me $(always_built_SUBDIRS) display about-me
-include $(top_srcdir)/git.mk

View file

@ -57,3 +57,5 @@ endif # BUILD_ABOUTME
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(MARSHALFILES) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(desktop_DATA) $(MARSHALFILES)
EXTRA_DIST = $(glade_files) fprintd-marshal.list EXTRA_DIST = $(glade_files) fprintd-marshal.list
-include $(top_srcdir)/git.mk

View file

@ -14,3 +14,5 @@ pixmaps_DATA = \
right-thumb.svg right-thumb.svg
EXTRA_DIST = $(pixmaps_DATA) EXTRA_DIST = $(pixmaps_DATA)
-include $(top_srcdir)/git.mk

View file

@ -1 +1,3 @@
SUBDIRS = at-properties SUBDIRS = at-properties
-include $(top_srcdir)/git.mk

View file

@ -27,3 +27,5 @@ INCLUDES = $(AT_CAPPLET_CFLAGS) \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" -DGNOMELOCALEDIR="\"$(datadir)/locale\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
EXTRA_DIST = $(ui_DATA) $(pixmap_DATA) EXTRA_DIST = $(ui_DATA) $(pixmap_DATA)
-include $(top_srcdir)/git.mk

View file

@ -58,3 +58,5 @@ INCLUDES = \
-DWALLPAPER_DATADIR="\"$(wallpaperdir)\"" -DWALLPAPER_DATADIR="\"$(wallpaperdir)\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES)
-include $(top_srcdir)/git.mk

View file

@ -57,3 +57,5 @@ EXTRA_DIST = $(xml_in_files)
CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(mime_DATA) CLEANFILES = $(desktop_in_files) $(desktop_DATA) $(mime_DATA)
-include $(top_srcdir)/git.mk

View file

@ -59,3 +59,5 @@ gnome_theme_test_LDADD = \
noinst_PROGRAMS = \ noinst_PROGRAMS = \
gnome-theme-test gnome-theme-test
-include $(top_srcdir)/git.mk

View file

@ -71,3 +71,5 @@ update-icon-cache:
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) $(xmldata_DATA) $(autostart_DATA) $(bin_SCRIPTS) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) $(xmldata_DATA) $(autostart_DATA) $(bin_SCRIPTS)
EXTRA_DIST = $(xmldata_in_files) gnome-default-applications.pc.in EXTRA_DIST = $(xmldata_in_files) gnome-default-applications.pc.in
-include $(top_srcdir)/git.mk

View file

@ -54,3 +54,5 @@ update-icon-cache:
echo "*** Icon cache not updated. After (un)install, run this:"; \ echo "*** Icon cache not updated. After (un)install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \ echo "*** $(gtk_update_icon_cache)"; \
fi fi
-include $(top_srcdir)/git.mk

View file

@ -42,3 +42,5 @@ CLEANFILES = \
$(xml_DATA) $(xml_DATA)
EXTRA_DIST = $(ui_DATA) $(xml_in_files) gnome-keybindings.pc.in EXTRA_DIST = $(ui_DATA) $(xml_in_files) gnome-keybindings.pc.in
-include $(top_srcdir)/git.mk

View file

@ -34,3 +34,5 @@ INCLUDES = \
-DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\"" -DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
EXTRA_DIST = $(Glade_DATA) EXTRA_DIST = $(Glade_DATA)
-include $(top_srcdir)/git.mk

View file

@ -23,4 +23,5 @@ INCLUDES = \
-DGNOMELOCALEDIR="\"$(datadir)/locale\"" \ -DGNOMELOCALEDIR="\"$(datadir)/locale\"" \
-DGNOMECC_DATA_DIR="\"$(pkgdatadir)\"" -DGNOMECC_DATA_DIR="\"$(pkgdatadir)\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
-include $(top_srcdir)/git.mk

View file

@ -31,3 +31,5 @@ INCLUDES = \
-DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\"" -DGNOMECC_GLADE_DIR="\"$(pkgdatadir)/glade\""
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
EXTRA_DIST = $(Glade_DATA) $(pixmap_DATA) EXTRA_DIST = $(Glade_DATA) $(pixmap_DATA)
-include $(top_srcdir)/git.mk

View file

@ -46,3 +46,5 @@ update-icon-cache:
fi fi
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(desktop_in_files) $(desktop_DATA)
-include $(top_srcdir)/git.mk

View file

@ -28,3 +28,5 @@ INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) \
CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) $(Desktop_in_files) $(desktop_DATA)
EXTRA_DIST = $(ui_DATA) EXTRA_DIST = $(ui_DATA)
-include $(top_srcdir)/git.mk

View file

@ -44,3 +44,5 @@ CLEANFILES = $(desktop_in_files) $(desktop_DATA) \
EXTRA_DIST = \ EXTRA_DIST = \
fontilus.schemas.in \ fontilus.schemas.in \
gnome-font-viewer.desktop.in.in gnome-font-viewer.desktop.in.in
-include $(top_srcdir)/git.mk

182
git.mk Normal file
View file

@ -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

View file

@ -6,3 +6,5 @@ DOC_ENTITIES = config-accessibility-keyboard.xml config-background.xml config-be
DOC_INCLUDES = DOC_INCLUDES =
DOC_LINGUAS = ca ca@valencia cs de el en_GB es fr it ja oc pa pl pt pt_BR ru sv uk vi zh_CN DOC_LINGUAS = ca ca@valencia cs de el en_GB es fr it ja oc pa pl pt pt_BR ru sv uk vi zh_CN
-include $(top_srcdir)/git.mk

View file

@ -103,3 +103,5 @@ CLEANFILES = \
EXTRA_DIST= \ EXTRA_DIST= \
search-entry-watermark.svg \ search-entry-watermark.svg \
nld-marshal.list nld-marshal.list
-include $(top_srcdir)/git.mk

View file

@ -52,3 +52,5 @@ libmetacity_la_LDFLAGS = $(wms_flags)
libmetacity_la_LIBADD = \ libmetacity_la_LIBADD = \
$(GNOMECC_LIBS) \ $(GNOMECC_LIBS) \
libgnome-window-settings.la libgnome-window-settings.la
-include $(top_srcdir)/git.mk

View file

@ -43,3 +43,5 @@ menu_DATA = gnomecc.menu
EXTRA_DIST = gnomecc.desktop.in.in gnomecc.directory.in gnomecc.menu $(schemas_DATA).in EXTRA_DIST = gnomecc.desktop.in.in gnomecc.directory.in gnomecc.menu $(schemas_DATA).in
DISTCLEANFILES = gnomecc.desktop gnomecc.desktop.in gnomecc.directory $(schemas_DATA) DISTCLEANFILES = gnomecc.desktop gnomecc.desktop.in gnomecc.directory $(schemas_DATA)
-include $(top_srcdir)/git.mk

View file

@ -47,3 +47,5 @@ update-icon-cache:
echo "*** Icon cache not updated. After (un)install, run this:"; \ echo "*** Icon cache not updated. After (un)install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \ echo "*** $(gtk_update_icon_cache)"; \
fi fi
-include $(top_srcdir)/git.mk