git-check.am 5.3 KB
Newer Older
1
2
3
4
5
# tarot implements the rules of the tarot game
# Copyright (C) 2019  Vivien Kraus

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation, version 3 of the License.
7
8
9
10
11
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
12
#
13
14
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16
17
18
19
20
21

.PHONY: git-check

git_clone_verbose = $(git_clone_verbose_@AM_V@)
git_clone_verbose_ = $(git_clone_verbose_@AM_DEFAULT_V@)
git_clone_verbose_0 = @echo "  GIT CLONE";

Vivien Kraus's avatar
Vivien Kraus committed
22
23
EXTRA_DIST += $(srcdir)/bootstrap-manifest.scm

24
if HAVE_GUIX
Vivien Kraus's avatar
Vivien Kraus committed
25
CI_ENV = $(GUIX) environment --pure --ad-hoc --manifest=$(abs_top_srcdir)/bootstrap-manifest.scm --
26
27
endif

28
29
30
31
32
git-check:
	@$(MKDIR_P) .gitcheck ; chmod -R u+w .gitcheck
	@rm -rf .gitcheck
	$(MKDIR_P) .gitcheck
	$(git_clone_verbose) $(GIT) clone $(srcdir) .gitcheck/clean/
33
	(cd .gitcheck/clean \
34
	  && for source in $$(find . -type f | grep -v '/.git/') ; \
35
36
37
	  do \
	    ./copyright/check-copyright "$$source" || exit 1; \
	  done)
38
39
40
	$(git_clone_verbose) ($(GIT) clone $(srcdir) .gitcheck/source/ \
	  && $(GIT) submodule update \
	  && cd .gitcheck/source \
Vivien Kraus's avatar
Vivien Kraus committed
41
42
	  && $(GIT) clone ../../.gnulib .gnulib \
	  && $(GIT) clone ../../src/libtarot/perceptron/julien src/libtarot/perceptron/julien)
43
	$(MKDIR_P) .gitcheck/build
44
45
46
47
	(cd .gitcheck/source && $(CI_ENV) ./autogen.sh)
	(cd .gitcheck/build && $(CI_ENV) ../source/configure VALAFLAGS="--target-glib=2.50" CFLAGS="-Wall -Wextra -g" --enable-valgrind=yes --enable-silent-rules=yes)
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) all)
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) check distcheck)
Vivien Kraus's avatar
wtf    
Vivien Kraus committed
48
	@tar tf .gitcheck/build/*.tar.gz
Vivien Kraus's avatar
Vivien Kraus committed
49
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) distdir)
50
51
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) indent)
	@cp .gitcheck/build/tarot-*.tar.gz .
52
	(cd .gitcheck/clean \
53
	  && for source in $$(find . -type f | grep -v '/.git/') ; \
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
	do \
	  case $$source in \
	    *.md) \
	      >&2 echo "Ignoring Markdown file $$source (because org markdown exporter is not reproducible)";; \
	    */.git/*);; \
	    *.po) \
	      if test $$($(DIFF) $$source ../../.gitcheck/source/$$source | wc -l) -eq '4' ; \
	      then \
	        >&2 echo "$$source: OK" ; \
	      else \
	        $(DIFF) $$source ../../.gitcheck/source/$$source ; \
	        >&2 echo "Error: $$source is checked in, but overwritten by a substantial bit.  Maybe you should update the po files." ; \
	        exit 1; \
	      fi;; \
	    *) \
	      if $(DIFF) $$source ../../.gitcheck/source/$$source ; \
	      then \
	        >&2 echo "$$source: OK" ; \
	      else \
	        >&2 echo "Error: $$source is checked in, but overwritten.  Maybe it should not be checked in in the first place." ; \
	        exit 1; \
	      fi;; \
	  esac ; \
	done)
	@(cd .gitcheck/source ; \
	  if test "$$($(GIT) status --porcelain | grep '^??' | wc -l)" -eq "0"; \
	  then \
	    >&2 echo "Gitignore: OK"; \
	  else \
	    >&2 $(GIT) status ; \
	    >&2 echo "Please update the .gitignore." ; \
	    exit 1 ; \
	  fi)
	(cd .gitcheck/clean \
88
	  && for source in $$(find . -type f | grep -v '/.git/') ; \
89
90
91
	do \
	  case $$source in \
	    *.po | *.pot);; \
Vivien Kraus's avatar
Vivien Kraus committed
92
	    */.git/* | */.gitmodules);; \
93
	    *) \
Vivien Kraus's avatar
Vivien Kraus committed
94
	      if $(DIFF) $$source ../build/tarot-*/$$source ; \
95
96
97
98
99
100
101
102
	      then \
	        >&2 echo "$$source is distributed" ; \
	      else \
	        >&2 echo "Error: $$source is checked in, but not distributed.  Maybe it should not be checked in in the first place." ; \
	        exit 1 ; \
	      fi;; \
	   esac ; \
	done)
103
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) maintainer-clean)
104
	(cd .gitcheck/source \
Vivien Kraus's avatar
Vivien Kraus committed
105
	  && for source in $$(find . -type f | grep -v '/.git/' | grep -v '/.gnulib/') ; \
106
107
108
109
110
111
112
113
114
115
	do \
	  case $$source in \
	    ./po/en@quot.header | ./po/en@boldquot.header | ./po/Rules-quot | ./po/remove-potcdate.sin | ./po/boldquot.sed | ./po/quot.sed | ./po/insert-header.sin | ./po/Makefile.in.in | ./po/Makevars.template | ./po/tarot.pot) \
	      >&2 echo "Ignoring Gettext leftover $$source";; \
	    ./.tarball-version) \
	      >&2 echo "Ignoring the tarball version stamp $$source";; \
	    ./lib/* | ./snippet/* | ./git-version-gen | ./gitlog-to-changelog) \
	      >&2 echo "Ignoring Gnulib's $$source";; \
	    ./m4/*) \
	      >&2 echo "Ignoring autoconf's macro $$source";; \
Vivien Kraus's avatar
Vivien Kraus committed
116
	    ./compile | ./depcomp | ./config.rpath | ./config.sub | ./texinfo.tex | ./ar-lib | ./INSTALL | ./missing | ./test-driver | ./ltmain.sh | ./aclocal.m4 | ./ChangeLog | ./config.h.in | ./config.guess | */Makefile.in | ./configure | ./install-sh | ./ABOUT-NLS) \
117
118
119
120
	      >&2 echo "Ignorign automake's $$source";; \
	    */.git/*);; \
	    *~);; \
	    *.po);; \
Vivien Kraus's avatar
Vivien Kraus committed
121
122
	    ./src/libtarot/perceptron/julien/*) \
	      >&2 echo "Ignoring julien file $$source";; \
123
124
125
126
127
128
129
130
131
132
133
	    *) \
	      if $(DIFF) $$source ../../.gitcheck/clean/$$source ; \
	      then \
	        >&2 echo "$$source: OK" ; \
	      else \
	        >&2 echo "Error: $$source is a generated file, but not cleaned by make maintainer-clean." ; \
	        exit 1 ; \
	      fi;; \
	  esac ; \
	done)
	@rm -rf .gitcheck