3 # Copyright 2009 Red Hat, Inc.
4 # Written by Behdad Esfahbod
6 # The canonical source for this file is pango/git.mk, or whereever the
7 # header of pango/git.mk suggests in the future.
9 # To use in your project, import this file in your git repo's toplevel,
10 # then do "make -f git.mk". This modifies all Makefile.am files in
11 # your project to include git.mk.
13 # This enables automatic .gitignore generation. If you need to ignore
14 # more files, add them to the GITIGNOREFILES variable in your Makefile.am.
15 # But think twice before doing that. If a file has to be in .gitignore,
16 # chances are very high that it's a generated file and should be in one
17 # of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
19 # The only case that you need to manually add a file to GITIGNOREFILES is
20 # when remove files in one of mostlyclean-local, clean-local, distclean-local,
21 # or maintainer-clean-local.
23 # Note that for files like editor backup, etc, there are better places to
24 # ignore them. See "man gitignore".
26 # If "make maintainer-clean" removes the files but they are not recognized
27 # by this script (that is, if "git stat" shows untracked files still), send
28 # me the output of "git stat" as well as your Makefile.am and Makefile for
29 # the directories involved.
31 # For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
34 # Don't EXTRA_DIST this file. It is supposed to only live in git clones,
35 # not tarballs. It serves no useful purpose in tarballs and clutters the
41 # - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
42 # submodule doesn't find us. If you have configure.{in,ac} files in
43 # subdirs, add a proxy git.mk file in those dirs that simply does:
44 # "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
45 # And add those files to git. See vte/gnome-pty-helper/git.mk for
49 git-all: git-mk-install
52 @echo Installing git makefile
53 @any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \
54 if grep 'include .*/git.mk' $$x >/dev/null; then \
55 echo $$x already includes git.mk; \
58 echo "Updating $$x"; \
61 echo '-include $$(top_srcdir)/git.mk'; \
62 } > $$x.tmp || failed=1; \
63 if test x$$failed = x; then \
64 mv $$x.tmp $$x || failed=1; \
66 if test x$$failed = x; then : else \
67 echo Failed updating $$x; >&2 \
70 fi; done; test -z "$$any_failed"
72 .PHONY: git-all git-mk-install
75 ### .gitignore generation
77 .gitignore: Makefile.am $(top_srcdir)/git.mk
78 @echo Generating $@; \
79 GTKDOCGITIGNOREFILES=; test "x$(DOC_MODULE)" = x || \
80 GTKDOCGITIGNOREFILES=" \
81 $(DOC_MODULE)-decl-list.txt \
82 $(DOC_MODULE)-decl.txt \
83 tmpl/$(DOC_MODULE)-unused.sgml \
87 INTLTOOLGITIGNOREFILES=; test -f $(srcdir)/po/Makefile.in.in && \
88 INTLTOOLGITIGNOREFILES=" \
100 AUTOCONFGITIGNOREFILES=; test -f $(srcdir)/configure && \
101 AUTOCONFGITIGNOREFILES=" \
111 $$GTKDOCGITIGNOREFILES \
112 $$INTLTOOLGITIGNOREFILES \
113 $$AUTOCONFGITIGNOREFILES \
121 $(MOSTLYCLEANFILES) \
125 $(am__CONFIG_DISTCLEAN_FILES) \
126 $(CONFIG_CLEAN_FILES) \
127 TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
129 $(MAINTAINERCLEANFILES) \
138 ; do echo /$$x; done | \
139 grep -v '/[.][.]/' | \
140 sed 's@/[.]/@/@g' | \
141 LANG=C sort | uniq > $@.tmp && \
144 all: .gitignore gitignore-recurse
146 @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
147 list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
148 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore); \
151 maintainer-clean-local: gitignore-clean
154 .PHONY: gitignore-clean gitignore-recurse