michael@0: # git.mk michael@0: # michael@0: # Copyright 2009, Red Hat, Inc. michael@0: # Written by Behdad Esfahbod michael@0: # michael@0: # Copying and distribution of this file, with or without modification, michael@0: # are permitted in any medium without royalty provided the copyright michael@0: # notice and this notice are preserved. michael@0: # michael@0: # The canonical source for this file is pango/git.mk, or whereever the michael@0: # header of pango/git.mk suggests in the future. michael@0: # michael@0: # To use in your project, import this file in your git repo's toplevel, michael@0: # then do "make -f git.mk". This modifies all Makefile.am files in michael@0: # your project to include git.mk. michael@0: # michael@0: # This enables automatic .gitignore generation. If you need to ignore michael@0: # more files, add them to the GITIGNOREFILES variable in your Makefile.am. michael@0: # But think twice before doing that. If a file has to be in .gitignore, michael@0: # chances are very high that it's a generated file and should be in one michael@0: # of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. michael@0: # michael@0: # The only case that you need to manually add a file to GITIGNOREFILES is michael@0: # when remove files in one of mostlyclean-local, clean-local, distclean-local, michael@0: # or maintainer-clean-local. michael@0: # michael@0: # Note that for files like editor backup, etc, there are better places to michael@0: # ignore them. See "man gitignore". michael@0: # michael@0: # If "make maintainer-clean" removes the files but they are not recognized michael@0: # by this script (that is, if "git status" shows untracked files still), send michael@0: # me the output of "git status" as well as your Makefile.am and Makefile for michael@0: # the directories involved. michael@0: # michael@0: # For a list of toplevel files that should be in MAINTAINERCLEANFILES, see michael@0: # pango/Makefile.am. michael@0: # michael@0: # Don't EXTRA_DIST this file. It is supposed to only live in git clones, michael@0: # not tarballs. It serves no useful purpose in tarballs and clutters the michael@0: # build dir. michael@0: # michael@0: # This file knows how to handle autoconf, automake, libtool, gtk-doc, michael@0: # gnome-doc-utils, intltool. michael@0: # michael@0: # michael@0: # KNOWN ISSUES: michael@0: # michael@0: # - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the michael@0: # submodule doesn't find us. If you have configure.{in,ac} files in michael@0: # subdirs, add a proxy git.mk file in those dirs that simply does: michael@0: # "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. michael@0: # And add those files to git. See vte/gnome-pty-helper/git.mk for michael@0: # example. michael@0: # michael@0: michael@0: git-all: git-mk-install michael@0: michael@0: git-mk-install: michael@0: @echo Installing git makefile michael@0: @any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \ michael@0: if grep 'include .*/git.mk' $$x >/dev/null; then \ michael@0: echo $$x already includes git.mk; \ michael@0: else \ michael@0: failed=; \ michael@0: echo "Updating $$x"; \ michael@0: { cat $$x; \ michael@0: echo ''; \ michael@0: echo '-include $$(top_srcdir)/git.mk'; \ michael@0: } > $$x.tmp || failed=1; \ michael@0: if test x$$failed = x; then \ michael@0: mv $$x.tmp $$x || failed=1; \ michael@0: fi; \ michael@0: if test x$$failed = x; then : else \ michael@0: echo Failed updating $$x; >&2 \ michael@0: any_failed=1; \ michael@0: fi; \ michael@0: fi; done; test -z "$$any_failed" michael@0: michael@0: .PHONY: git-all git-mk-install michael@0: michael@0: michael@0: ### .gitignore generation michael@0: michael@0: $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk michael@0: $(AM_V_GEN) \ michael@0: { \ michael@0: if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ michael@0: for x in \ michael@0: $(DOC_MODULE)-decl-list.txt \ michael@0: $(DOC_MODULE)-decl.txt \ michael@0: tmpl/$(DOC_MODULE)-unused.sgml \ michael@0: "tmpl/*.bak" \ michael@0: xml html \ michael@0: ; do echo /$$x; done; \ michael@0: fi; \ michael@0: if test "x$(DOC_MODULE)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ michael@0: for x in \ michael@0: $(_DOC_C_DOCS) \ michael@0: $(_DOC_LC_DOCS) \ michael@0: $(_DOC_OMF_ALL) \ michael@0: $(_DOC_DSK_ALL) \ michael@0: $(_DOC_HTML_ALL) \ michael@0: $(_DOC_POFILES) \ michael@0: "*/.xml2po.mo" \ michael@0: "*/*.omf.out" \ michael@0: ; do echo /$$x; done; \ michael@0: fi; \ michael@0: if test -f $(srcdir)/po/Makefile.in.in; then \ michael@0: for x in \ michael@0: po/Makefile.in.in \ michael@0: po/Makefile.in \ michael@0: po/Makefile \ michael@0: po/POTFILES \ michael@0: po/stamp-it \ michael@0: po/.intltool-merge-cache \ michael@0: "po/*.gmo" \ michael@0: "po/*.mo" \ michael@0: po/$(GETTEXT_PACKAGE).pot \ michael@0: intltool-extract.in \ michael@0: intltool-merge.in \ michael@0: intltool-update.in \ michael@0: ; do echo /$$x; done; \ michael@0: fi; \ michael@0: if test -f $(srcdir)/configure; then \ michael@0: for x in \ michael@0: autom4te.cache \ michael@0: configure \ michael@0: config.h \ michael@0: stamp-h1 \ michael@0: libtool \ michael@0: config.lt \ michael@0: ; do echo /$$x; done; \ michael@0: fi; \ michael@0: for x in \ michael@0: .gitignore \ michael@0: $(GITIGNOREFILES) \ michael@0: $(CLEANFILES) \ michael@0: $(PROGRAMS) \ michael@0: $(check_PROGRAMS) \ michael@0: $(EXTRA_PROGRAMS) \ michael@0: $(LTLIBRARIES) \ michael@0: so_locations \ michael@0: .libs _libs \ michael@0: $(MOSTLYCLEANFILES) \ michael@0: "*.$(OBJEXT)" \ michael@0: "*.lo" \ michael@0: $(DISTCLEANFILES) \ michael@0: $(am__CONFIG_DISTCLEAN_FILES) \ michael@0: $(CONFIG_CLEAN_FILES) \ michael@0: TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ michael@0: "*.tab.c" \ michael@0: $(MAINTAINERCLEANFILES) \ michael@0: $(BUILT_SOURCES) \ michael@0: $(DEPDIR) \ michael@0: Makefile \ michael@0: Makefile.in \ michael@0: "*.orig" \ michael@0: "*.rej" \ michael@0: "*.bak" \ michael@0: "*~" \ michael@0: ".*.sw[nop]" \ michael@0: ; do echo /$$x; done; \ michael@0: } | \ michael@0: sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ michael@0: sed 's@/[.]/@/@g' | \ michael@0: LC_ALL=C sort | uniq > $@.tmp && \ michael@0: mv $@.tmp $@; michael@0: michael@0: all: $(srcdir)/.gitignore gitignore-recurse-maybe michael@0: gitignore-recurse-maybe: michael@0: @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \ michael@0: $(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \ michael@0: fi; michael@0: gitignore-recurse: michael@0: @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ michael@0: test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \ michael@0: done michael@0: gitignore: $(srcdir)/.gitignore gitignore-recurse michael@0: michael@0: maintainer-clean: gitignore-clean michael@0: gitignore-clean: michael@0: -rm -f $(srcdir)/.gitignore michael@0: michael@0: .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe