20 | 20 |
# ME := $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))
|
21 | 21 |
ME := $(_build-aux)/maint.mk
|
22 | 22 |
|
23 | |
# Diagnostic for continued use of deprecated variable.
|
24 | |
# Remove in 2013
|
25 | |
ifneq ($(build_aux),)
|
26 | |
$(error "$(ME): \
|
27 | |
set $$(_build-aux) relative to $$(srcdir) instead of $$(build_aux)")
|
28 | |
endif
|
29 | |
|
30 | |
# Do not save the original name or timestamp in the .tar.gz file.
|
31 | |
# Use --rsyncable if available.
|
32 | |
gzip_rsyncable := \
|
33 | |
$(shell gzip --help 2>/dev/null|grep rsyncable >/dev/null \
|
34 | |
&& printf %s --rsyncable)
|
35 | |
GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
|
36 | |
|
37 | 23 |
GIT = git
|
38 | 24 |
VC = $(GIT)
|
39 | 25 |
|
|
68 | 54 |
| grep -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \
|
69 | 55 |
$(_prepend_srcdir_prefix)
|
70 | 56 |
|
71 | |
ifeq ($(origin prev_version_file), undefined)
|
72 | |
prev_version_file = $(srcdir)/.prev-version
|
73 | |
endif
|
74 | |
|
75 | |
PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null)
|
76 | |
VERSION_REGEXP = $(subst .,\.,$(VERSION))
|
77 | |
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
|
78 | |
|
79 | |
ifeq ($(VC),$(GIT))
|
80 | |
this-vc-tag = v$(VERSION)
|
81 | |
this-vc-tag-regexp = v$(VERSION_REGEXP)
|
82 | |
else
|
83 | |
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
|
84 | |
tag-this-version = $(subst .,_,$(VERSION))
|
85 | |
this-vc-tag = $(tag-package)-$(tag-this-version)
|
86 | |
this-vc-tag-regexp = $(this-vc-tag)
|
87 | |
endif
|
88 | 57 |
my_distdir = $(PACKAGE)-$(VERSION)
|
89 | |
|
90 | |
# Old releases are stored here.
|
91 | |
release_archive_dir ?= ../release
|
92 | |
|
93 | |
# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
|
94 | |
# Use alpha.gnu.org for alpha and beta releases.
|
95 | |
# Use ftp.gnu.org for stable releases.
|
96 | |
gnu_ftp_host-alpha = alpha.gnu.org
|
97 | |
gnu_ftp_host-beta = alpha.gnu.org
|
98 | |
gnu_ftp_host-stable = ftp.gnu.org
|
99 | |
gnu_rel_host ?= $(gnu_ftp_host-$(RELEASE_TYPE))
|
100 | |
|
101 | |
ifeq ($(gnu_rel_host),ftp.gnu.org)
|
102 | |
url_dir_list ?= http://ftpmirror.gnu.org/$(PACKAGE)
|
103 | |
else
|
104 | |
url_dir_list ?= ftp://$(gnu_rel_host)/gnu/$(PACKAGE)
|
105 | |
endif
|
106 | |
|
107 | |
# Override this in cfg.mk if you are using a different format in your
|
108 | |
# NEWS file.
|
109 | |
today = $(shell date +%Y-%m-%d)
|
110 | |
|
111 | |
# Select which lines of NEWS are searched for $(news-check-regexp).
|
112 | |
# This is a sed line number spec. The default says that we search
|
113 | |
# lines 1..10 of NEWS for $(news-check-regexp).
|
114 | |
# If you want to search only line 3 or only lines 20-22, use "3" or "20,22".
|
115 | |
news-check-lines-spec ?= 1,10
|
116 | |
news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
|
117 | 58 |
|
118 | 59 |
# Prevent programs like 'sort' from considering distinct strings to be equal.
|
119 | 60 |
# Doing it here saves us from having to set LC_ALL elsewhere in this file.
|
|
730 | 671 |
halt='found useless parentheses in cpp directive' \
|
731 | 672 |
$(_sc_search_regexp)
|
732 | 673 |
|
733 | |
# List headers for which HAVE_HEADER_H is always true, assuming you are
|
734 | |
# using the appropriate gnulib module. CAUTION: for each "unnecessary"
|
735 | |
# #if HAVE_HEADER_H that you remove, be sure that your project explicitly
|
736 | |
# requires the gnulib module that guarantees the usability of that header.
|
737 | |
gl_assured_headers_ = \
|
738 | |
cd $(gnulib_dir)/lib && echo *.in.h|sed 's/\.in\.h//g'
|
739 | |
|
740 | |
# Convert the list of names to upper case, and replace each space with "|".
|
741 | |
az_ = abcdefghijklmnopqrstuvwxyz
|
742 | |
AZ_ = ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
743 | |
gl_header_upper_case_or_ = \
|
744 | |
$$($(gl_assured_headers_) \
|
745 | |
| tr $(az_)/.- $(AZ_)___ \
|
746 | |
| tr -s ' ' '|' \
|
747 | |
)
|
748 | |
sc_prohibit_always_true_header_tests:
|
749 | |
@or=$(gl_header_upper_case_or_); \
|
750 | |
re="HAVE_($$or)_H"; \
|
751 | |
prohibit='\<'"$$re"'\>' \
|
752 | |
halt=$$(printf '%s\n' \
|
753 | |
'do not test the above HAVE_<header>_H symbol(s);' \
|
754 | |
' with the corresponding gnulib module, they are always true') \
|
755 | |
$(_sc_search_regexp)
|
756 | |
|
757 | |
# ==================================================================
|
758 | |
gl_other_headers_ ?= \
|
759 | |
intprops.h \
|
760 | |
openat.h \
|
761 | |
stat-macros.h
|
762 | |
|
763 | |
# Perl -lne code to extract "significant" cpp-defined symbols from a
|
764 | |
# gnulib header file, eliminating a few common false-positives.
|
765 | |
# The exempted names below are defined only conditionally in gnulib,
|
766 | |
# and hence sometimes must/may be defined in application code.
|
767 | |
gl_extract_significant_defines_ = \
|
768 | |
/^\# *define ([^_ (][^ (]*)(\s*\(|\s+\w+)/\
|
769 | |
&& $$2 !~ /(?:rpl_|_used_without_)/\
|
770 | |
&& $$1 !~ /^(?:NSIG|ENODATA)$$/\
|
771 | |
&& $$1 !~ /^(?:SA_RESETHAND|SA_RESTART)$$/\
|
772 | |
and print $$1
|
773 | |
|
774 | |
# Create a list of regular expressions matching the names
|
775 | |
# of macros that are guaranteed to be defined by parts of gnulib.
|
776 | |
define def_sym_regex
|
777 | |
gen_h=$(gl_generated_headers_); \
|
778 | |
(cd $(gnulib_dir)/lib; \
|
779 | |
for f in *.in.h $(gl_other_headers_); do \
|
780 | |
test -f $$f \
|
781 | |
&& perl -lne '$(gl_extract_significant_defines_)' $$f; \
|
782 | |
done; \
|
783 | |
) | sort -u \
|
784 | |
| sed 's/^/^ *# *(define|undef) */;s/$$/\\>/'
|
785 | |
endef
|
786 | |
|
787 | |
# Don't define macros that we already get from gnulib header files.
|
788 | |
sc_prohibit_always-defined_macros:
|
789 | |
@if test -d $(gnulib_dir); then \
|
790 | |
case $$(echo all: | grep -l -f - Makefile) in Makefile);; *) \
|
791 | |
echo '$(ME): skipping $@: you lack GNU grep' 1>&2; exit 0;; \
|
792 | |
esac; \
|
793 | |
$(def_sym_regex) | grep -E -f - $$($(VC_LIST_EXCEPT)) \
|
794 | |
&& { echo '$(ME): define the above via some gnulib .h file' \
|
795 | |
1>&2; exit 1; } || :; \
|
796 | |
fi
|
797 | |
# ==================================================================
|
798 | |
|
799 | 674 |
# Prohibit checked in backup files.
|
800 | 675 |
sc_prohibit_backup_files:
|
801 | 676 |
@$(VC_LIST) | grep '~$$' && \
|
|
987 | 862 |
echo 1>&2 '$(ME): add "const" to the above declarations'; \
|
988 | 863 |
exit 1; } || :
|
989 | 864 |
|
990 | |
NEWS_hash = \
|
991 | |
$$(sed -n '/^\*.* $(PREV_VERSION_REGEXP) ([0-9-]*)/,$$p' \
|
992 | |
$(srcdir)/NEWS \
|
993 | |
| perl -0777 -pe \
|
994 | |
's/^Copyright.+?Free\sSoftware\sFoundation,\sInc\.\n//ms' \
|
995 | |
| md5sum - \
|
996 | |
| sed 's/ .*//')
|
997 | |
|
998 | |
# Ensure that we don't accidentally insert an entry into an old NEWS block.
|
999 | |
sc_immutable_NEWS:
|
1000 | |
@if test -f $(srcdir)/NEWS; then \
|
1001 | |
test "$(NEWS_hash)" = '$(old_NEWS_hash)' && : || \
|
1002 | |
{ echo '$(ME): you have modified old NEWS' 1>&2; exit 1; }; \
|
1003 | |
fi
|
1004 | |
|
1005 | |
# Update the hash stored above. Do this after each release and
|
1006 | |
# for any corrections to old entries.
|
1007 | |
update-NEWS-hash: NEWS
|
1008 | |
perl -pi -e 's/^(old_NEWS_hash[ \t]+:?=[ \t]+).*/$${1}'"$(NEWS_hash)/" \
|
1009 | |
$(srcdir)/$(_build-aux)/cfg.mk
|
1010 | |
|
1011 | 865 |
# Ensure that we use only the standard $(VAR) notation,
|
1012 | 866 |
# not @...@ in Makefile.am, now that we can rely on automake
|
1013 | 867 |
# to emit a definition for each substituted variable.
|
|
1029 | 883 |
-e 'and (print "$$ARGV:$$.: $$_"), $$m=1; END {exit !$$m}' \
|
1030 | 884 |
$$($(VC_LIST_EXCEPT) | grep -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
|
1031 | 885 |
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
|
1032 | |
|
1033 | |
news-check: NEWS
|
1034 | |
if sed -n $(news-check-lines-spec)p $(srcdir)/NEWS \
|
1035 | |
| grep -E $(news-check-regexp) >/dev/null; then \
|
1036 | |
:; \
|
1037 | |
else \
|
1038 | |
echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2; \
|
1039 | |
exit 1; \
|
1040 | |
fi
|
1041 | 886 |
|
1042 | 887 |
sc_makefile_TAB_only_indentation:
|
1043 | 888 |
@prohibit='^ [ ]{8}' \
|
|
1099 | 944 |
halt=$(msg) \
|
1100 | 945 |
$(_sc_search_regexp)
|
1101 | 946 |
|
1102 | |
# Check that `make alpha' will not fail at the end of the process,
|
1103 | |
# i.e., when pkg-M.N.tar.xz already exists (either in "." or in ../release)
|
1104 | |
# and is read-only.
|
1105 | |
writable-files:
|
1106 | |
if test -d $(release_archive_dir); then \
|
1107 | |
for file in $(DIST_ARCHIVES); do \
|
1108 | |
for p in ./ $(release_archive_dir)/; do \
|
1109 | |
test -e $$p$$file || continue; \
|
1110 | |
test -w $$p$$file \
|
1111 | |
|| { echo ERROR: $$p$$file is not writable; fail=1; }; \
|
1112 | |
done; \
|
1113 | |
done; \
|
1114 | |
test "$$fail" && exit 1 || : ; \
|
1115 | |
else :; \
|
1116 | |
fi
|
1117 | |
|
1118 | |
v_etc_file = $(gnulib_dir)/lib/version-etc.c
|
1119 | |
sample-test = tests/sample-test
|
1120 | |
texi = doc/$(PACKAGE).texi
|
1121 | |
# Make sure that the copyright date in $(v_etc_file) is up to date.
|
1122 | |
# Do the same for the $(sample-test) and the main doc/.texi file.
|
1123 | |
sc_copyright_check:
|
1124 | |
@require='enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' \
|
1125 | |
in_files=$(v_etc_file) \
|
1126 | |
halt='out of date copyright in $(v_etc_file); update it' \
|
1127 | |
$(_sc_search_regexp)
|
1128 | |
@require='# Copyright \(C\) '$$(date +%Y)' Free' \
|
1129 | |
in_vc_files=$(sample-test) \
|
1130 | |
halt='out of date copyright in $(sample-test); update it' \
|
1131 | |
$(_sc_search_regexp)
|
1132 | |
@require='Copyright @copyright\{\} .*'$$(date +%Y)' Free' \
|
1133 | |
in_vc_files=$(texi) \
|
1134 | |
halt='out of date copyright in $(texi); update it' \
|
1135 | |
$(_sc_search_regexp)
|
1136 | |
|
1137 | 947 |
# If tests/help-version exists and seems to be new enough, assume that its
|
1138 | 948 |
# use of init.sh and path_prepend_ is correct, and ensure that every other
|
1139 | 949 |
# use of init.sh is identical.
|
|
1187 | 997 |
' "make dist*" rules, and upgrade to fixed automake' \
|
1188 | 998 |
' see http://bugzilla.redhat.com/542609 for details') \
|
1189 | 999 |
$(_sc_search_regexp)
|
1190 | |
|
1191 | |
vc-diff-check:
|
1192 | |
(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
|
1193 | |
if test -s vc-diffs; then \
|
1194 | |
cat vc-diffs; \
|
1195 | |
echo "Some files are locally modified:" 1>&2; \
|
1196 | |
exit 1; \
|
1197 | |
else \
|
1198 | |
rm vc-diffs; \
|
1199 | |
fi
|
1200 | |
|
1201 | |
rel-files = $(DIST_ARCHIVES)
|
1202 | |
|
1203 | |
gnulib_dir ?= $(srcdir)/gnulib
|
1204 | |
gnulib-version = $$(cd $(gnulib_dir) && git describe)
|
1205 | |
bootstrap-tools ?= autoconf,automake,gnulib
|
1206 | |
|
1207 | |
# If it's not already specified, derive the GPG key ID from
|
1208 | |
# the signed tag we've just applied to mark this release.
|
1209 | |
gpg_key_ID ?= \
|
1210 | |
$$(git cat-file tag v$(VERSION) > .ann-sig \
|
1211 | |
&& gpgv .ann-sig - < /dev/null 2>&1 \
|
1212 | |
| sed -n '/.*key ID \([0-9A-F]*\)/s//\1/p'; rm -f .ann-sig)
|
1213 | |
|
1214 | |
translation_project_ ?= coordinator@translationproject.org
|
1215 | |
|
1216 | |
# Make info-gnu the default only for a stable release.
|
1217 | |
ifeq ($(RELEASE_TYPE),stable)
|
1218 | |
announcement_Cc_ ?= $(translation_project_), $(PACKAGE_BUGREPORT)
|
1219 | |
announcement_mail_headers_ ?= \
|
1220 | |
To: info-gnu@gnu.org \
|
1221 | |
Cc: $(announcement_Cc_) \
|
1222 | |
Mail-Followup-To: $(PACKAGE_BUGREPORT)
|
1223 | |
else
|
1224 | |
announcement_Cc_ ?= $(translation_project_)
|
1225 | |
announcement_mail_headers_ ?= \
|
1226 | |
To: $(PACKAGE_BUGREPORT) \
|
1227 | |
Cc: $(announcement_Cc_)
|
1228 | |
endif
|
1229 | |
|
1230 | |
announcement: NEWS ChangeLog $(rel-files)
|
1231 | |
@$(srcdir)/$(_build-aux)/announce-gen \
|
1232 | |
--mail-headers='$(announcement_mail_headers_)' \
|
1233 | |
--release-type=$(RELEASE_TYPE) \
|
1234 | |
--package=$(PACKAGE) \
|
1235 | |
--prev=$(PREV_VERSION) \
|
1236 | |
--curr=$(VERSION) \
|
1237 | |
--gpg-key-id=$(gpg_key_ID) \
|
1238 | |
--news=$(srcdir)/NEWS \
|
1239 | |
--bootstrap-tools=$(bootstrap-tools) \
|
1240 | |
--gnulib-version=$(gnulib-version) \
|
1241 | |
--no-print-checksums \
|
1242 | |
$(addprefix --url-dir=, $(url_dir_list))
|
1243 | |
|
1244 | |
## ---------------- ##
|
1245 | |
## Updating files. ##
|
1246 | |
## ---------------- ##
|
1247 | |
|
1248 | |
ftp-gnu = ftp://ftp.gnu.org/gnu
|
1249 | |
www-gnu = http://www.gnu.org
|
1250 | |
|
1251 | |
upload_dest_dir_ ?= $(PACKAGE)
|
1252 | |
emit_upload_commands:
|
1253 | |
@echo =====================================
|
1254 | |
@echo =====================================
|
1255 | |
@echo "$(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS) \\"
|
1256 | |
@echo " --to $(gnu_rel_host):$(upload_dest_dir_) \\"
|
1257 | |
@echo " $(rel-files)"
|
1258 | |
@echo '# send the ~/announce-$(my_distdir) e-mail'
|
1259 | |
@echo =====================================
|
1260 | |
@echo =====================================
|
1261 | |
|
1262 | |
define emit-commit-log
|
1263 | |
printf '%s\n' 'maint: post-release administrivia' '' \
|
1264 | |
'* NEWS: Add header line for next release.' \
|
1265 | |
'* .prev-version: Record previous version.' \
|
1266 | |
'* cfg.mk (old_NEWS_hash): Auto-update.'
|
1267 | |
endef
|
1268 | |
|
1269 | |
.PHONY: no-submodule-changes
|
1270 | |
no-submodule-changes:
|
1271 | |
if test -d $(srcdir)/.git; then \
|
1272 | |
diff=$$(cd $(srcdir) && git submodule -q foreach \
|
1273 | |
git diff-index --name-only HEAD) \
|
1274 | |
|| exit 1; \
|
1275 | |
case $$diff in '') ;; \
|
1276 | |
*) echo '$(ME): submodule files are locally modified:'; \
|
1277 | |
echo "$$diff"; exit 1;; esac; \
|
1278 | |
else \
|
1279 | |
: ; \
|
1280 | |
fi
|
1281 | |
|
1282 | |
submodule-checks ?= no-submodule-changes public-submodule-commit
|
1283 | |
|
1284 | |
# Ensure that each sub-module commit we're using is public.
|
1285 | |
# Without this, it is too easy to tag and release code that
|
1286 | |
# cannot be built from a fresh clone.
|
1287 | |
.PHONY: public-submodule-commit
|
1288 | |
public-submodule-commit:
|
1289 | |
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
|
1290 | |
cd $(srcdir) && \
|
1291 | |
git submodule --quiet foreach test '$$(git rev-parse $$sha1)' \
|
1292 | |
= '$$(git merge-base origin $$sha1)' \
|
1293 | |
|| { echo '$(ME): found non-public submodule commit' >&2; \
|
1294 | |
exit 1; }; \
|
1295 | |
else \
|
1296 | |
: ; \
|
1297 | |
fi
|
1298 | |
# This rule has a high enough utility/cost ratio that it should be a
|
1299 | |
# dependent of "check" by default. However, some of us do occasionally
|
1300 | |
# commit a temporary change that deliberately points to a non-public
|
1301 | |
# submodule commit, and want to be able to use rules like "make check".
|
1302 | |
# In that case, run e.g., "make check gl_public_submodule_commit="
|
1303 | |
# to disable this test.
|
1304 | |
gl_public_submodule_commit ?= public-submodule-commit
|
1305 | |
check: $(gl_public_submodule_commit)
|
1306 | |
|
1307 | |
.PHONY: alpha beta stable
|
1308 | |
ALL_RECURSIVE_TARGETS += alpha beta stable
|
1309 | |
alpha beta stable: $(local-check) writable-files $(submodule-checks)
|
1310 | |
test $@ = stable \
|
1311 | |
&& { echo $(VERSION) | grep -E '^[0-9]+(\.[0-9]+)+$$' \
|
1312 | |
|| { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
|
1313 | |
|| :
|
1314 | |
$(MAKE) vc-diff-check
|
1315 | |
$(MAKE) news-check
|
1316 | |
$(MAKE) distcheck
|
1317 | |
$(MAKE) dist XZ_OPT=-9ev
|
1318 | |
$(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
|
1319 | |
$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
|
1320 | |
|
1321 | |
# Override this in cfg.mk if you follow different procedures.
|
1322 | |
release-prep-hook ?= release-prep
|
1323 | |
|
1324 | |
gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?]
|
1325 | |
.PHONY: release-prep
|
1326 | |
release-prep:
|
1327 | |
case $$RELEASE_TYPE in alpha|beta|stable) ;; \
|
1328 | |
*) echo "invalid RELEASE_TYPE: $$RELEASE_TYPE" 1>&2; exit 1;; esac
|
1329 | |
$(MAKE) --no-print-directory -s announcement > ~/announce-$(my_distdir)
|
1330 | |
if test -d $(release_archive_dir); then \
|
1331 | |
ln $(rel-files) $(release_archive_dir); \
|
1332 | |
chmod a-w $(rel-files); \
|
1333 | |
fi
|
1334 | |
echo $(VERSION) > $(prev_version_file)
|
1335 | |
$(MAKE) update-NEWS-hash
|
1336 | |
perl -pi -e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' NEWS
|
1337 | |
$(emit-commit-log) > .ci-msg
|
1338 | |
$(VC) commit -F .ci-msg -a
|
1339 | |
rm .ci-msg
|
1340 | |
|
1341 | |
# Override this with e.g., -s $(srcdir)/some_other_name.texi
|
1342 | |
# if the default $(PACKAGE)-derived name doesn't apply.
|
1343 | |
gendocs_options_ ?=
|
1344 | |
|
1345 | |
.PHONY: web-manual
|
1346 | |
web-manual:
|
1347 | |
@test -z "$(manual_title)" \
|
1348 | |
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
|
1349 | |
@cd '$(srcdir)/doc'; \
|
1350 | |
$(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \
|
1351 | |
-o '$(abs_builddir)/doc/manual' \
|
1352 | |
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
|
1353 | |
"$(PACKAGE_NAME) - $(manual_title)"
|
1354 | |
@echo " *** Upload the doc/manual directory to web-cvs."
|
1355 | |
|
1356 | |
# Code Coverage
|
1357 | |
|
1358 | |
init-coverage:
|
1359 | |
$(MAKE) $(AM_MAKEFLAGS) clean
|
1360 | |
lcov --directory . --zerocounters
|
1361 | |
|
1362 | |
COVERAGE_CCOPTS ?= "-g --coverage"
|
1363 | |
COVERAGE_OUT ?= doc/coverage
|
1364 | |
|
1365 | |
build-coverage:
|
1366 | |
$(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS)
|
1367 | |
$(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check
|
1368 | |
mkdir -p $(COVERAGE_OUT)
|
1369 | |
lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
|
1370 | |
--capture
|
1371 | |
|
1372 | |
gen-coverage:
|
1373 | |
genhtml --output-directory $(COVERAGE_OUT) \
|
1374 | |
$(COVERAGE_OUT)/$(PACKAGE).info \
|
1375 | |
--highlight --frames --legend \
|
1376 | |
--title "$(PACKAGE_NAME)"
|
1377 | |
|
1378 | |
coverage: init-coverage build-coverage gen-coverage
|
1379 | |
|
1380 | |
# Update gettext files.
|
1381 | |
PACKAGE ?= $(shell basename $(PWD))
|
1382 | |
PO_DOMAIN ?= $(PACKAGE)
|
1383 | |
POURL = http://translationproject.org/latest/$(PO_DOMAIN)/
|
1384 | |
PODIR ?= po
|
1385 | |
refresh-po:
|
1386 | |
rm -f $(PODIR)/*.po && \
|
1387 | |
echo "$(ME): getting translations into po (please ignore the robots.txt ERROR 404)..." && \
|
1388 | |
wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \
|
1389 | |
echo 'en@boldquot' > $(PODIR)/LINGUAS && \
|
1390 | |
echo 'en@quot' >> $(PODIR)/LINGUAS && \
|
1391 | |
ls $(PODIR)/*.po | sed 's/\.po//' | sed 's,$(PODIR)/,,' | sort >> $(PODIR)/LINGUAS
|
1392 | |
|
1393 | |
# Running indent once is not idempotent, but running it twice is.
|
1394 | |
INDENT_SOURCES ?= $(C_SOURCES)
|
1395 | |
.PHONY: indent
|
1396 | |
indent:
|
1397 | |
indent $(INDENT_SOURCES)
|
1398 | |
indent $(INDENT_SOURCES)
|
1399 | |
|
1400 | |
# If you want to set UPDATE_COPYRIGHT_* environment variables,
|
1401 | |
# put the assignments in this variable.
|
1402 | |
update-copyright-env ?=
|
1403 | |
|
1404 | |
# Run this rule once per year (usually early in January)
|
1405 | |
# to update all FSF copyright year lists in your project.
|
1406 | |
# If you have an additional project-specific rule,
|
1407 | |
# add it in cfg.mk along with a line 'update-copyright: prereq'.
|
1408 | |
# By default, exclude all variants of COPYING; you can also
|
1409 | |
# add exemptions (such as ChangeLog..* for rotated change logs)
|
1410 | |
# in the file .x-update-copyright.
|
1411 | |
.PHONY: update-copyright
|
1412 | |
update-copyright:
|
1413 | |
grep -l -w Copyright \
|
1414 | |
$$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
|
1415 | |
| $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@
|
1416 | |
|
1417 | |
# This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not
|
1418 | |
# overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS.
|
1419 | |
|
1420 | |
# NOTE: to override any _gl_TS_* default value, you must
|
1421 | |
# define the variable(s) using "export" in cfg.mk.
|
1422 | |
_gl_TS_dir ?= src
|
1423 | |
|
1424 | |
ALL_RECURSIVE_TARGETS += sc_tight_scope
|
1425 | |
sc_tight_scope: tight-scope.mk
|
1426 | |
@fail=0; \
|
1427 | |
if ! grep '^ *export _gl_TS_headers *=' $(srcdir)/$(_build-aux)/cfg.mk \
|
1428 | |
> /dev/null \
|
1429 | |
&& ! grep -w noinst_HEADERS $(srcdir)/$(_gl_TS_dir)/Makefile.am \
|
1430 | |
> /dev/null 2>&1; then \
|
1431 | |
echo '$(ME): skipping $@'; \
|
1432 | |
else \
|
1433 | |
$(MAKE) -s -C $(_gl_TS_dir) \
|
1434 | |
-f Makefile \
|
1435 | |
-f $(abs_top_srcdir)/$(_build-aux)/cfg.mk \
|
1436 | |
-f $(abs_top_builddir)/$< \
|
1437 | |
_gl_tight_scope \
|
1438 | |
|| fail=1; \
|
1439 | |
fi; \
|
1440 | |
rm -f $<; \
|
1441 | |
exit $$fail
|
1442 | |
|
1443 | |
tight-scope.mk: $(ME)
|
1444 | |
@rm -f $@ $@-t
|
1445 | |
@perl -ne '/^# TS-start/.../^# TS-end/ and print' $(ME) > $@-t
|
1446 | |
@chmod a=r $@-t && mv $@-t $@
|
1447 | |
|
1448 | |
ifeq (a,b)
|
1449 | |
# TS-start
|
1450 | |
|
1451 | |
# Most functions should have static scope.
|
1452 | |
# Any that don't must be marked with `extern', but `main'
|
1453 | |
# and `usage' are exceptions: they're always extern, but
|
1454 | |
# do not need to be marked. Symbols matching `__.*' are
|
1455 | |
# reserved by the compiler, so are automatically excluded below.
|
1456 | |
_gl_TS_unmarked_extern_functions ?= main usage
|
1457 | |
_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\S+) *\(/
|
1458 | |
|
1459 | |
# If your project uses a macro like "XTERN", then put
|
1460 | |
# the following in cfg.mk to override this default:
|
1461 | |
# export _gl_TS_extern = extern|XTERN
|
1462 | |
_gl_TS_extern ?= extern
|
1463 | |
|
1464 | |
# The second nm|grep checks for file-scope variables with `extern' scope.
|
1465 | |
# Without gnulib's progname module, you might put program_name here.
|
1466 | |
# Symbols matching `__.*' are reserved by the compiler,
|
1467 | |
# so are automatically excluded below.
|
1468 | |
_gl_TS_unmarked_extern_vars ?=
|
1469 | |
|
1470 | |
# NOTE: the _match variables are perl expressions -- not mere regular
|
1471 | |
# expressions -- so that you can extend them to match other patterns
|
1472 | |
# and easily extract matched variable names.
|
1473 | |
# For example, if your project declares some global variables via
|
1474 | |
# a macro like this: GLOBAL(type, var_name, initializer), then you
|
1475 | |
# can override this definition to automatically extract those names:
|
1476 | |
# export _gl_TS_var_match = \
|
1477 | |
# /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?\])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/
|
1478 | |
_gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?\])?;/
|
1479 | |
|
1480 | |
# The names of object files in (or relative to) $(_gl_TS_dir).
|
1481 | |
_gl_TS_obj_files ?= *.$(OBJEXT)
|
1482 | |
|
1483 | |
# Files in which to search for the one-line style extern declarations.
|
1484 | |
# $(_gl_TS_dir)-relative.
|
1485 | |
_gl_TS_headers ?= $(noinst_HEADERS)
|
1486 | |
|
1487 | |
.PHONY: _gl_tight_scope
|
1488 | |
_gl_tight_scope: $(bin_PROGRAMS)
|
1489 | |
t=exceptions-$$$$; \
|
1490 | |
trap 's=$$?; rm -f $$t; exit $$s' 0; \
|
1491 | |
for sig in 1 2 3 13 15; do \
|
1492 | |
eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \
|
1493 | |
done; \
|
1494 | |
src=`for f in $(SOURCES); do \
|
1495 | |
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
|
1496 | |
hdr=`for f in $(_gl_TS_headers); do \
|
1497 | |
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
|
1498 | |
( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_functions); \
|
1499 | |
grep -h -A1 '^extern .*[^;]$$' $$src \
|
1500 | |
| grep -vE '^(extern |--)' | sed 's/ .*//'; \
|
1501 | |
perl -lne \
|
1502 | |
'$(_gl_TS_function_match) and print "^$$1\$$"' $$hdr; \
|
1503 | |
) | sort -u > $$t; \
|
1504 | |
nm -e $(_gl_TS_obj_files) | sed -n 's/.* T //p'|grep -Ev -f $$t \
|
1505 | |
&& { echo the above functions should have static scope >&2; \
|
1506 | |
exit 1; } || : ; \
|
1507 | |
( printf '^%s$$\n' '__.*' $(_gl_TS_unmarked_extern_vars); \
|
1508 | |
perl -lne '$(_gl_TS_var_match) and print "^$$1\$$"' $$hdr *.h \
|
1509 | |
) | sort -u > $$t; \
|
1510 | |
nm -e $(_gl_TS_obj_files) | sed -n 's/.* [BCDGRS] //p' \
|
1511 | |
| sort -u | grep -Ev -f $$t \
|
1512 | |
&& { echo the above variables should have static scope >&2; \
|
1513 | |
exit 1; } || :
|
1514 | |
# TS-end
|
1515 | |
endif
|