aboutsummaryrefslogtreecommitdiff
path: root/imprimatur.mk
blob: ee7212c41020512075b328ac23e28b967f799f31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
130
131
# This file is part of Imprimatur.
# Copyright (C) 2006, 2007, 2010, 2011 Sergey Poznyakoff
#
# Imprimatur is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# Imprimatur 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.
#
# You should have received a copy of the GNU General Public License
# along with Imprimatur.  If not, see <http://www.gnu.org/licenses/>.

imprimatur-format:
	@if test -n "`cat $(imprimatur_INPUT) | tr -d -c '\t'`"; then \
		echo "Sources contain tabs; run make imprimatur-untabify"; \
		false; \
	fi

imprimatur-refs:
	@for file in $(imprimatur_INPUT); \
	do \
          grep -q '^@c imprimatur-ignore' $$file && continue; \
	  sed -e = $$file | \
           sed -n 'N;/@FIXME-.*ref/{s/\(^[0-9][0-9]*\).*@FIXME-.*ref{\([^}]*\)}.*/'$$file':\1: \2/gp}'; \
	done > $@-t; \
	if [ -s $@-t ]; then \
	  echo "Unresolved cross-references:"; \
	  cat $@-t;\
	  rm $@-t; \
	else \
	  rm -f $@-t; \
	fi

imprimatur-fixmes:
	@for file in $(imprimatur_INPUT); \
	do \
          grep -q '^@c imprimatur-ignore' $$file && continue; \
	  sed -e = $$file | \
           sed -n 'N;/@FIXME{/{s/\(^[0-9][0-9]*\).*@FIXME{\([^}]*\).*/'$$file':\1: \2/gp}'; \
	done > $@-t; \
	if [ -s $@-t ]; then \
	  echo "Unresolved FIXMEs:"; \
	  cat $@-t; \
	  rm $@-t; \
	  false; \
	else \
          rm -f $@-t; \
	fi

imprimatur-writemes:
	@files=`grep -c '^@c imprimatur-ignore' $(imprimatur_INPUT) | sed -n 's/:0$$//p'`; \
	test -n "$$files" && grep -Hn '^[ \t]*@WRITEME' $$files > $@-t; \
	if [ -s $@-t ]; then \
	  echo "Empty nodes:"; \
	  cat $@-t; \
	  rm $@-t; \
	  false;\
	else \
	   rm $@-t; \
	fi

imprimatur-empty-nodes:
	@awk -f $(top_srcdir)/$(IMPRIMATUR_MODULE_DIR)/emptynodes.awk \
         -v scriptname=$(top_srcdir)/$(IMPRIMATUR_MODULE_DIR)/emptynodes.awk \
         -v makeinfoflags="$(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS)" \
	        $(info_TEXINFOS)

imprimatur-unrevised:
	@files=`grep -c '^@c imprimatur-ignore' $(imprimatur_INPUT) | sed -n 's/:0$$//p'`; \
	grep -Hn '^[ \t]*@UNREVISED' $$files > $@-t; \
	if [ -s $@-t ]; then \
	  echo "Unrevised nodes:"; \
	  cat $@-t; \
	  rm $@-t; \
	  false;\
	else \
          rm $@-t; \
	fi

if IMPRIMATUR_COND_FRENCHSPACING
imprimatur-check-sentence-spacing:
	@if grep -q '\.  [@A-Z]' $(imprimatur_INPUT); then \
	   echo >&2 "Sources contain double-space sentence separators."; \
	   echo >&2 "Run make imprimatur-fix-sentence-spacing to fix."; \
	fi

imprimatur-fix-sentence-spacing:
	@for file in $(imprimatur_INPUT); \
	do \
	  if grep -q '\.  [@A-Z]' $$file; then \
	    mv $$file $${file}~; \
	    sed -r 's/\.  ([@A-Z])/. \1/g' $${file}~ > $$file; \
	  fi; \
	done
else
imprimatur-check-sentence-spacing:
	@if grep -q '\. [@A-Z]' $(imprimatur_INPUT); then \
		echo >&2 "Sources contain single-space sentence separators."; \
		echo >&2 "Run make imprimatur-fix-sentence-spacing to fix."; \
	fi

imprimatur-fix-sentence-spacing:
	@for file in $(imprimatur_INPUT); \
	do \
	  if grep -q '\. [@A-Z]' $$file; then \
	    mv $$file $${file}~; \
	    sed -r 's/\. ([@A-Z])/.  \1/g' $${file}~ > $$file; \
	  fi; \
	done
endif


imprimatur-basic-checks: imprimatur-format imprimatur-check-sentence-spacing \
                 imprimatur-refs imprimatur-fixmes \
                 imprimatur-empty-nodes imprimatur-unrevised

imprimatur-master-menu:
	@emacs -batch -l $(top_srcdir)/$(IMPRIMATUR_MODULE_DIR)/mastermenu.el \
               -f make-master-menu $(info_TEXINFOS)

imprimatur-untabify:
	@emacs -batch -l $(top_srcdir)/$(IMPRIMATUR_MODULE_DIR)/untabify.el \
               $(imprimatur_INPUT)

imprimatur-final: imprimatur-untabify imprimatur-master-menu


Return to:

Send suggestions and report system problems to the System administrator.