mkdb: add an idea for rewriting path of system entities in the doctype_header
[gtk-doc.git] / git.mk
blob12425e6e6b18ab9ea9abb47bc58e70be007a81de
1 # git.mk
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
36 # pango/Makefile.am.
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.
42 # This file knows how to handle autoconf, automake, libtool, gtk-doc,
43 # gnome-doc-utils, intltool.
46 # KNOWN ISSUES:
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.
56 git-all: git-mk-install
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"
79 .PHONY: git-all git-mk-install
82 ### .gitignore generation
84 $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
85 @echo Generating $@; \
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 $(DOC_MODULE)-overrides.txt \
92 $(DOC_MODULE).pdf \
93 tmpl/$(DOC_MODULE)-unused.sgml \
94 "tmpl/*.bak" \
95 xml html \
96 ; do echo /$$x; done; \
97 fi; \
98 if test "x$(DOC_MODULE)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
99 for x in \
100 $(_DOC_C_DOCS) \
101 $(_DOC_LC_DOCS) \
102 $(_DOC_OMF_ALL) \
103 $(_DOC_DSK_ALL) \
104 $(_DOC_HTML_ALL) \
105 $(_DOC_POFILES) \
106 "*/.xml2po.mo" \
107 "*/*.omf.out" \
108 ; do echo /$$x; done; \
109 fi; \
110 if test -f $(srcdir)/po/Makefile.in.in; then \
111 for x in \
112 po/Makefile.in.in \
113 po/Makefile.in \
114 po/Makefile \
115 po/POTFILES \
116 po/stamp-it \
117 po/.intltool-merge-cache \
118 "po/*.gmo" \
119 "po/*.mo" \
120 intltool-extract.in \
121 intltool-merge.in \
122 intltool-update.in \
123 ; do echo /$$x; done; \
124 fi; \
125 if test -f $(srcdir)/configure; then \
126 for x in \
127 autom4te.cache \
128 configure \
129 config.h \
130 stamp-h1 \
131 libtool \
132 config.lt \
133 ; do echo /$$x; done; \
134 fi; \
135 for x in \
136 .gitignore \
137 $(GITIGNOREFILES) \
138 $(CLEANFILES) \
139 $(PROGRAMS) \
140 $(EXTRA_PROGRAMS) \
141 $(LTLIBRARIES) \
142 so_locations \
143 .libs _libs \
144 $(MOSTLYCLEANFILES) \
145 "*.$(OBJEXT)" \
146 "*.lo" \
147 $(DISTCLEANFILES) \
148 $(am__CONFIG_DISTCLEAN_FILES) \
149 $(CONFIG_CLEAN_FILES) \
150 TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
151 "*.tab.c" \
152 $(MAINTAINERCLEANFILES) \
153 $(BUILT_SOURCES) \
154 $(DEPDIR) \
155 Makefile \
156 Makefile.in \
157 "*.orig" \
158 "*.rej" \
159 "*.bak" \
160 "*~" \
161 ".*.sw[nop]" \
162 ; do echo /$$x; done; \
163 } | \
164 sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
165 sed 's@/[.]/@/@g' | \
166 LANG=C sort | uniq > $@.tmp && \
167 mv $@.tmp $@;
169 all: $(srcdir)/.gitignore gitignore-recurse-maybe
170 gitignore-recurse-maybe:
171 @if test "x$(SUBDIRS)" = "x$(DIST_SUBDIRS)"; then :; else \
172 $(MAKE) $(AM_MAKEFLAGS) gitignore-recurse; \
174 gitignore-recurse:
175 @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
176 test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \
177 done
178 gitignore: $(srcdir)/.gitignore gitignore-recurse
180 maintainer-clean: gitignore-clean
181 gitignore-clean:
182 -rm -f $(srcdir)/.gitignore
184 .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe