mkdb: readd space in error message
[gtk-doc.git] / git.mk
blob9d4bf2511e25fded471861fca142789b0a0a0418
1 # git.mk, a small Makefile to autogenerate .gitignore files
2 # for autotools-based projects.
4 # Copyright 2009, Red Hat, Inc.
5 # Copyright 2010,2011,2012,2013 Behdad Esfahbod
6 # Written by Behdad Esfahbod
8 # Copying and distribution of this file, with or without modification,
9 # is permitted in any medium without royalty provided the copyright
10 # notice and this notice are preserved.
12 # The latest version of this file can be downloaded from:
13 GIT_MK_URL = https://raw.githubusercontent.com/behdad/git.mk/master/git.mk
15 # Bugs, etc, should be reported upstream at:
16 # https://github.com/behdad/git.mk
18 # To use in your project, import this file in your git repo's toplevel,
19 # then do "make -f git.mk". This modifies all Makefile.am files in
20 # your project to -include git.mk. Remember to add that line to new
21 # Makefile.am files you create in your project, or just rerun the
22 # "make -f git.mk".
24 # This enables automatic .gitignore generation. If you need to ignore
25 # more files, add them to the GITIGNOREFILES variable in your Makefile.am.
26 # But think twice before doing that. If a file has to be in .gitignore,
27 # chances are very high that it's a generated file and should be in one
28 # of MOSTLYCLEANFILES, CLEANFILES, DISTCLEANFILES, or MAINTAINERCLEANFILES.
30 # The only case that you need to manually add a file to GITIGNOREFILES is
31 # when remove files in one of mostlyclean-local, clean-local, distclean-local,
32 # or maintainer-clean-local make targets.
34 # Note that for files like editor backup, etc, there are better places to
35 # ignore them. See "man gitignore".
37 # If "make maintainer-clean" removes the files but they are not recognized
38 # by this script (that is, if "git status" shows untracked files still), send
39 # me the output of "git status" as well as your Makefile.am and Makefile for
40 # the directories involved and I'll diagnose.
42 # For a list of toplevel files that should be in MAINTAINERCLEANFILES, see
43 # Makefile.am.sample in the git.mk git repo.
45 # Don't EXTRA_DIST this file. It is supposed to only live in git clones,
46 # not tarballs. It serves no useful purpose in tarballs and clutters the
47 # build dir.
49 # This file knows how to handle autoconf, automake, libtool, gtk-doc,
50 # gnome-doc-utils, yelp.m4, mallard, intltool, gsettings, dejagnu, appdata,
51 # appstream.
53 # This makefile provides the following targets:
55 # - all: "make all" will build all gitignore files.
56 # - gitignore: makes all gitignore files in the current dir and subdirs.
57 # - .gitignore: make gitignore file for the current dir.
58 # - gitignore-recurse: makes all gitignore files in the subdirs.
60 # KNOWN ISSUES:
62 # - Recursive configure doesn't work as $(top_srcdir)/git.mk inside the
63 # submodule doesn't find us. If you have configure.{in,ac} files in
64 # subdirs, add a proxy git.mk file in those dirs that simply does:
65 # "include $(top_srcdir)/../git.mk". Add more ..'s to your taste.
66 # And add those files to git. See vte/gnome-pty-helper/git.mk for
67 # example.
72 ###############################################################################
73 # Variables user modules may want to add to toplevel MAINTAINERCLEANFILES:
74 ###############################################################################
77 # Most autotools-using modules should be fine including this variable in their
78 # toplevel MAINTAINERCLEANFILES:
79 GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \
80 $(srcdir)/aclocal.m4 \
81 $(srcdir)/autoscan.log \
82 $(srcdir)/configure.scan \
83 `AUX_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_AUX_DIR:$$1' ./configure.ac); \
84 test "x$$AUX_DIR" = "x$(srcdir)/" && AUX_DIR=$(srcdir); \
85 for x in \
86 ar-lib \
87 compile \
88 config.guess \
89 config.sub \
90 depcomp \
91 install-sh \
92 ltmain.sh \
93 missing \
94 mkinstalldirs \
95 test-driver \
96 ylwrap \
97 ; do echo "$$AUX_DIR/$$x"; done` \
98 `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_HEADERS:$$1' ./configure.ac | \
99 head -n 1 | while read f; do echo "$(srcdir)/$$f.in"; done`
101 # All modules should also be fine including the following variable, which
102 # removes automake-generated Makefile.in files:
103 GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \
104 `cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' ./configure.ac | \
105 while read f; do \
106 case $$f in Makefile|*/Makefile) \
107 test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \
108 done`
110 # Modules that use libtool and use AC_CONFIG_MACRO_DIR() may also include this,
111 # though it's harmless to include regardless.
112 GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \
113 `MACRO_DIR=$(srcdir)/$$(cd $(top_srcdir); $(AUTOCONF) --trace 'AC_CONFIG_MACRO_DIR:$$1' ./configure.ac); \
114 if test "x$$MACRO_DIR" != "x$(srcdir)/"; then \
115 for x in \
116 libtool.m4 \
117 ltoptions.m4 \
118 ltsugar.m4 \
119 ltversion.m4 \
120 lt~obsolete.m4 \
121 ; do echo "$$MACRO_DIR/$$x"; done; \
126 ###############################################################################
127 # Default rule is to install ourselves in all Makefile.am files:
128 ###############################################################################
130 git-all: git-mk-install
132 git-mk-install:
133 @echo "Installing git makefile"
134 @any_failed=; \
135 find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
136 if grep 'include .*/git.mk' $$x >/dev/null; then \
137 echo "$$x already includes git.mk"; \
138 else \
139 failed=; \
140 echo "Updating $$x"; \
141 { cat $$x; \
142 echo ''; \
143 echo '-include $$(top_srcdir)/git.mk'; \
144 } > $$x.tmp || failed=1; \
145 if test x$$failed = x; then \
146 mv $$x.tmp $$x || failed=1; \
147 fi; \
148 if test x$$failed = x; then : else \
149 echo "Failed updating $$x"; >&2 \
150 any_failed=1; \
151 fi; \
152 fi; done; test -z "$$any_failed"
154 git-mk-update:
155 wget $(GIT_MK_URL) -O $(top_srcdir)/git.mk
157 .PHONY: git-all git-mk-install git-mk-update
161 ###############################################################################
162 # Actual .gitignore generation:
163 ###############################################################################
165 $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
166 @echo "git.mk: Generating $@"
167 @{ \
168 if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
169 for x in \
170 $(DOC_MODULE)-decl-list.txt \
171 $(DOC_MODULE)-decl.txt \
172 tmpl/$(DOC_MODULE)-unused.sgml \
173 "tmpl/*.bak" \
174 xml html \
175 ; do echo "/$$x"; done; \
176 FLAVOR=$$(cd $(top_srcdir); $(AUTOCONF) --trace 'GTK_DOC_CHECK:$$2' ./configure.ac); \
177 case $$FLAVOR in *no-tmpl*) echo /tmpl;; esac; \
178 fi; \
179 if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
180 for lc in $(DOC_LINGUAS); do \
181 for x in \
182 $(if $(DOC_MODULE),$(DOC_MODULE).xml) \
183 $(DOC_PAGES) \
184 $(DOC_INCLUDES) \
185 ; do echo "/$$lc/$$x"; done; \
186 done; \
187 for x in \
188 $(_DOC_OMF_ALL) \
189 $(_DOC_DSK_ALL) \
190 $(_DOC_HTML_ALL) \
191 $(_DOC_MOFILES) \
192 $(DOC_H_FILE) \
193 "*/.xml2po.mo" \
194 "*/*.omf.out" \
195 ; do echo /$$x; done; \
196 fi; \
197 if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
198 for lc in $(HELP_LINGUAS); do \
199 for x in \
200 $(HELP_FILES) \
201 "$$lc.stamp" \
202 "$$lc.mo" \
203 ; do echo "/$$lc/$$x"; done; \
204 done; \
205 fi; \
206 if test "x$(gsettings_SCHEMAS)" = x; then :; else \
207 for x in \
208 $(gsettings_SCHEMAS:.xml=.valid) \
209 $(gsettings__enum_file) \
210 ; do echo "/$$x"; done; \
211 fi; \
212 if test "x$(appdata_XML)" = x; then :; else \
213 for x in \
214 $(appdata_XML:.xml=.valid) \
215 ; do echo "/$$x"; done; \
216 fi; \
217 if test "x$(appstream_XML)" = x; then :; else \
218 for x in \
219 $(appstream_XML:.xml=.valid) \
220 ; do echo "/$$x"; done; \
221 fi; \
222 if test -f $(srcdir)/po/Makefile.in.in; then \
223 for x in \
224 po/Makefile.in.in \
225 po/Makefile.in.in~ \
226 po/Makefile.in \
227 po/Makefile \
228 po/Makevars.template \
229 po/POTFILES \
230 po/Rules-quot \
231 po/stamp-it \
232 po/.intltool-merge-cache \
233 "po/*.gmo" \
234 "po/*.header" \
235 "po/*.mo" \
236 "po/*.sed" \
237 "po/*.sin" \
238 po/$(GETTEXT_PACKAGE).pot \
239 intltool-extract.in \
240 intltool-merge.in \
241 intltool-update.in \
242 ; do echo "/$$x"; done; \
243 fi; \
244 if test -f $(srcdir)/configure; then \
245 for x in \
246 autom4te.cache \
247 configure \
248 config.h \
249 stamp-h1 \
250 libtool \
251 config.lt \
252 ; do echo "/$$x"; done; \
253 fi; \
254 if test "x$(DEJATOOL)" = x; then :; else \
255 for x in \
256 $(DEJATOOL) \
257 ; do echo "/$$x.sum"; echo "/$$x.log"; done; \
258 echo /site.exp; \
259 fi; \
260 if test "x$(am__dirstamp)" = x; then :; else \
261 echo "$(am__dirstamp)"; \
262 fi; \
263 if test "x$(LTCOMPILE)" = x -a "x$(LTCXXCOMPILE)" = x -a "x$(GTKDOC_RUN)" = x; then :; else \
264 for x in \
265 "*.lo" \
266 ".libs" "_libs" \
267 ; do echo "$$x"; done; \
268 fi; \
269 for x in \
270 .gitignore \
271 $(GITIGNOREFILES) \
272 $(CLEANFILES) \
273 $(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
274 $(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
275 $(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
276 so_locations \
277 $(MOSTLYCLEANFILES) \
278 $(TEST_LOGS) \
279 $(TEST_LOGS:.log=.trs) \
280 $(TEST_SUITE_LOG) \
281 $(TESTS:=.test) \
282 "*.gcda" \
283 "*.gcno" \
284 $(DISTCLEANFILES) \
285 $(am__CONFIG_DISTCLEAN_FILES) \
286 $(CONFIG_CLEAN_FILES) \
287 TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
288 "*.tab.c" \
289 $(MAINTAINERCLEANFILES) \
290 $(BUILT_SOURCES) \
291 $(patsubst %.vala,%.c,$(filter %.vala,$(SOURCES))) \
292 $(filter %_vala.stamp,$(DIST_COMMON)) \
293 $(filter %.vapi,$(DIST_COMMON)) \
294 $(filter $(addprefix %,$(notdir $(patsubst %.vapi,%.h,$(filter %.vapi,$(DIST_COMMON))))),$(DIST_COMMON)) \
295 Makefile \
296 Makefile.in \
297 "*.orig" \
298 "*.rej" \
299 "*.bak" \
300 "*~" \
301 ".*.sw[nop]" \
302 ".dirstamp" \
303 ; do echo "/$$x"; done; \
304 for x in \
305 "*.$(OBJEXT)" \
306 $(DEPDIR) \
307 ; do echo "$$x"; done; \
308 } | \
309 sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
310 sed 's@/[.]/@/@g' | \
311 LC_ALL=C sort | uniq > $@.tmp && \
312 mv $@.tmp $@;
314 all: $(srcdir)/.gitignore gitignore-recurse-maybe
315 gitignore: $(srcdir)/.gitignore gitignore-recurse
317 gitignore-recurse-maybe:
318 @for subdir in $(DIST_SUBDIRS); do \
319 case " $(SUBDIRS) " in \
320 *" $$subdir "*) :;; \
321 *) test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir");; \
322 esac; \
323 done
324 gitignore-recurse:
325 @for subdir in $(DIST_SUBDIRS); do \
326 test "$$subdir" = . -o -e "$$subdir/.git" || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) gitignore || echo "Skipping $$subdir"); \
327 done
329 maintainer-clean: gitignore-clean
330 gitignore-clean:
331 -rm -f $(srcdir)/.gitignore
333 .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe