Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 1 | # git.mk |
| 2 | # |
| 3 | # Copyright 2009, Red Hat, Inc. |
| 4 | # Copyright 2010,2011 Behdad Esfahbod |
| 5 | # Written by Behdad Esfahbod |
| 6 | # |
| 7 | # Copying and distribution of this file, with or without modification, |
| 8 | # is permitted in any medium without royalty provided the copyright |
| 9 | # notice and this notice are preserved. |
| 10 | # |
| 11 | # The latest version of this file can be downloaded from: |
| 12 | # https://raw.github.com/behdad/git.mk/master/git.mk |
| 13 | # Bugs, etc, should be reported upstream at: |
| 14 | # https://github.com/behdad/git.mk |
| 15 | # |
| 16 | # To use in your project, import this file in your git repo's toplevel, |
| 17 | # then do "make -f git.mk". This modifies all Makefile.am files in |
| 18 | # your project to -include git.mk. Remember to add that line to new |
| 19 | # Makefile.am files you create in your project, or just rerun the |
| 20 | # "make -f git.mk". |
| 21 | # |
| 22 | # This enables automatic .gitignore generation. If you need to ignore |
| 23 | # more files, add them to the GITIGNOREFILES variable in your Makefile.am. |
| 24 | # But think twice before doing that. If a file has to be in .gitignore, |
| 25 | # chances are very high that it's a generated file and should be in one |
| 26 | # of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES. |
| 27 | # |
| 28 | # The only case that you need to manually add a file to GITIGNOREFILES is |
| 29 | # when remove files in one of mostlyclean-local, clean-local, distclean-local, |
| 30 | # or maintainer-clean-local make targets. |
| 31 | # |
| 32 | # Note that for files like editor backup, etc, there are better places to |
| 33 | # ignore them. See "man gitignore". |
| 34 | # |
| 35 | # If "make maintainer-clean" removes the files but they are not recognized |
| 36 | # by this script (that is, if "git status" shows untracked files still), send |
| 37 | # me the output of "git status" as well as your Makefile.am and Makefile for |
| 38 | # the directories involved and I'll diagnose. |
| 39 | # |
| 40 | # For a list of toplevel files that should be in MAINTAINERCLEANFILES, see |
| 41 | # Makefile.am.sample in the git.mk git repo. |
| 42 | # |
| 43 | # Don't EXTRA_DIST this file. It is supposed to only live in git clones, |
| 44 | # not tarballs. It serves no useful purpose in tarballs and clutters the |
| 45 | # build dir. |
| 46 | # |
| 47 | # This file knows how to handle autoconf, automake, libtool, gtk-doc, |
| 48 | # gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu. |
| 49 | # |
| 50 | # This makefile provides the following targets: |
| 51 | # |
| 52 | # - all: "make all" will build all gitignore files. |
| 53 | # - gitignore: makes all gitignore files in the current dir and subdirs. |
| 54 | # - .gitignore: make gitignore file for the current dir. |
| 55 | # - gitignore-recurse: makes all gitignore files in the subdirs. |
| 56 | # |
| 57 | # KNOWN ISSUES: |
| 58 | # |
| 59 | # - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the |
| 60 | # submodule doesn't find us. If you have configure.{in,ac} files in |
| 61 | # subdirs, add a proxy git.mk file in those dirs that simply does: |
| 62 | # "include $(top_srcdir)/../git.mk". Add more ..'s to your taste. |
| 63 | # And add those files to git. See vte/gnome-pty-helper/git.mk for |
| 64 | # example. |
| 65 | # |
| 66 | |
| 67 | git-all: git-mk-install |
| 68 | |
| 69 | git-mk-install: |
| 70 | @echo Installing git makefile |
| 71 | @any_failed=; \ |
| 72 | find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \ |
| 73 | if grep 'include .*/git.mk' $$x >/dev/null; then \ |
| 74 | echo $$x already includes git.mk; \ |
| 75 | else \ |
| 76 | failed=; \ |
| 77 | echo "Updating $$x"; \ |
| 78 | { cat $$x; \ |
| 79 | echo ''; \ |
| 80 | echo '-include $$(top_srcdir)/git.mk'; \ |
| 81 | } > $$x.tmp || failed=1; \ |
| 82 | if test x$$failed = x; then \ |
| 83 | mv $$x.tmp $$x || failed=1; \ |
| 84 | fi; \ |
| 85 | if test x$$failed = x; then : else \ |
| 86 | echo Failed updating $$x; >&2 \ |
| 87 | any_failed=1; \ |
| 88 | fi; \ |
| 89 | fi; done; test -z "$$any_failed" |
| 90 | |
| 91 | .PHONY: git-all git-mk-install |
| 92 | |
| 93 | |
| 94 | ### .gitignore generation |
| 95 | |
| 96 | $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk |
| 97 | $(AM_V_GEN) \ |
| 98 | { \ |
| 99 | if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \ |
| 100 | for x in \ |
| 101 | $(DOC_MODULE)-decl-list.txt \ |
| 102 | $(DOC_MODULE)-decl.txt \ |
| 103 | tmpl/$(DOC_MODULE)-unused.sgml \ |
| 104 | "tmpl/*.bak" \ |
| 105 | xml html \ |
| 106 | ; do echo /$$x; done; \ |
| 107 | fi; \ |
| 108 | if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \ |
| 109 | for lc in $(DOC_LINGUAS); do \ |
| 110 | for x in \ |
| 111 | $(if $(DOC_MODULE),$(DOC_MODULE).xml) \ |
| 112 | $(DOC_PAGES) \ |
| 113 | $(DOC_INCLUDES) \ |
| 114 | ; do echo /$$lc/$$x; done; \ |
| 115 | done; \ |
| 116 | for x in \ |
| 117 | $(_DOC_OMF_ALL) \ |
| 118 | $(_DOC_DSK_ALL) \ |
| 119 | $(_DOC_HTML_ALL) \ |
| 120 | $(_DOC_MOFILES) \ |
| 121 | $(DOC_H_FILE) \ |
| 122 | "*/.xml2po.mo" \ |
| 123 | "*/*.omf.out" \ |
| 124 | ; do echo /$$x; done; \ |
| 125 | fi; \ |
| 126 | if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \ |
| 127 | for lc in $(HELP_LINGUAS); do \ |
| 128 | for x in \ |
| 129 | $(HELP_FILES) \ |
| 130 | "$$lc.stamp" \ |
| 131 | "$$lc.mo" \ |
| 132 | ; do echo /$$lc/$$x; done; \ |
| 133 | done; \ |
| 134 | fi; \ |
| 135 | if test "x$(gsettings_SCHEMAS)" = x; then :; else \ |
| 136 | for x in \ |
| 137 | $(gsettings_SCHEMAS:.xml=.valid) \ |
| 138 | $(gsettings__enum_file) \ |
| 139 | ; do echo /$$x; done; \ |
| 140 | fi; \ |
| 141 | if test -f $(srcdir)/po/Makefile.in.in; then \ |
| 142 | for x in \ |
| 143 | po/Makefile.in.in \ |
| 144 | po/Makefile.in \ |
| 145 | po/Makefile \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 146 | po/Makevars.template \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 147 | po/POTFILES \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 148 | po/Rules-quot \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 149 | po/stamp-it \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 150 | po/stamp-po \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 151 | po/.intltool-merge-cache \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 152 | "po/*~" \ |
| 153 | "po/*.header" \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 154 | "po/*.gmo" \ |
| 155 | "po/*.mo" \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 156 | "po/*.sed" \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 157 | "po/*.sin" \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 158 | po/$(GETTEXT_PACKAGE).pot \ |
| 159 | intltool-extract.in \ |
| 160 | intltool-merge.in \ |
| 161 | intltool-update.in \ |
| 162 | ; do echo /$$x; done; \ |
| 163 | fi; \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 164 | if test -f $(srcdir)/po-conf/Makefile.in.in; then \ |
| 165 | for x in \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 166 | po-conf/Makefile.in.in \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 167 | po-conf/Makefile.in \ |
| 168 | po-conf/Makefile \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 169 | po-conf/Makevars.template \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 170 | po-conf/POTFILES \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 171 | po-conf/Rules-quot \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 172 | po-conf/stamp-it \ |
| 173 | po-conf/stamp-po \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 174 | "po-conf/*~" \ |
| 175 | "po-conf/*.header" \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 176 | "po-conf/*.gmo" \ |
| 177 | "po-conf/*.mo" \ |
| 178 | "po-conf/*.sed" \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 179 | "po-conf/*.sin" \ |
Akira TAGOH | 9a0fcb9 | 2014-03-27 15:10:44 +0900 | [diff] [blame] | 180 | po-conf/$(GETTEXT_PACKAGE)-conf.pot \ |
| 181 | ; do echo /$$x; done; \ |
| 182 | fi; \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 183 | if test -f $(srcdir)/configure; then \ |
| 184 | for x in \ |
| 185 | autom4te.cache \ |
| 186 | configure \ |
| 187 | config.h \ |
| 188 | stamp-h1 \ |
| 189 | libtool \ |
| 190 | config.lt \ |
Akira TAGOH | da071b3 | 2017-11-15 16:34:02 +0900 | [diff] [blame] | 191 | config.rpath \ |
Behdad Esfahbod | ed41b23 | 2012-10-06 17:52:39 -0400 | [diff] [blame] | 192 | ; do echo /$$x; done; \ |
| 193 | fi; \ |
| 194 | if test "x$(DEJATOOL)" = x; then :; else \ |
| 195 | for x in \ |
| 196 | $(DEJATOOL) \ |
| 197 | ; do echo /$$x.sum; echo /$$x.log; done; \ |
| 198 | echo /site.exp; \ |
| 199 | fi; \ |
| 200 | for x in \ |
| 201 | .gitignore \ |
| 202 | $(GITIGNOREFILES) \ |
| 203 | $(CLEANFILES) \ |
| 204 | $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \ |
| 205 | $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \ |
| 206 | $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \ |
| 207 | so_locations \ |
| 208 | .libs _libs \ |
| 209 | $(MOSTLYCLEANFILES) \ |
| 210 | "*.$(OBJEXT)" \ |
| 211 | "*.lo" \ |
| 212 | $(DISTCLEANFILES) \ |
| 213 | $(am__CONFIG_DISTCLEAN_FILES) \ |
| 214 | $(CONFIG_CLEAN_FILES) \ |
| 215 | TAGS ID GTAGS GRTAGS GSYMS GPATH tags \ |
| 216 | "*.tab.c" \ |
| 217 | $(MAINTAINERCLEANFILES) \ |
| 218 | $(BUILT_SOURCES) \ |
| 219 | $(DEPDIR) \ |
| 220 | Makefile \ |
| 221 | Makefile.in \ |
| 222 | "*.orig" \ |
| 223 | "*.rej" \ |
| 224 | "*.bak" \ |
| 225 | "*~" \ |
| 226 | ".*.sw[nop]" \ |
| 227 | ".dirstamp" \ |
| 228 | ; do echo /$$x; done; \ |
| 229 | } | \ |
| 230 | sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \ |
| 231 | sed 's@/[.]/@/@g' | \ |
| 232 | LC_ALL=C sort | uniq > $@.tmp && \ |
| 233 | mv $@.tmp $@; |
| 234 | |
| 235 | all: $(srcdir)/.gitignore gitignore-recurse-maybe |
| 236 | gitignore: $(srcdir)/.gitignore gitignore-recurse |
| 237 | |
| 238 | gitignore-recurse-maybe: |
| 239 | @for subdir in $(DIST_SUBDIRS); do \ |
| 240 | case " $(SUBDIRS) " in \ |
| 241 | *" $$subdir "*) :;; \ |
| 242 | *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \ |
| 243 | esac; \ |
| 244 | done |
| 245 | gitignore-recurse: |
| 246 | @for subdir in $(DIST_SUBDIRS); do \ |
| 247 | test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \ |
| 248 | done |
| 249 | |
| 250 | maintainer-clean: gitignore-clean |
| 251 | gitignore-clean: |
| 252 | -rm -f $(srcdir)/.gitignore |
| 253 | |
| 254 | .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe |