1 # Customize Makefile.maint. -*- makefile -*-
2 # Copyright (C) 2003-2010 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 # We use .gnulib, not gnulib.
28 gnulib_dir
= $(srcdir)/.gnulib
30 # Tests not to run as part of "make distcheck".
31 local-checks-to-skip
= \
35 makefile_path_separator_check \
38 sc_always_defined_macros \
39 sc_cast_of_alloca_return_value \
40 sc_cross_check_PATH_usage_in_tests \
41 sc_dd_max_sym_length \
42 sc_error_exit_success \
45 sc_makefile_path_separator_check \
47 sc_prohibit_S_IS_definition \
48 sc_prohibit_atoi_atof \
49 sc_prohibit_hash_without_use \
50 sc_prohibit_jm_in_m4 \
51 sc_prohibit_quote_without_use \
52 sc_prohibit_quotearg_without_use \
53 sc_prohibit_stat_st_blocks \
60 sc_two_space_separator_in_usage \
61 sc_error_message_uppercase \
63 sc_require_test_exit_idiom \
67 useless_free_options
= \
70 --name
=virBitmapFree \
71 --name
=virCPUDefFree \
72 --name
=virCapabilitiesFree \
73 --name
=virCapabilitiesFreeGuest \
74 --name
=virCapabilitiesFreeGuestDomain \
75 --name
=virCapabilitiesFreeGuestFeature \
76 --name
=virCapabilitiesFreeGuestMachine \
77 --name
=virCapabilitiesFreeHostNUMACell \
78 --name
=virCapabilitiesFreeMachines \
79 --name
=virCgroupFree \
80 --name
=virConfFreeList \
81 --name
=virConfFreeValue \
82 --name
=virDomainChrDefFree \
83 --name
=virDomainControllerDefFree \
84 --name
=virDomainDefFree \
85 --name
=virDomainDeviceDefFree \
86 --name
=virDomainDiskDefFree \
87 --name
=virDomainEventCallbackListFree \
88 --name
=virDomainEventFree \
89 --name
=virDomainEventQueueFree \
90 --name
=virDomainFSDefFree \
91 --name
=virDomainGraphicsDefFree \
92 --name
=virDomainHostdevDefFree \
93 --name
=virDomainInputDefFree \
94 --name
=virDomainNetDefFree \
95 --name
=virDomainObjFree \
96 --name
=virDomainSnapshotDefFree \
97 --name
=virDomainSnapshotObjFree \
98 --name
=virDomainSoundDefFree \
99 --name
=virDomainVideoDefFree \
100 --name
=virDomainWatchdogDefFree \
101 --name
=virInterfaceDefFree \
102 --name
=virInterfaceIpDefFree \
103 --name
=virInterfaceObjFree \
104 --name
=virInterfaceProtocolDefFree \
105 --name
=virJSONValueFree \
106 --name
=virLastErrFreeData \
107 --name
=virNWFilterDefFree \
108 --name
=virNWFilterEntryFree \
109 --name
=virNWFilterHashTableFree \
110 --name
=virNWFilterIPAddrLearnReqFree \
111 --name
=virNWFilterIncludeDefFree \
112 --name
=virNWFilterPoolObjFree \
113 --name
=virNWFilterRuleDefFree \
114 --name
=virNWFilterRuleInstFree \
115 --name
=virNetworkDefFree \
116 --name
=virNetworkObjFree \
117 --name
=virNodeDeviceDefFree \
118 --name
=virNodeDeviceObjFree \
119 --name
=virSecretDefFree \
120 --name
=virStorageEncryptionFree \
121 --name
=virStorageEncryptionSecretFree \
122 --name
=virStoragePoolDefFree \
123 --name
=virStoragePoolObjFree \
124 --name
=virStoragePoolSourceFree \
125 --name
=virStorageVolDefFree \
127 --name
=xmlXPathFreeContext \
128 --name
=xmlXPathFreeObject
130 # The following template was generated by this command:
131 # make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
132 # N virBufferFreeAndReset
134 # y virCapabilitiesFree
135 # y virCapabilitiesFreeGuest
136 # y virCapabilitiesFreeGuestDomain
137 # y virCapabilitiesFreeGuestFeature
138 # y virCapabilitiesFreeGuestMachine
139 # y virCapabilitiesFreeHostNUMACell
140 # y virCapabilitiesFreeMachines
141 # N virCapabilitiesFreeNUMAInfo FIXME
143 # N virConfFree (diagnoses the "error")
146 # y virDomainChrDefFree
147 # y virDomainControllerDefFree
149 # y virDomainDeviceDefFree
150 # y virDomainDiskDefFree
151 # y virDomainEventCallbackListFree
152 # y virDomainEventFree
153 # y virDomainEventQueueFree
154 # y virDomainFSDefFree
156 # n virDomainFreeName (can't fix -- returns int)
157 # y virDomainGraphicsDefFree
158 # y virDomainHostdevDefFree
159 # y virDomainInputDefFree
160 # y virDomainNetDefFree
162 # y virDomainSnapshotDefFree
163 # n virDomainSnapshotFree (returns int)
164 # n virDomainSnapshotFreeName (returns int)
165 # y virDomainSnapshotObjFree
166 # y virDomainSoundDefFree
167 # y virDomainVideoDefFree
168 # y virDomainWatchdogDefFree
169 # n virDrvNodeGetCellsFreeMemory (returns int)
170 # n virDrvNodeGetFreeMemory (returns long long)
171 # n virFree (dereferences param)
173 # n virHashFree (takes 2 args)
174 # y virInterfaceDefFree
175 # n virInterfaceFree (returns int)
176 # n virInterfaceFreeName
177 # y virInterfaceIpDefFree
178 # y virInterfaceObjFree
179 # n virInterfaceObjListFree
180 # y virInterfaceProtocolDefFree
182 # y virLastErrFreeData
183 # y virNWFilterDefFree
184 # y virNWFilterEntryFree
185 # n virNWFilterFree (returns int)
186 # y virNWFilterHashTableFree
187 # y virNWFilterIPAddrLearnReqFree
188 # y virNWFilterIncludeDefFree
189 # n virNWFilterPoolFreeName (returns int)
190 # y virNWFilterPoolObjFree
191 # n virNWFilterPoolObjListFree FIXME
192 # y virNWFilterRuleDefFree
193 # n virNWFilterRuleFreeInstanceData (typedef)
194 # y virNWFilterRuleInstFree
195 # y virNetworkDefFree
196 # n virNetworkFree (returns int)
197 # n virNetworkFreeName (returns int)
198 # y virNetworkObjFree
199 # n virNetworkObjListFree FIXME
200 # n virNodeDevCapsDefFree FIXME
201 # y virNodeDeviceDefFree
202 # n virNodeDeviceFree (returns int)
203 # y virNodeDeviceObjFree
204 # n virNodeDeviceObjListFree FIXME
205 # n virNodeGetCellsFreeMemory (returns int)
206 # n virNodeGetFreeMemory (returns non-void)
208 # n virSecretFree (returns non-void)
209 # n virSecretFreeName (2 args)
210 # n virSecurityLabelDefFree FIXME
211 # n virStorageBackendDiskMakeFreeExtent (returns non-void)
212 # y virStorageEncryptionFree
213 # y virStorageEncryptionSecretFree
214 # n virStorageFreeType (enum)
215 # y virStoragePoolDefFree
216 # n virStoragePoolFree (returns non-void)
217 # n virStoragePoolFreeName (returns non-void)
218 # y virStoragePoolObjFree
219 # n virStoragePoolObjListFree FIXME
220 # y virStoragePoolSourceFree
221 # y virStorageVolDefFree
222 # n virStorageVolFree (returns non-void)
223 # n virStorageVolFreeName (returns non-void)
226 # Avoid uses of write(2). Either switch to streams (fwrite), or use
227 # the safewrite wrapper.
229 @prohibit
='\<write *\(' \
230 in_vc_files
='\.c$$' \
231 halt
='consider using safewrite instead of write' \
234 # Use STREQ rather than comparing strcmp == 0, or != 0.
235 # Similarly, use STREQLEN or STRPREFIX rather than strncmp.
236 sc_prohibit_strcmp_and_strncmp
:
237 @prohibit
='strn?cmp *\(' \
238 halt
='use STREQ() in place of the above uses of str[n]cmp' \
241 # Use virAsprintf rather than a'sprintf since *strp is undefined on error.
242 sc_prohibit_asprintf
:
243 @prohibit
='\<[a]sprintf\>' \
244 halt
='use virAsprintf, not a'sprintf \
248 @prohibit
='strncpy *\(' \
249 halt
='use virStrncpy, not strncpy' \
252 sc_prohibit_readlink
:
253 @prohibit
='readlink *\(' \
254 halt
='use virFileResolveLink, not readlink' \
257 sc_prohibit_gethostname
:
258 @prohibit
='gethostname *\(' \
259 halt
='use virGetHostname, not gethostname' \
262 sc_prohibit_gettext_noop
:
263 @prohibit
='gettext_noop *\(' \
264 halt
='use N_, not gettext_noop' \
267 sc_prohibit_VIR_ERR_NO_MEMORY
:
268 @prohibit
='\<V''IR_ERR_NO_MEMORY\>' \
269 halt
='use virReportOOMError, not V'IR_ERR_NO_MEMORY \
272 # Use a subshell for each function, to give the optimal warning message.
273 include $(srcdir)/Makefile.nonreentrant
274 sc_prohibit_nonreentrant
:
276 for i in
$(NON_REENTRANT
) ; \
278 (prohibit
="\\<$$i *\\(" \
279 halt
="use $${i}_r, not $$i" \
280 $(_sc_search_regexp
) \
285 # Prohibit the inclusion of <ctype.h>.
287 @prohibit
='^# *include *<ctype\.h>' \
288 halt
="don't use ctype.h; instead, use c-ctype.h" \
291 # Ensure that no C source file or rng schema uses TABs for
292 # indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
293 # files in gnulib, since they're imported.
294 sc_TAB_in_indentation
:
296 in_vc_files
='(\.(rng|[ch](\.in)?)|(daemon|tools)/.*\.in)$$' \
297 halt
='use spaces, not TAB, for indentation in C, sh, and RNG schemas' \
300 ctype_re
= isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
301 |isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
303 sc_avoid_ctype_macros
:
304 @prohibit
='\b($(ctype_re)) *\(' \
305 halt
="don't use ctype macros (use c-ctype.h)" \
308 sc_prohibit_virBufferAdd_with_string_literal
:
309 @prohibit
='\<virBufferAdd *\([^,]+, *"[^"]' \
310 halt
='use virBufferAddLit, not virBufferAdd, with a string literal' \
313 # Not only do they fail to deal well with ipv6, but the gethostby*
314 # functions are also not thread-safe.
315 sc_prohibit_gethostby
:
316 @prohibit
='\<gethostby(addr|name2?) *\(' \
317 halt
='use getaddrinfo, not gethostby*' \
320 # Many of the function names below came from this filter:
321 # git grep -B2 '\<_('|grep -E '\.c- *[[:alpha:]_][[:alnum:]_]* ?\(.*[,;]$' \
322 # |sed 's/.*\.c- *//'|perl -pe 's/ ?\(.*//'|sort -u \
323 # |grep -vE '^(qsort|if|close|assert|fputc|free|N_|vir.*GetName|.*Unlock|virNodeListDevices|virHashRemoveEntry|freeaddrinfo|.*[fF]ree|xdrmem_create|xmlXPathFreeObject|virUUIDFormat|openvzSetProgramSentinal|polkit_action_unref)$'
326 msg_gen_function
+= ESX_ERROR
327 msg_gen_function
+= ESX_VI_ERROR
328 msg_gen_function
+= macvtapError
329 msg_gen_function
+= remoteError
330 msg_gen_function
+= lxcError
331 msg_gen_function
+= networkLog
332 msg_gen_function
+= networkReportError
333 msg_gen_function
+= oneError
334 msg_gen_function
+= openvzError
335 msg_gen_function
+= qemudDispatchClientFailure
336 msg_gen_function
+= qemudReportError
337 msg_gen_function
+= regerror
338 msg_gen_function
+= remoteDispatchFormatError
339 msg_gen_function
+= umlReportError
340 msg_gen_function
+= vboxError
341 msg_gen_function
+= virConfError
342 msg_gen_function
+= virDomainReportError
343 msg_gen_function
+= virSecurityReportError
344 msg_gen_function
+= virHashError
345 msg_gen_function
+= virLibConnError
346 msg_gen_function
+= virLibDomainError
347 msg_gen_function
+= virNetworkReportError
348 msg_gen_function
+= virNodeDeviceReportError
349 msg_gen_function
+= virProxyError
350 msg_gen_function
+= virRaiseError
351 msg_gen_function
+= virReportErrorHelper
352 msg_gen_function
+= virReportSystemError
353 msg_gen_function
+= virSexprError
354 msg_gen_function
+= virStorageReportError
355 msg_gen_function
+= virXMLError
356 msg_gen_function
+= virXenInotifyError
357 msg_gen_function
+= virXenStoreError
358 msg_gen_function
+= virXendError
359 msg_gen_function
+= xenapiSessionErrorHandler
360 msg_gen_function
+= xenUnifiedError
361 msg_gen_function
+= xenXMError
362 msg_gen_function
+= VIR_ERROR
363 msg_gen_function
+= VIR_ERROR0
365 # Uncomment the following and run "make syntax-check" to see diagnostics
366 # that are not yet marked for translation, but that need to be rewritten
367 # so that they are translatable.
368 # msg_gen_function += fprintf
369 # msg_gen_function += testError
370 # msg_gen_function += virXenError
371 # msg_gen_function += vshPrint
372 # msg_gen_function += vshError
374 func_or
:= $(shell printf
'$(msg_gen_function)'|tr
-s
'[[:space:]]' '|')
375 func_re
:= ($(func_or
))
377 # Look for diagnostics that aren't marked for translation.
378 # This won't find any for which error's format string is on a separate line.
379 # The sed filters eliminate false-positives like these:
381 # "%s", _("no storage vol w..."
382 sc_libvirt_unmarked_diagnostics
:
384 '\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT
)) \
385 | grep
-v
'_''(' && \
386 { echo
'$(ME): found unmarked diagnostic(s)' 1>&2; \
388 @
{ grep
-nE
'\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT
)); \
389 grep
-A1
-nE
'\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT
)); } \
390 | sed
's/_("[^"][^"]*"//;s/[ ]"%s"//' \
392 { echo
'$(ME): found unmarked diagnostic(s)' 1>&2; \
395 # Like the above, but prohibit a newline at the end of a diagnostic.
396 # This is subject to false positives partly because it naively looks for
397 # `\n"', which may not be the end of the string, and also because it takes
398 # two lines of context (the -A2) after the line with the function name.
399 # FIXME: this rule might benefit from a separate function list, in case
400 # there are functions to which this one applies but that do not get marked
402 sc_prohibit_newline_at_end_of_diagnostic
:
404 '\<$(func_re) *\(' $$($(VC_LIST_EXCEPT
)) \
406 && { echo
'$(ME): newline at end of message(s)' 1>&2; \
409 # Regex for grep -E that exempts generated files from style rules.
410 preprocessor_exempt
= ((qemu|remote
)_
(driver|protocol
)\.h
)$$
411 # Enforce recommended preprocessor indentation style.
412 sc_preprocessor_indentation
:
413 @if cppi
--version
>/dev
/null
2>&1; then \
414 $(VC_LIST_EXCEPT
) | grep
'\.[ch]$$' \
415 | grep
-vE
'$(preprocessor_exempt)' | xargs cppi
-a
-c \
416 ||
{ echo
'$(ME): incorrect preprocessor indentation' 1>&2; \
419 echo
'$(ME): skipping test $@: cppi not installed' 1>&2; \
423 @require
='Copyright .*Red 'Hat
', Inc\.' \
424 containing
='Copyright .*Red 'Hat \
425 halt
='Red Hat copyright is missing Inc.' \
427 @prohibit
='Copyright [^(].*Red 'Hat \
428 halt
='consistently use (C) in Red Hat copyright' \
431 # Some functions/macros produce messages intended solely for developers
432 # and maintainers. Do not mark them for translation.
433 sc_prohibit_gettext_markup
:
434 @prohibit
='\<VIR_(WARN|DEBUG)0? *\(_\(' \
435 halt
='do not mark these strings for translation' \
438 # We don't use this feature of maint.mk.
439 prev_version_file
= /dev
/null
441 ifeq (0,$(MAKELEVEL
))
442 _curr_status
= .git-module-status
443 # The sed filter accommodates those who check out on a commit from which
444 # no tag is reachable. In that case, git submodule status prints a "-"
445 # in column 1 and does not print a "git describe"-style string after the
446 # submodule name. Contrast these:
447 # -b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib
448 # b653eda3ac4864de205419d9f41eec267cb89eeb .gnulib (v0.0-2286-gb653eda)
449 # $ cat .git-module-status
450 # b653eda3ac4864de205419d9f41eec267cb89eeb
451 _submodule_hash
= sed
's/^[ +-]//;s/ .*//'
452 _update_required
:= $(shell \
454 test -f po
/Makevars ||
{ echo
1; exit
; }; \
455 actual
=$$(git submodule status |
$(_submodule_hash
); \
456 git hash-object bootstrap.conf
; \
458 stamp
="$$($(_submodule_hash) $(_curr_status) 2>/dev/null)"; \
459 test "$$stamp" = "$$actual"; echo
$$?
)
460 _clean_requested
= $(filter %clean,$(MAKECMDGOALS
))
461 ifeq (1,$(_update_required
)$(_clean_requested
))
462 $(info INFO
: gnulib update required
; running .
/autogen.sh first
)
467 # Give credit where due:
468 # Ensure that each commit author email address (possibly mapped via
469 # git log's .mailmap) appears in our AUTHORS file.
470 sc_check_author_list
:
472 for i in
$$(git log
--pretty
=format
:%aE
%n|
sort -u|grep
-v
'^$$'); do \
473 sanitized
=$$(echo
"$$i"|LC_ALL
=C sed
's/\([^a-zA-Z0-9_@-]\)/\\\1/g'); \
474 grep
-iq
"<$$sanitized>" $(srcdir)/AUTHORS \
475 ||
{ printf
'%s\n' "$$i" >&2; fail
=1; }; \
478 && echo
'$(ME): committer(s) not listed in AUTHORS' >&2; \
481 # It is necessary to call autogen any time gnulib changes. Autogen
482 # reruns configure, then we regenerate all Makefiles at once.
488 # Exempt @...@ uses of these symbols.
489 _makefile_at_at_check_exceptions
= ' && !/(SCHEMA|SYSCONF)DIR/'