git-check.am 5.34 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";

22
23
24
25
if HAVE_GUIX
CI_ENV = $(GUIX) environment --ad-hoc autoconf autoconf-archive automake gettext gcc-toolchain curl check emacs git gtk+ indent help2man jq cairo gobject-introspection glib gtk+ libtool libxml2 make nettle emacs-org pkg-config r-ggplot2 r-glmnet r-optparse texinfo texlive vala valgrind wget libxslt --
endif

26
27
28
29
30
git-check:
	@$(MKDIR_P) .gitcheck ; chmod -R u+w .gitcheck
	@rm -rf .gitcheck
	$(MKDIR_P) .gitcheck
	$(git_clone_verbose) $(GIT) clone $(srcdir) .gitcheck/clean/
31
	(cd .gitcheck/clean \
32
	  && for source in $$(find . -type f | grep -v '/.git/') ; \
33
34
35
	  do \
	    ./copyright/check-copyright "$$source" || exit 1; \
	  done)
36
37
38
39
	$(git_clone_verbose) ($(GIT) clone $(srcdir) .gitcheck/source/ \
	  && $(GIT) submodule update \
	  && cd .gitcheck/source \
	  && $(GIT) clone ../../.gnulib .gnulib)
40
	$(MKDIR_P) .gitcheck/build
41
42
43
44
45
	(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) safe)
	(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
46
	@tar tf .gitcheck/build/*.tar.gz
Vivien Kraus's avatar
Vivien Kraus committed
47
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) distdir)
48
49
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) indent)
	@cp .gitcheck/build/tarot-*.tar.gz .
50
	(cd .gitcheck/clean \
51
	  && for source in $$(find . -type f | grep -v '/.git/') ; \
52
53
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
	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 \
86
	  && for source in $$(find . -type f | grep -v '/.git/') ; \
87
88
89
	do \
	  case $$source in \
	    *.po | *.pot);; \
Vivien Kraus's avatar
Vivien Kraus committed
90
	    */.git/* | */.gitmodules);; \
91
	    *) \
Vivien Kraus's avatar
Vivien Kraus committed
92
	      if $(DIFF) $$source ../build/tarot-*/$$source ; \
93
94
95
96
97
98
99
100
	      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)
101
	(cd .gitcheck/build && $(CI_ENV) $(MAKE) $(AM_MAKEFLAGS) maintainer-clean)
102
	(cd .gitcheck/source \
Vivien Kraus's avatar
Vivien Kraus committed
103
	  && for source in $$(find . -type f | grep -v '/.git/' | grep -v '/.gnulib/') ; \
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	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";; \
	    ./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) \
	      >&2 echo "Ignorign automake's $$source";; \
	    */.git/*);; \
	    *~);; \
	    *.po);; \
	    *) \
	      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