1 # Customize Makefile.maint. -*- makefile -*-
2 # Copyright (C) 2003-2009 Free Software Foundation, Inc.
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Use alpha.gnu.org for alpha and beta releases.
18 # Use ftp.gnu.org for major releases.
19 gnu_ftp_host-alpha = alpha.gnu.org
20 gnu_ftp_host-beta = alpha.gnu.org
21 gnu_ftp_host-major = ftp.gnu.org
22 gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
25 ftp://$(gnu_rel_host)/gnu/coreutils
27 # Tests not to run as part of "make distcheck".
28 local-checks-to-skip = \
31 sc_error_exit_success \
33 sc_makefile_path_separator_check \
35 sc_prohibit_atoi_atof \
36 sc_prohibit_quote_without_use \
37 sc_prohibit_quotearg_without_use \
38 sc_prohibit_stat_st_blocks \
40 sc_two_space_separator_in_usage \
41 sc_error_message_uppercase \
43 $(disable_temporarily) \
46 disable_temporarily = \
48 sc_unmarked_diagnostics \
50 sc_prohibit_asprintf \
53 # Avoid uses of write(2). Either switch to streams (fwrite), or use
54 # the safewrite wrapper.
56 @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
57 grep '\<write *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$') && \
58 { echo "$(ME): the above files use write;" \
59 " consider using the safewrite wrapper instead" \
60 1>&2; exit 1; } || :; \
64 # Use STREQ rather than comparing strcmp == 0, or != 0.
65 # Similarly, use STREQLEN or STRPREFIX rather than strncmp.
66 sc_prohibit_strcmp_and_strncmp:
67 @grep -nE '! *strn?cmp *\(|\<strn?cmp *\([^)]+\) *==' \
68 $$($(VC_LIST_EXCEPT)) \
69 | grep -vE ':# *define STREQ(LEN)?\(' && \
70 { echo '$(ME): use STREQ(LEN) in place of the above uses of strcmp(strncmp)' \
73 # Use virAsprintf rather than a'sprintf since *strp is undefined on error.
75 @re='\<[a]sprintf\>' \
76 msg='use virAsprintf, not a'sprintf \
79 # Prohibit the inclusion of <ctype.h>.
81 @grep -E '^# *include *<ctype\.h>' $$($(VC_LIST_EXCEPT)) && \
82 { echo "$(ME): don't use ctype.h; instead, use c-ctype.h" \
85 # Ensure that no C source file uses TABs for indentation.
86 # Exclude some version-controlled symlinks.
87 sc_TAB_in_indentation:
88 @grep -lE '^ * ' /dev/null \
89 $$($(VC_LIST_EXCEPT)) && \
90 { echo '$(ME): found TAB(s) used for indentation in C sources;'\
91 'use spaces' 1>&2; exit 1; } || :
93 ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
94 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
96 sc_avoid_ctype_macros:
97 @grep -E '\b($(ctype_re)) *\(' /dev/null \
98 $$($(VC_LIST_EXCEPT)) && \
99 { echo "$(ME): don't use ctype macros (use c-ctype.h)" \
102 sc_prohibit_virBufferAdd_with_string_literal:
103 @prohibit='\<virBufferAdd *\([^,]+, *"[^"]' \
104 halt='use virBufferAddLit, not virBufferAdd, with a string literal' \
107 # Not only do they fail to deal well with ipv6, but the gethostby*
108 # functions are also not thread-safe.
109 sc_prohibit_gethostby:
110 @prohibit='\<gethostby(addr|name2?) *\(' \
111 halt='use getaddrinfo, not gethostby*' \
114 # Disallow trailing blank lines.
115 sc_prohibit_trailing_blank_lines:
117 | xargs perl -ln -0777 -e \
118 '-f $$ARGV or next; /\n\n+$$/ and print $$ARGV' > $@-t
119 @found=0; test -s $@-t && { found=1; cat $@-t 1>&2; \
120 echo '$(ME): found trailing blank line(s)' 1>&2; }; \
124 # We don't use this feature of maint.mk.
125 prev_version_file = /dev/null
127 ifeq (0,$(MAKELEVEL))
128 _curr_status = .git-module-status
129 # The sed filter accommodates those who check out on a commit from which
130 # no tag is reachable. In that case, git submodule status prints a "-"
131 # in column 1 and does not print a "git describe"-style string after the
132 # submodule name. Contrast these:
133 # -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
134 # b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
135 # $ cat .git-module-status
136 # b653eda3ac4864de205419d9f41eec267cb89eeb
137 _submodule_hash = sed 's/^[ +-]//;s/ .*//'
138 _update_required := $(shell \
139 actual=$$(git submodule status | $(_submodule_hash)); \
140 stamp="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \
141 test "$$stamp" = "$$actual"; echo $$?)
142 ifeq (1,$(_update_required))
143 $(error gnulib update required; run ./autogen.sh first)