提交 2931761f 编写于 作者: D Daniel P. Berrangé

build: remove all logic unrelated to syntax-check

The standard maint.mk from gnulib provides alot more than just the
'syntax-check' target. This can all be purged to give a more minimal
file.
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
Signed-off-by: NDaniel P. Berrangé <berrange@redhat.com>
上级 de744894
...@@ -38,48 +38,6 @@ include Makefile ...@@ -38,48 +38,6 @@ include Makefile
include $(srcdir)/$(_build-aux)/cfg.mk include $(srcdir)/$(_build-aux)/cfg.mk
include $(srcdir)/$(_build-aux)/maint.mk include $(srcdir)/$(_build-aux)/maint.mk
# Ensure that $(VERSION) is up to date for dist-related targets, but not
# for others: rerunning autoreconf and recompiling everything isn't cheap.
_have-git-version-gen := \
$(shell test -f $(srcdir)/$(_build-aux)/git-version-gen && echo yes)
ifeq ($(_have-git-version-gen)0,yes$(MAKELEVEL))
_is-dist-target ?= $(filter-out %clean, \
$(filter maintainer-% dist% alpha beta stable,$(MAKECMDGOALS)))
_is-install-target ?= $(filter-out %check, $(filter install%,$(MAKECMDGOALS)))
ifneq (,$(_is-dist-target)$(_is-install-target))
_curr-ver := $(shell cd $(srcdir) \
&& $(_build-aux)/git-version-gen \
.tarball-version \
$(git-version-gen-tag-sed-script))
ifneq ($(_curr-ver),$(VERSION))
ifeq ($(_curr-ver),UNKNOWN)
$(info WARNING: unable to verify if $(VERSION) is the correct version)
else
ifneq (,$(_is-install-target))
# GNU Coding Standards state that 'make install' should not cause
# recompilation after 'make all'. But as long as changing the version
# string alters config.h, the cost of having 'make all' always have an
# up-to-date version is prohibitive. So, as a compromise, we merely
# warn when installing a version string that is out of date; the user
# should run 'autoreconf' (or something like 'make distcheck') to
# fix the version, 'make all' to propagate it, then 'make install'.
$(info WARNING: version string $(VERSION) is out of date;)
$(info run '$(MAKE) _version' to fix it)
else
$(info INFO: running autoreconf for new version string: $(_curr-ver))
GNUmakefile: _version
touch GNUmakefile
endif
endif
endif
endif
endif
.PHONY: _version
_version:
cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
$(MAKE) $(AM_MAKEFLAGS) Makefile
else else
.DEFAULT_GOAL := abort-due-to-no-makefile .DEFAULT_GOAL := abort-due-to-no-makefile
......
...@@ -16,16 +16,6 @@ ...@@ -16,16 +16,6 @@
# along with this program. If not, see # along with this program. If not, see
# <http://www.gnu.org/licenses/>. # <http://www.gnu.org/licenses/>.
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for major releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-major = ftp.gnu.org
gnu_rel_host = $(gnu_ftp_host-$(RELEASE_TYPE))
url_dir_list = \
ftp://$(gnu_rel_host)/gnu/coreutils
# We use .gnulib, not gnulib. # We use .gnulib, not gnulib.
gnulib_dir = $(srcdir)/.gnulib gnulib_dir = $(srcdir)/.gnulib
......
...@@ -37,26 +37,6 @@ _sp = $(_empty) $(_empty) ...@@ -37,26 +37,6 @@ _sp = $(_empty) $(_empty)
# If S1 == S2, return S1, otherwise the empty string. # If S1 == S2, return S1, otherwise the empty string.
_equal = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1))) _equal = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1)))
# member-check,VARIABLE,VALID-VALUES
# ----------------------------------
# Check that $(VARIABLE) is in the space-separated list of VALID-VALUES, and
# return it. Die otherwise.
member-check = \
$(strip \
$(if $($(1)), \
$(if $(findstring $(_sp),$($(1))), \
$(error invalid $(1): '$($(1))', expected $(2)), \
$(or $(findstring $(_sp)$($(1))$(_sp),$(_sp)$(2)$(_sp)), \
$(error invalid $(1): '$($(1))', expected $(2)))), \
$(error $(1) undefined)))
# Do not save the original name or timestamp in the .tar.gz file.
# Use --rsyncable if available.
gzip_rsyncable := \
$(shell gzip --help 2>/dev/null|$(GREP) rsyncable >/dev/null \
&& printf %s --rsyncable)
GZIP_ENV = '--no-name --best $(gzip_rsyncable)'
GIT = git GIT = git
VC = $(GIT) VC = $(GIT)
...@@ -95,62 +75,10 @@ VC_LIST_EXCEPT = \ ...@@ -95,62 +75,10 @@ VC_LIST_EXCEPT = \
| $(GREP) -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \ | $(GREP) -Ev -e '($(VC_LIST_ALWAYS_EXCLUDE_REGEX)|$(_sc_excl))' \
$(_prepend_srcdir_prefix) $(_prepend_srcdir_prefix)
ifeq ($(origin prev_version_file), undefined)
prev_version_file = $(srcdir)/.prev-version
endif
PREV_VERSION := $(shell cat $(prev_version_file) 2>/dev/null)
VERSION_REGEXP = $(subst .,\.,$(VERSION))
PREV_VERSION_REGEXP = $(subst .,\.,$(PREV_VERSION))
ifeq ($(VC),$(GIT))
this-vc-tag = v$(VERSION)
this-vc-tag-regexp = v$(VERSION_REGEXP)
else
tag-package = $(shell echo "$(PACKAGE)" | tr '[:lower:]' '[:upper:]')
tag-this-version = $(subst .,_,$(VERSION))
this-vc-tag = $(tag-package)-$(tag-this-version)
this-vc-tag-regexp = $(this-vc-tag)
endif
my_distdir = $(PACKAGE)-$(VERSION)
# Old releases are stored here.
release_archive_dir ?= ../release
# If RELEASE_TYPE is undefined, but RELEASE is, use its second word.
# But overwrite VERSION.
ifdef RELEASE
VERSION := $(word 1, $(RELEASE))
RELEASE_TYPE ?= $(word 2, $(RELEASE))
endif
# Validate and return $(RELEASE_TYPE), or die.
RELEASE_TYPES = alpha beta stable
release-type = $(call member-check,RELEASE_TYPE,$(RELEASE_TYPES))
# Override gnu_rel_host and url_dir_list in cfg.mk if these are not right.
# Use alpha.gnu.org for alpha and beta releases.
# Use ftp.gnu.org for stable releases.
gnu_ftp_host-alpha = alpha.gnu.org
gnu_ftp_host-beta = alpha.gnu.org
gnu_ftp_host-stable = ftp.gnu.org
gnu_rel_host ?= $(gnu_ftp_host-$(release-type))
url_dir_list ?= $(if $(call _equal,$(gnu_rel_host),ftp.gnu.org), \
https://ftpmirror.gnu.org/$(PACKAGE), \
https://$(gnu_rel_host)/gnu/$(PACKAGE))
# Override this in cfg.mk if you are using a different format in your # Override this in cfg.mk if you are using a different format in your
# NEWS file. # NEWS file.
today = $(shell date +%Y-%m-%d) today = $(shell date +%Y-%m-%d)
# Select which lines of NEWS are searched for $(news-check-regexp).
# This is a sed line number spec. The default says that we search
# lines 1..10 of NEWS for $(news-check-regexp).
# If you want to search only line 3 or only lines 20-22, use "3" or "20,22".
news-check-lines-spec ?= 1,10
news-check-regexp ?= '^\*.* $(VERSION_REGEXP) \($(today)\)'
# Prevent programs like 'sort' from considering distinct strings to be equal. # Prevent programs like 'sort' from considering distinct strings to be equal.
# Doing it here saves us from having to set LC_ALL elsewhere in this file. # Doing it here saves us from having to set LC_ALL elsewhere in this file.
export LC_ALL = C export LC_ALL = C
...@@ -1181,15 +1109,6 @@ sc_makefile_at_at_check: ...@@ -1181,15 +1109,6 @@ sc_makefile_at_at_check:
$$($(VC_LIST_EXCEPT) | $(GREP) -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \ $$($(VC_LIST_EXCEPT) | $(GREP) -E '(^|/)(Makefile\.am|[^/]+\.mk)$$') \
&& { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || : && { echo '$(ME): use $$(...), not @...@' 1>&2; exit 1; } || :
news-check: NEWS
$(AM_V_GEN)if $(SED) -n $(news-check-lines-spec)p $< \
| $(GREP) -E $(news-check-regexp) >/dev/null; then \
:; \
else \
echo 'NEWS: $$(news-check-regexp) failed to match' 1>&2; \
exit 1; \
fi
sc_makefile_TAB_only_indentation: sc_makefile_TAB_only_indentation:
@prohibit='^ [ ]{8}' \ @prohibit='^ [ ]{8}' \
in_vc_files='akefile|\.mk$$' \ in_vc_files='akefile|\.mk$$' \
...@@ -1360,395 +1279,3 @@ sc_vulnerable_makefile_CVE-2012-3386: ...@@ -1360,395 +1279,3 @@ sc_vulnerable_makefile_CVE-2012-3386:
' "make distcheck", and upgrade to fixed automake' \ ' "make distcheck", and upgrade to fixed automake' \
' see https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-3386 for details') \ ' see https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-3386 for details') \
$(_sc_search_regexp) $(_sc_search_regexp)
vc-diff-check:
$(AM_V_GEN)(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :
$(AM_V_at)if test -s vc-diffs; then \
cat vc-diffs; \
echo "Some files are locally modified:" 1>&2; \
exit 1; \
else \
rm vc-diffs; \
fi
rel-files = $(DIST_ARCHIVES)
gnulib-version = $$(cd $(gnulib_dir) \
&& { git describe || git rev-parse --short=10 HEAD; } )
bootstrap-tools ?= autoconf,automake,gnulib
gpgv = $$(gpgv2 --version >/dev/null && echo gpgv2 || echo gpgv)
# If it's not already specified, derive the GPG key ID from
# the signed tag we've just applied to mark this release.
gpg_key_ID ?= \
$$(cd $(srcdir) \
&& git cat-file tag v$(VERSION) \
| $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null \
| $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
translation_project_ ?= coordinator@translationproject.org
# Make info-gnu the default only for a stable release.
announcement_Cc_stable = $(translation_project_), $(PACKAGE_BUGREPORT)
announcement_mail_headers_stable = \
To: info-gnu@gnu.org \
Cc: $(announcement_Cc_) \
Mail-Followup-To: $(PACKAGE_BUGREPORT)
announcement_Cc_alpha = $(translation_project_)
announcement_mail_headers_alpha = \
To: $(PACKAGE_BUGREPORT) \
Cc: $(announcement_Cc_)
announcement_mail_Cc_beta = $(announcement_mail_Cc_alpha)
announcement_mail_headers_beta = $(announcement_mail_headers_alpha)
announcement_mail_Cc_ ?= $(announcement_mail_Cc_$(release-type))
announcement_mail_headers_ ?= $(announcement_mail_headers_$(release-type))
announcement: NEWS ChangeLog $(rel-files)
# Not $(AM_V_GEN) since the output of this command serves as
# announcement message: it would start with " GEN announcement".
$(AM_V_at)$(srcdir)/$(_build-aux)/announce-gen \
--mail-headers='$(announcement_mail_headers_)' \
--release-type=$(release-type) \
--package=$(PACKAGE) \
--prev=$(PREV_VERSION) \
--curr=$(VERSION) \
--gpg-key-id=$(gpg_key_ID) \
--srcdir=$(srcdir) \
--news=$(srcdir)/NEWS \
--bootstrap-tools=$(bootstrap-tools) \
$$(case ,$(bootstrap-tools), in (*,gnulib,*) \
echo --gnulib-version=$(gnulib-version);; esac) \
--no-print-checksums \
$(addprefix --url-dir=, $(url_dir_list))
.PHONY: release-commit
release-commit:
$(AM_V_GEN)cd $(srcdir) \
&& $(_build-aux)/do-release-commit-and-tag \
-C $(abs_top_builddir) $(RELEASE)
## ---------------- ##
## Updating files. ##
## ---------------- ##
ftp-gnu = https://ftp.gnu.org/gnu
www-gnu = https://www.gnu.org
upload_dest_dir_ ?= $(PACKAGE)
upload_command = \
$(srcdir)/$(_build-aux)/gnupload $(GNUPLOADFLAGS) \
--to $(gnu_rel_host):$(upload_dest_dir_) \
$(rel-files)
emit_upload_commands:
@echo =====================================
@echo =====================================
@echo '$(upload_command)'
@echo '# send the ~/announce-$(my_distdir) e-mail'
@echo =====================================
@echo =====================================
.PHONY: upload
upload:
$(AM_V_GEN)$(upload_command)
define emit-commit-log
printf '%s\n' 'maint: post-release administrivia' '' \
'* NEWS: Add header line for next release.' \
'* .prev-version: Record previous version.' \
'* cfg.mk (old_NEWS_hash): Auto-update.'
endef
.PHONY: no-submodule-changes
no-submodule-changes:
$(AM_V_GEN)if test -d $(srcdir)/.git \
&& git --version >/dev/null 2>&1; then \
diff=$$(cd $(srcdir) && git submodule -q foreach \
git diff-index --name-only HEAD) \
|| exit 1; \
case $$diff in '') ;; \
*) echo '$(ME): submodule files are locally modified:'; \
echo "$$diff"; exit 1;; esac; \
else \
: ; \
fi
submodule-checks ?= no-submodule-changes public-submodule-commit
# Ensure that each sub-module commit we're using is public.
# Without this, it is too easy to tag and release code that
# cannot be built from a fresh clone.
.PHONY: public-submodule-commit
public-submodule-commit:
$(AM_V_GEN)if test -d $(srcdir)/.git \
&& git --version >/dev/null 2>&1; then \
cd $(srcdir) && \
git submodule --quiet foreach \
'test "$$(git rev-parse "$$sha1")" \
= "$$(git merge-base origin "$$sha1")"' \
|| { echo '$(ME): found non-public submodule commit' >&2; \
exit 1; }; \
else \
: ; \
fi
# This rule has a high enough utility/cost ratio that it should be a
# dependent of "check" by default. However, some of us do occasionally
# commit a temporary change that deliberately points to a non-public
# submodule commit, and want to be able to use rules like "make check".
# In that case, run e.g., "make check gl_public_submodule_commit="
# to disable this test.
gl_public_submodule_commit ?= public-submodule-commit
check: $(gl_public_submodule_commit)
.PHONY: alpha beta stable release
ALL_RECURSIVE_TARGETS += alpha beta stable
alpha beta stable: $(local-check) writable-files $(submodule-checks)
$(AM_V_GEN)test $@ = stable \
&& { echo $(VERSION) | $(GREP) -E '^[0-9]+(\.[0-9]+)+$$' \
|| { echo "invalid version string: $(VERSION)" 1>&2; exit 1;};}\
|| :
$(AM_V_at)$(MAKE) vc-diff-check
$(AM_V_at)$(MAKE) news-check
$(AM_V_at)$(MAKE) distcheck
$(AM_V_at)$(MAKE) dist
$(AM_V_at)$(MAKE) $(release-prep-hook) RELEASE_TYPE=$@
$(AM_V_at)$(MAKE) -s emit_upload_commands RELEASE_TYPE=$@
release:
$(AM_V_GEN)$(MAKE) _version
$(AM_V_GEN)$(MAKE) $(release-type)
# Override this in cfg.mk if you follow different procedures.
release-prep-hook ?= release-prep
gl_noteworthy_news_ = * Noteworthy changes in release ?.? (????-??-??) [?]
.PHONY: release-prep
release-prep:
$(AM_V_GEN)$(MAKE) --no-print-directory -s announcement \
> ~/announce-$(my_distdir)
$(AM_V_at)if test -d $(release_archive_dir); then \
ln $(rel-files) $(release_archive_dir); \
chmod a-w $(rel-files); \
fi
$(AM_V_at)echo $(VERSION) > $(prev_version_file)
$(AM_V_at)$(MAKE) update-NEWS-hash
$(AM_V_at)perl -pi \
-e '$$. == 3 and print "$(gl_noteworthy_news_)\n\n\n"' \
$(srcdir)/NEWS
$(AM_V_at)msg=$$($(emit-commit-log)) || exit 1; \
cd $(srcdir) && $(VC) commit -m "$$msg" -a
# Override this with e.g., -s $(srcdir)/some_other_name.texi
# if the default $(PACKAGE)-derived name doesn't apply.
gendocs_options_ ?=
.PHONY: web-manual
web-manual:
$(AM_V_GEN)test -z "$(manual_title)" \
&& { echo define manual_title in cfg.mk 1>&2; exit 1; } || :
$(AM_V_at)cd '$(srcdir)/doc'; \
$(SHELL) ../$(_build-aux)/gendocs.sh $(gendocs_options_) \
-o '$(abs_top_builddir)/doc/manual' \
--email $(PACKAGE_BUGREPORT) $(PACKAGE) \
"$(PACKAGE_NAME) - $(manual_title)"
$(AM_V_at)echo " *** Upload the doc/manual directory to web-cvs."
.PHONY: web-manual-update
web-manual-update:
$(AM_V_GEN)cd $(srcdir) \
&& $(_build-aux)/gnu-web-doc-update -C $(abs_top_builddir)
# Code Coverage
init-coverage:
$(MAKE) $(AM_MAKEFLAGS) clean
lcov --directory . --zerocounters
COVERAGE_CCOPTS ?= "-g --coverage"
COVERAGE_OUT ?= doc/coverage
build-coverage:
$(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS)
$(MAKE) $(AM_MAKEFLAGS) CFLAGS=$(COVERAGE_CCOPTS) CXXFLAGS=$(COVERAGE_CCOPTS) check
mkdir -p $(COVERAGE_OUT)
lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
--capture
gen-coverage:
genhtml --output-directory $(COVERAGE_OUT) \
$(COVERAGE_OUT)/$(PACKAGE).info \
--highlight --frames --legend \
--title "$(PACKAGE_NAME)"
coverage:
$(MAKE) init-coverage
$(MAKE) build-coverage
$(MAKE) gen-coverage
# Some projects carry local adjustments for gnulib modules via patches in
# a gnulib patch directory whose default name is gl/ (defined in bootstrap
# via local_gl_dir=gl). Those patches become stale as the originals evolve
# in gnulib. Use this rule to refresh any stale patches. It applies each
# patch to the original in $(gnulib_dir) and uses the temporary result to
# generate a fuzz-free .diff file. If you customize the name of your local
# gnulib patch directory via bootstrap.conf, this rule detects that name.
# Run this from a non-VPATH (i.e., srcdir) build directory.
.PHONY: refresh-gnulib-patches
refresh-gnulib-patches:
gl=gl; \
if test -f bootstrap.conf; then \
t=$$(perl -lne '/^\s*local_gl_dir=(\S+)/ and $$d=$$1;' \
-e 'END{defined $$d and print $$d}' bootstrap.conf); \
test -n "$$t" && gl=$$t; \
fi; \
for diff in $$(cd $$gl; git ls-files | $(GREP) '\.diff$$'); do \
b=$$(printf %s "$$diff"|$(SED) 's/\.diff$$//'); \
VERSION_CONTROL=none \
patch "$(gnulib_dir)/$$b" "$$gl/$$diff" || exit 1; \
( cd $(gnulib_dir) || exit 1; \
git diff "$$b" > "../$$gl/$$diff"; \
git checkout $$b ) || exit 1; \
done
# Update gettext files.
PACKAGE ?= $(shell basename $(PWD))
PO_DOMAIN ?= $(PACKAGE)
POURL = https://translationproject.org/latest/$(PO_DOMAIN)/
PODIR ?= po
refresh-po:
rm -f $(PODIR)/*.po && \
echo "$(ME): getting translations into po (please ignore the robots.txt ERROR 404)..." && \
wget --no-verbose --directory-prefix $(PODIR) --no-directories --recursive --level 1 --accept .po --accept .po.1 $(POURL) && \
echo 'en@boldquot' > $(PODIR)/LINGUAS && \
echo 'en@quot' >> $(PODIR)/LINGUAS && \
ls $(PODIR)/*.po | $(SED) 's/\.po//;s,$(PODIR)/,,' | \
sort >> $(PODIR)/LINGUAS
# Running indent once is not idempotent, but running it twice is.
INDENT_SOURCES ?= $(C_SOURCES)
.PHONY: indent
indent:
indent $(INDENT_SOURCES)
indent $(INDENT_SOURCES)
# If you want to set UPDATE_COPYRIGHT_* environment variables,
# put the assignments in this variable.
update-copyright-env ?=
# Run this rule once per year (usually early in January)
# to update all FSF copyright year lists in your project.
# If you have an additional project-specific rule,
# add it in cfg.mk along with a line 'update-copyright: prereq'.
# By default, exclude all variants of COPYING; you can also
# add exemptions (such as ChangeLog..* for rotated change logs)
# in the file .x-update-copyright.
.PHONY: update-copyright
update-copyright:
$(AM_V_GEN)$(GREP) -l -w Copyright \
$$(export VC_LIST_EXCEPT_DEFAULT=COPYING && $(VC_LIST_EXCEPT)) \
| $(update-copyright-env) xargs $(srcdir)/$(_build-aux)/$@
# This tight_scope test is skipped with a warning if $(_gl_TS_headers) is not
# overridden and $(_gl_TS_dir)/Makefile.am does not mention noinst_HEADERS.
# NOTE: to override any _gl_TS_* default value, you must
# define the variable(s) using "export" in cfg.mk.
_gl_TS_dir ?= src
ALL_RECURSIVE_TARGETS += sc_tight_scope
sc_tight_scope: tight-scope.mk
@fail=0; \
if ! $(GREP) '^ *export _gl_TS_headers *=' $(_build-aux)/cfg.mk \
> /dev/null \
&& ! $(GREP) -w noinst_HEADERS $(srcdir)/$(_gl_TS_dir)/Makefile.am \
> /dev/null 2>&1; then \
echo '$(ME): skipping $@'; \
else \
$(MAKE) -s -C $(_gl_TS_dir) \
-f Makefile \
-f $(_build-aux)/cfg.mk \
-f $(abs_top_builddir)/$< \
_gl_tight_scope \
|| fail=1; \
fi; \
rm -f $<; \
exit $$fail
tight-scope.mk: $(ME)
@rm -f $@ $@-t
@perl -ne '/^# TS-start/.../^# TS-end/ and print' $(srcdir)/$(ME) > $@-t
@chmod a=r $@-t && mv $@-t $@
ifeq (a,b)
# TS-start
# Most functions should have static scope.
# Any that don't must be marked with 'extern', but 'main'
# and 'usage' are exceptions: they're always extern, but
# do not need to be marked. Symbols matching '__.*' are
# reserved by the compiler, so are automatically excluded below.
_gl_TS_unmarked_extern_functions ?= main usage
_gl_TS_function_match ?= /^(?:$(_gl_TS_extern)) +.*?(\w+) *\(/
# If your project uses a macro like "XTERN", then put
# the following in cfg.mk to override this default:
# export _gl_TS_extern = extern|XTERN
_gl_TS_extern ?= extern
# The second nm|grep checks for file-scope variables with 'extern' scope.
# Without gnulib's progname module, you might put program_name here.
# Symbols matching '__.*' are reserved by the compiler,
# so are automatically excluded below.
_gl_TS_unmarked_extern_vars ?=
# NOTE: the _match variables are perl expressions -- not mere regular
# expressions -- so that you can extend them to match other patterns
# and easily extract matched variable names.
# For example, if your project declares some global variables via
# a macro like this: GLOBAL(type, var_name, initializer), then you
# can override this definition to automatically extract those names:
# export _gl_TS_var_match = \
# /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?\])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/
_gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?\])?;/
# The names of object files in (or relative to) $(_gl_TS_dir).
_gl_TS_obj_files ?= *.$(OBJEXT)
# Files in which to search for the one-line style extern declarations.
# $(_gl_TS_dir)-relative.
_gl_TS_headers ?= $(noinst_HEADERS)
_gl_TS_other_headers ?= *.h
.PHONY: _gl_tight_scope
_gl_tight_scope: $(bin_PROGRAMS)
sed_wrap='s/^/^_?/;s/$$/$$/'; \
t=exceptions-$$$$; \
trap 's=$$?; rm -f $$t; exit $$s' 0; \
for sig in 1 2 3 13 15; do \
eval "trap 'v=`expr $$sig + 128`; (exit $$v); exit $$v' $$sig"; \
done; \
src=`for f in $(SOURCES); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
hdr=`for f in $(_gl_TS_headers); do \
test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`; \
( printf '%s\n' '__.*' $(_gl_TS_unmarked_extern_functions); \
$(GREP) -h -A1 '^extern .*[^;]$$' $$src \
| $(GREP) -vE '^(extern |--|#)' | $(SED) 's/ .*//; /^$$/d'; \
perl -lne \
'$(_gl_TS_function_match) and print $$1' $$hdr; \
) | sort -u | $(SED) "$$sed_wrap" > $$t; \
nm -g $(_gl_TS_obj_files)|$(SED) -n 's/.* T //p'|$(GREP) -Ev -f $$t \
&& { echo the above functions should have static scope >&2; \
exit 1; } || : ; \
( printf '%s\n' '__.*' main $(_gl_TS_unmarked_extern_vars); \
perl -lne '$(_gl_TS_var_match) and print $$1' \
$$hdr $(_gl_TS_other_headers) \
) | sort -u | $(SED) "$$sed_wrap" > $$t; \
nm -g $(_gl_TS_obj_files) | $(SED) -n 's/.* [BCDGRS] //p' \
| sort -u | $(GREP) -Ev -f $$t \
&& { echo the above variables should have static scope >&2; \
exit 1; } || :
# TS-end
endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册