Fix bracket whitespace usage
[entangle:entangle.git] / cfg.mk
1 # Customize Makefile.maint.                           -*- makefile -*-
2 # Copyright (C) 2008-2011 Red Hat, Inc.
3 # Copyright (C) 2003-2008 Free Software Foundation, Inc.
4
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Tests not to run as part of "make distcheck".
19 local-checks-to-skip =                  \
20   changelog-check                       \
21   makefile-check                        \
22   makefile_path_separator_check         \
23   patch-check                           \
24   sc_GPL_version                        \
25   sc_always_defined_macros              \
26   sc_cast_of_alloca_return_value        \
27   sc_cross_check_PATH_usage_in_tests    \
28   sc_dd_max_sym_length                  \
29   sc_error_exit_success                 \
30   sc_file_system                        \
31   sc_immutable_NEWS                     \
32   sc_makefile_path_separator_check      \
33   sc_obsolete_symbols                   \
34   sc_prohibit_always_true_header_tests  \
35   sc_prohibit_S_IS_definition           \
36   sc_prohibit_atoi_atof                 \
37   sc_prohibit_hash_without_use          \
38   sc_prohibit_jm_in_m4                  \
39   sc_prohibit_quote_without_use         \
40   sc_prohibit_quotearg_without_use      \
41   sc_prohibit_stat_st_blocks            \
42   sc_root_tests                         \
43   sc_space_tab                          \
44   sc_sun_os_names                       \
45   sc_system_h_headers                   \
46   sc_texinfo_acronym                    \
47   sc_tight_scope                        \
48   sc_two_space_separator_in_usage       \
49   sc_error_message_uppercase            \
50   sc_program_name                       \
51   sc_require_test_exit_idiom            \
52   sc_makefile_check                     \
53   sc_useless_cpp_parens                 \
54   sc_preprocessor_indentation
55
56 # Files that should never cause syntax check failures.
57 VC_LIST_ALWAYS_EXCLUDE_REGEX = \
58   (^HACKING|\.po|maint.mk)$$
59
60 # Functions like free() that are no-ops on NULL arguments.
61 useless_free_options =                          \
62   --name=g_free
63
64 # Ensure that no C source file, docs, or rng schema uses TABs for
65 # indentation.  Also match *.h.in files, to get libvirt.h.in.  Exclude
66 # files in gnulib, since they're imported.
67 space_indent_files=(\.(rng|s?[ch](\.in)?|html.in|py)|(daemon|tools)/.*\.in)
68 sc_TAB_in_indentation:
69         @prohibit='^ *  '                                               \
70         in_vc_files='$(space_indent_files)$$'                           \
71         halt='indent with space, not TAB, in C, sh, html, py, and RNG schemas' \
72           $(_sc_search_regexp)
73
74 # G_GNUC_UNUSED should only be applied in implementations, not
75 # header declarations
76 sc_avoid_attribute_unused_in_header:
77         @prohibit='^[^#]*G_GNUC_UNUSED([^:]|$$)'                        \
78         in_vc_files='\.h$$'                                             \
79         halt='use G_GNUC_UNUSED in .c rather than .h files'             \
80           $(_sc_search_regexp)
81
82 # Enforce recommended preprocessor indentation style.
83 sc_preprocessor_indentation:
84         @if cppi --version >/dev/null 2>&1; then                        \
85           $(VC_LIST_EXCEPT) | grep '\.[ch]$$' | xargs cppi -a -c        \
86             || { echo '$(ME): incorrect preprocessor indentation' 1>&2; \
87                 exit 1; };                                              \
88         else                                                            \
89           echo '$(ME): skipping test $@: cppi not installed' 1>&2;      \
90         fi
91
92 sc_copyright_format:
93         @require='Copyright .*Red 'Hat', Inc\.'                         \
94         containing='Copyright .*Red 'Hat                                \
95         halt='Red Hat copyright is missing Inc.'                        \
96           $(_sc_search_regexp)
97         @prohibit='Copyright [^(].*Red 'Hat                             \
98         halt='consistently use (C) in Red Hat copyright'                \
99           $(_sc_search_regexp)
100         @prohibit='\<Red''Hat\>'                                        \
101         halt='spell Red Hat as two words'                               \
102           $(_sc_search_regexp)
103
104 # We don't use this feature of maint.mk.
105 prev_version_file = /dev/null
106
107 msg_gen_function =
108 msg_gen_function += g_error
109 msg_gen_function += g_set_error
110 msg_gen_function += ENTANGLE_ERROR
111
112
113 func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
114 func_re := ($(func_or))
115
116 # Look for diagnostics that aren't marked for translation.
117 # This won't find any for which error's format string is on a separate line.
118 # The sed filters eliminate false-positives like these:
119 #    _("...: "
120 #    "%s", _("no storage vol w..."
121 sc_libvirt_unmarked_diagnostics:
122         @grep -nE                                                       \
123             '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
124           | grep -v '_''(' &&                                           \
125           { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
126             exit 1; } || :
127         @{ grep     -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT));   \
128            grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
129            | sed 's/_("[^"][^"]*"//;s/[  ]"%s"//'                       \
130            | grep '[     ]"' &&                                         \
131           { echo '$(ME): found unmarked diagnostic(s)' 1>&2;            \
132             exit 1; } || :
133
134 syntax-check: bracket-spacing
135
136 bracket-spacing:
137         $(AM_V_GEN)files=`$(VC_LIST) | grep '\.c$$'`; \
138         $(PERL) $(top_srcdir)/build-aux/bracket-spacing.pl $$files || \
139           { echo '$(ME): incorrect whitespace, see HACKING for rules' 1>&2; \
140             exit 1; }
141
142 exclude_file_name_regexp--sc_prohibit_strcmp = ^*/*.[ch]
143
144 # Due to enum rules - fixme
145 exclude_file_name_regexp--sc_makefile_at_at_check = ^src/Makefile.am
146
147 exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = ^(docs|src)/.*\.png
148
149 exclude_file_name_regexp--sc_prohibit_test_minus_ao = git.mk
150
151 exclude_file_name_regexp--sc_trailing_blank = (src|docs)/.*\.(ep|png|icc)