3 # Copyright 2009, Red Hat, Inc.
4 # Written by Behdad Esfahbod
6 # Copying and distribution of this file, with or without modification,
7 # are permitted in any medium without royalty provided the copyright
8 # notice and this notice are preserved.
10 # The canonical source for this file is pango/git.mk, or whereever the
11 # header of pango/git.mk suggests in the future.
13 # To use in your project, import this file in your git repo's toplevel,
14 # then do "make -f git.mk". This modifies all Makefile.am files in
15 # your project to include git.mk.
17 # This enables automatic .gitignore generation. If you need to ignore
18 # more files, add them to the GITIGNOREFILES variable in your Makefile.am.
19 # But think twice before doing that. If a file has to be in .gitignore,
20 # chances are very high that it's a generated file and should be in one
21 # of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
23 # The only case that you need to manually add a file to GITIGNOREFILES is
24 # when remove files in one of mostlyclean-local, clean-local, distclean-local,
25 # or maintainer-clean-local.
27 # Note that for files like editor backup, etc, there are better places to
28 # ignore them. See "man gitignore".
30 # If "make maintainer-clean" removes the files but they are not recognized
31 # by this script (that is, if "git status" shows untracked files still), send
32 # me the output of "git status" as well as your Makefile.am and Makefile for
33 # the directories involved.
35 # For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
38 # Don't EXTRA_DIST this file. It is supposed to only live in git clones,
39 # not tarballs. It serves no useful purpose in tarballs and clutters the
42 # This file knows how to handle autoconf, automake, libtool, gtk-doc,
43 # gnome-doc-utils, mallard, intltool, gsettings.
48 # - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
49 # submodule doesn't find us. If you have configure.{in,ac} files in
50 # subdirs, add a proxy git.mk file in those dirs that simply does:
51 # "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
52 # And add those files to git. See vte/gnome-pty-helper/git.mk for
57 # - 2012-03-28 Use temporary file for docs to avoid hitting ARG_MAX
58 # - 2010-12-06 Add support for Mallard docs
59 # - 2010-12-06 Start this change log
61 git-all: git-mk-install
64 @echo Installing git makefile
65 @any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \
66 if grep 'include .*/git.mk' $$x >/dev/null; then \
67 echo $$x already includes git.mk; \
70 echo "Updating $$x"; \
73 echo '-include $$(top_srcdir)/git.mk'; \
74 } > $$x.tmp || failed=1; \
75 if test x$$failed = x; then \
76 mv $$x.tmp $$x || failed=1; \
78 if test x$$failed = x; then : else \
79 echo Failed updating $$x; >&2 \
82 fi; done; test -z "$$any_failed"
84 .PHONY: git-all git-mk-install
87 ### .gitignore generation
90 $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
91 @echo $(_DOC_C_DOCS) > $@.docs.tmp
92 @echo $(_DOC_LC_DOCS) >> $@.docs.tmp
93 @echo $(_DOC_OMF_ALL) >> $@.docs.tmp
94 @echo $(_DOC_DSK_ALL) >> $@.docs.tmp
95 @echo $(_DOC_HTML_ALL) >> $@.docs.tmp
98 if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
100 $(DOC_MODULE)-decl-list.txt \
101 $(DOC_MODULE)-decl.txt \
102 tmpl/$(DOC_MODULE)-unused.sgml \
105 ; do echo /$$x; done; \
107 if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
109 $$(cat $@.docs.tmp) \
115 ; do echo /$$x; done; \
117 if test "x$(gsettings_SCHEMAS)" = x; then :; else \
119 $(gsettings_SCHEMAS:.xml=.valid) \
120 $(gsettings__enum_file) \
121 ; do echo /$$x; done; \
123 if test -f $(srcdir)/po/Makefile.in.in; then \
130 po/.intltool-merge-cache \
133 po/$(GETTEXT_PACKAGE).pot \
134 intltool-extract.in \
137 ; do echo /$$x; done; \
139 if test -f $(srcdir)/configure; then \
147 ; do echo /$$x; done; \
159 $(MOSTLYCLEANFILES) \
163 $(am__CONFIG_DISTCLEAN_FILES) \
164 $(CONFIG_CLEAN_FILES) \
165 TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
167 $(MAINTAINERCLEANFILES) \
178 ; do echo /$$x; done; \
180 sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
181 sed 's@/[.]/@/@g' | \
182 LC_ALL=C sort | uniq > $@.tmp && \
186 all: $(srcdir)/.gitignore gitignore-recurse-maybe
187 gitignore-recurse-maybe:
188 @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
189 $(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
192 @for subdir in $(DIST_SUBDIRS); do \
193 case " $(SUBDIRS) " in \
194 *" $$subdir "*) :;; \
195 *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \
198 gitignore: $(srcdir)/.gitignore gitignore-recurse
200 maintainer-clean: gitignore-clean
202 -rm -f $(srcdir)/.gitignore
204 .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe