• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2#    gitignore generation include Makefile.
3#
4#    Copyright (C) 2011, Linux Test Project.
5#
6#    This program is free software; you can redistribute it and/or modify
7#    it under the terms of the GNU General Public License as published by
8#    the Free Software Foundation; either version 2 of the License, or
9#    (at your option) any later version.
10#
11#    This program is distributed in the hope that it will be useful,
12#    but WITHOUT ANY WARRANTY; without even the implied warranty of
13#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14#    GNU General Public License for more details.
15#
16#    You should have received a copy of the GNU General Public License along
17#    with this program; if not, write to the Free Software Foundation, Inc.,
18#    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19#
20# Ngie Cooper, January 2011
21#
22
23CLEAN_TARGETS+=		gitignore_clean
24
25BEFORE:=		.gitignore-before
26
27AFTER:=			.gitignore-after
28
29IGNORE_DIR_EXPR:=	egrep -v "^$$(echo "$(AUTOCONFED_SUBDIRS)" | tr " " "|")"
30
31# NOTE: The underscore is used in place of a dash to avoid implicit rule
32# evaluation in top-level Makefile.
33.PHONY: gitignore_clean
34gitignore_clean:
35	$(RM) -f $(BEFORE) $(AFTER)
36
37$(BEFORE):
38	$(MAKE) distclean
39	$(MAKE) ac-maintainer-clean
40	find . | $(IGNORE_DIR_EXPR) > $@
41
42$(AFTER):
43	$(MAKE) autotools
44	./configure --prefix=/dev/null
45	$(MAKE) all
46	find . | $(IGNORE_DIR_EXPR) > $@
47	# Set everything in autoconf land back to a sane state.
48	$(MAKE) distclean
49
50.gitignore: | $(BEFORE) $(AFTER)
51	diff -u $(BEFORE) $(AFTER) | grep '^+' | sed -e 's,^\+,,g' > $@
52