Home | History | Annotate | Download | only in harfbuzz_ng
      1 # git.mk
      2 #
      3 # Copyright 2009, Red Hat, Inc.
      4 # Copyright 2010,2011,2012,2013 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 
     68 
     69 ###############################################################################
     70 # Variables user modules may want to add to toplevel MAINTAINERCLEANFILES:
     71 ###############################################################################
     72 
     73 #
     74 # Most autotools-using modules should be fine including this variable in their
     75 # toplevel MAINTAINERCLEANFILES:
     76 GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL = \
     77 	$(srcdir)/aclocal.m4 \
     78 	$(srcdir)/autoscan.log \
     79 	$(srcdir)/compile \
     80 	$(srcdir)/config.guess \
     81 	$(srcdir)/config.h.in \
     82 	$(srcdir)/config.sub \
     83 	$(srcdir)/configure.scan \
     84 	$(srcdir)/depcomp \
     85 	$(srcdir)/install-sh \
     86 	$(srcdir)/ltmain.sh \
     87 	$(srcdir)/missing \
     88 	$(srcdir)/mkinstalldirs
     89 #
     90 # All modules should also be fine including the following variable, which
     91 # removes automake-generated Makefile.in files:
     92 GITIGNORE_MAINTAINERCLEANFILES_MAKEFILE_IN = \
     93 	`$(AUTOCONF) --trace 'AC_CONFIG_FILES:$$1' $(srcdir)/configure.ac | \
     94 	while read f; do \
     95 	  case $$f in Makefile|*/Makefile) \
     96 	    test -f "$(srcdir)/$$f.am" && echo "$(srcdir)/$$f.in";; esac; \
     97 	done`
     98 #
     99 # Modules that use libtool /and/ use  AC_CONFIG_MACRO_DIR([m4]) may also
    100 # include this:
    101 GITIGNORE_MAINTAINERCLEANFILES_M4_LIBTOOL = \
    102 	$(srcdir)/m4/libtool.m4 \
    103 	$(srcdir)/m4/ltoptions.m4 \
    104 	$(srcdir)/m4/ltsugar.m4 \
    105 	$(srcdir)/m4/ltversion.m4 \
    106 	$(srcdir)/m4/lt~obsolete.m4
    107 
    108 
    109 
    110 ###############################################################################
    111 # Default rule is to install ourselves in all Makefile.am files:
    112 ###############################################################################
    113 
    114 git-all: git-mk-install
    115 
    116 git-mk-install:
    117 	@echo Installing git makefile
    118 	@any_failed=; \
    119 		find "`test -z "$(top_srcdir)" && echo . || echo "$(top_srcdir)"`" -name Makefile.am | while read x; do \
    120 		if grep 'include .*/git.mk' $$x >/dev/null; then \
    121 			echo $$x already includes git.mk; \
    122 		else \
    123 			failed=; \
    124 			echo "Updating $$x"; \
    125 			{ cat $$x; \
    126 			  echo ''; \
    127 			  echo '-include $$(top_srcdir)/git.mk'; \
    128 			} > $$x.tmp || failed=1; \
    129 			if test x$$failed = x; then \
    130 				mv $$x.tmp $$x || failed=1; \
    131 			fi; \
    132 			if test x$$failed = x; then : else \
    133 				echo Failed updating $$x; >&2 \
    134 				any_failed=1; \
    135 			fi; \
    136 	fi; done; test -z "$$any_failed"
    137 
    138 .PHONY: git-all git-mk-install
    139 
    140 
    141 
    142 ###############################################################################
    143 # Actual .gitignore generation:
    144 ###############################################################################
    145 
    146 $(srcdir)/.gitignore: Makefile.am $(top_srcdir)/git.mk
    147 	$(AM_V_GEN) \
    148 	{ \
    149 		if test "x$(DOC_MODULE)" = x -o "x$(DOC_MAIN_SGML_FILE)" = x; then :; else \
    150 			for x in \
    151 				$(DOC_MODULE)-decl-list.txt \
    152 				$(DOC_MODULE)-decl.txt \
    153 				tmpl/$(DOC_MODULE)-unused.sgml \
    154 				"tmpl/*.bak" \
    155 				xml html \
    156 			; do echo /$$x; done; \
    157 		fi; \
    158 		if test "x$(DOC_MODULE)$(DOC_ID)" = x -o "x$(DOC_LINGUAS)" = x; then :; else \
    159 			for lc in $(DOC_LINGUAS); do \
    160 				for x in \
    161 					$(if $(DOC_MODULE),$(DOC_MODULE).xml) \
    162 					$(DOC_PAGES) \
    163 					$(DOC_INCLUDES) \
    164 				; do echo /$$lc/$$x; done; \
    165 			done; \
    166 			for x in \
    167 				$(_DOC_OMF_ALL) \
    168 				$(_DOC_DSK_ALL) \
    169 				$(_DOC_HTML_ALL) \
    170 				$(_DOC_MOFILES) \
    171 				$(DOC_H_FILE) \
    172 				"*/.xml2po.mo" \
    173 				"*/*.omf.out" \
    174 			; do echo /$$x; done; \
    175 		fi; \
    176 		if test "x$(HELP_ID)" = x -o "x$(HELP_LINGUAS)" = x; then :; else \
    177 			for lc in $(HELP_LINGUAS); do \
    178 				for x in \
    179 					$(HELP_FILES) \
    180 					"$$lc.stamp" \
    181 					"$$lc.mo" \
    182 				; do echo /$$lc/$$x; done; \
    183 			done; \
    184 		fi; \
    185 		if test "x$(gsettings_SCHEMAS)" = x; then :; else \
    186 			for x in \
    187 				$(gsettings_SCHEMAS:.xml=.valid) \
    188 				$(gsettings__enum_file) \
    189 			; do echo /$$x; done; \
    190 		fi; \
    191 		if test -f $(srcdir)/po/Makefile.in.in; then \
    192 			for x in \
    193 				po/Makefile.in.in \
    194 				po/Makefile.in \
    195 				po/Makefile \
    196 				po/POTFILES \
    197 				po/stamp-it \
    198 				po/.intltool-merge-cache \
    199 				"po/*.gmo" \
    200 				"po/*.mo" \
    201 				po/$(GETTEXT_PACKAGE).pot \
    202 				intltool-extract.in \
    203 				intltool-merge.in \
    204 				intltool-update.in \
    205 			; do echo /$$x; done; \
    206 		fi; \
    207 		if test -f $(srcdir)/configure; then \
    208 			for x in \
    209 				autom4te.cache \
    210 				configure \
    211 				config.h \
    212 				stamp-h1 \
    213 				libtool \
    214 				config.lt \
    215 			; do echo /$$x; done; \
    216 		fi; \
    217 		if test "x$(DEJATOOL)" = x; then :; else \
    218 			for x in \
    219 				$(DEJATOOL) \
    220 			; do echo /$$x.sum; echo /$$x.log; done; \
    221 			echo /site.exp; \
    222 		fi; \
    223 		for x in \
    224 			.gitignore \
    225 			$(GITIGNOREFILES) \
    226 			$(CLEANFILES) \
    227 			$(PROGRAMS) $(check_PROGRAMS) $(EXTRA_PROGRAMS) \
    228 			$(LIBRARIES) $(check_LIBRARIES) $(EXTRA_LIBRARIES) \
    229 			$(LTLIBRARIES) $(check_LTLIBRARIES) $(EXTRA_LTLIBRARIES) \
    230 			so_locations \
    231 			.libs _libs \
    232 			$(MOSTLYCLEANFILES) \
    233 			"*.$(OBJEXT)" \
    234 			"*.lo" \
    235 			$(DISTCLEANFILES) \
    236 			$(am__CONFIG_DISTCLEAN_FILES) \
    237 			$(CONFIG_CLEAN_FILES) \
    238 			TAGS ID GTAGS GRTAGS GSYMS GPATH tags \
    239 			"*.tab.c" \
    240 			$(MAINTAINERCLEANFILES) \
    241 			$(BUILT_SOURCES) \
    242 			$(DEPDIR) \
    243 			Makefile \
    244 			Makefile.in \
    245 			"*.orig" \
    246 			"*.rej" \
    247 			"*.bak" \
    248 			"*~" \
    249 			".*.sw[nop]" \
    250 			".dirstamp" \
    251 		; do echo /$$x; done; \
    252 	} | \
    253 	sed "s@^/`echo "$(srcdir)" | sed 's/\(.\)/[\1]/g'`/@/@" | \
    254 	sed 's@/[.]/@/@g' | \
    255 	LC_ALL=C sort | uniq > $@.tmp && \
    256 	mv $@.tmp $@;
    257 
    258 all: $(srcdir)/.gitignore gitignore-recurse-maybe
    259 gitignore: $(srcdir)/.gitignore gitignore-recurse
    260 
    261 gitignore-recurse-maybe:
    262 	@for subdir in $(DIST_SUBDIRS); do \
    263 	  case " $(SUBDIRS) " in \
    264 	    *" $$subdir "*) :;; \
    265 	    *) test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse-maybe || echo "Skipping $$subdir");; \
    266 	  esac; \
    267 	done
    268 gitignore-recurse:
    269 	@for subdir in $(DIST_SUBDIRS); do \
    270 	    test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) .gitignore gitignore-recurse || echo "Skipping $$subdir"); \
    271 	done
    272 
    273 maintainer-clean: gitignore-clean
    274 gitignore-clean:
    275 	-rm -f $(srcdir)/.gitignore
    276 
    277 .PHONY: gitignore-clean gitignore gitignore-recurse gitignore-recurse-maybe
    278