]> www.fi.muni.cz Git - evince.git/blob - git.mk
build: Update git.mk from master copy
[evince.git] / git.mk
1 # git.mk
2 #
3 # Copyright 2009, Red Hat, Inc.
4 # Written by Behdad Esfahbod
5 #
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.
9 #
10 # The canonical source for this file is pango/git.mk, or whereever the
11 # header of pango/git.mk suggests in the future.
12 #
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.
16 #
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.
22 #
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.
26 #
27 # Note that for files like editor backup, etc, there are better places to
28 # ignore them.  See "man gitignore".
29 #
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.
34 #
35 # For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
36 # pango/Makefile.am.
37 #
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
40 # build dir.
41 #
42 # This file knows how to handle autoconf, automake, libtool, gtk-doc,
43 # gnome-doc-utils, intltool, gsettings.
44 #
45 #
46 # KNOWN ISSUES:
47 #
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
53 #   example.
54 #
55
56 git-all: git-mk-install
57
58 git-mk-install:
59         @echo Installing git makefile
60         @any_failed=; find $(top_srcdir) -name Makefile.am | while read x; do \
61                 if grep 'include .*/git.mk' $$x >/dev/null; then \
62                         echo $$x already includes git.mk; \
63                 else \
64                         failed=; \
65                         echo "Updating $$x"; \
66                         { cat $$x; \
67                           echo ''; \
68                           echo '-include $$(top_srcdir)/git.mk'; \
69                         } > $$x.tmp || failed=1; \
70                         if test x$$failed = x; then \
71                                 mv $$x.tmp $$x || failed=1; \
72                         fi; \
73                         if test x$$failed = x; then : else \
74                                 echo Failed updating $$x; >&2 \
75                                 any_failed=1; \
76                         fi; \
77         fi; done; test -z "$$any_failed"
78
79 .PHONY: git-all git-mk-install
80
81
82 ### .gitignore generation
83
84 $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
85         $(AM_V_GEN) \
86         { \
87                 if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
88                         for x in \
89                                 $(DOC_MODULE)-decl-list.txt \
90                                 $(DOC_MODULE)-decl.txt \
91                                 tmpl/$(DOC_MODULE)-unused.sgml \
92                                 "tmpl/*.bak" \
93                                 xml html \
94                         ; do echo /$$x; done; \
95                 fi; \
96                 if test "x$(DOC_MODULE)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
97                         for x in \
98                                 $(_DOC_C_DOCS) \
99                                 $(_DOC_LC_DOCS) \
100                                 $(_DOC_OMF_ALL) \
101                                 $(_DOC_DSK_ALL) \
102                                 $(_DOC_HTML_ALL) \
103                                 $(_DOC_MOFILES) \
104                                 $(_DOC_POFILES) \
105                                 $(DOC_H_FILE) \
106                                 "*/.xml2po.mo" \
107                                 "*/*.omf.out" \
108                         ; do echo /$$x; done; \
109                 fi; \
110                 if test "x$(gsettings_SCHEMAS)" = x; then :; else \
111                         for x in \
112                                 $(gsettings_SCHEMAS:.xml=.valid) \
113                                 $(gsettings__enum_file) \
114                         ; do echo /$$x; done; \
115                 fi; \
116                 if test -f $(srcdir)/po/Makefile.in.in; then \
117                         for x in \
118                                 po/Makefile.in.in \
119                                 po/Makefile.in \
120                                 po/Makefile \
121                                 po/POTFILES \
122                                 po/stamp-it \
123                                 po/.intltool-merge-cache \
124                                 "po/*.gmo" \
125                                 "po/*.mo" \
126                                 po/$(GETTEXT_PACKAGE).pot \
127                                 intltool-extract.in \
128                                 intltool-merge.in \
129                                 intltool-update.in \
130                         ; do echo /$$x; done; \
131                 fi; \
132                 if test -f $(srcdir)/configure; then \
133                         for x in \
134                                 autom4te.cache \
135                                 configure \
136                                 config.h \
137                                 stamp-h1 \
138                                 libtool \
139                                 config.lt \
140                         ; do echo /$$x; done; \
141                 fi; \
142                 for x in \
143                         .gitignore \
144                         $(GITIGNOREFILES) \
145                         $(CLEANFILES) \
146                         $(PROGRAMS) \
147                         $(check_PROGRAMS) \
148                         $(EXTRA_PROGRAMS) \
149                         $(LTLIBRARIES) \
150                         so_locations \
151                         .libs _libs \
152                         $(MOSTLYCLEANFILES) \
153                         "*.$(OBJEXT)" \
154                         "*.lo" \
155                         $(DISTCLEANFILES) \
156                         $(am__CONFIG_DISTCLEAN_FILES) \
157                         $(CONFIG_CLEAN_FILES) \
158                         TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
159                         "*.tab.c" \
160                         $(MAINTAINERCLEANFILES) \
161                         $(BUILT_SOURCES) \
162                         $(DEPDIR) \
163                         Makefile \
164                         Makefile.in \
165                         "*.orig" \
166                         "*.rej" \
167                         "*.bak" \
168                         "*~" \
169                         ".*.sw[nop]" \
170                         ".dirstamp" \
171                 ; do echo /$$x; done; \
172         } | \
173         sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
174         sed 's@/[.]/@/@g' | \
175         LC_ALL=C sort | uniq > $@.tmp && \
176         mv $@.tmp $@;
177
178 all: $(srcdir)/.gitignore gitignore-recurse-maybe
179 gitignore-recurse-maybe:
180         @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
181                 $(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
182         fi;
183 gitignore-recurse:
184         @for subdir in $(DIST_SUBDIRS); do \
185           case " $(SUBDIRS) " in \
186             *" $$subdir "*) :;; \
187             *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir");; \
188           esac; \
189         done
190 gitignore: $(srcdir)/.gitignore gitignore-recurse
191
192 maintainer-clean: gitignore-clean
193 gitignore-clean:
194         -rm -f $(srcdir)/.gitignore
195
196 .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe