Blame git.mk

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