summaryrefslogtreecommitdiff
path: root/src/Makefile.in
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-04-27 14:57:48 +0000
committerJim Meyering <jim@meyering.net>2004-04-27 14:57:48 +0000
commit37989d195a846f23e2fea9f4f7bd5bab91f43001 (patch)
treeea7beb0c641fe0558fc2a77b536c9f856c92a0b0 /src/Makefile.in
parent36968546e5d3835b4d3d2f0a0a4f8b0632eb9003 (diff)
downloadcoreutils-37989d195a846f23e2fea9f4f7bd5bab91f43001.tar.xz
.
Diffstat (limited to 'src/Makefile.in')
-rw-r--r--src/Makefile.in19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/Makefile.in b/src/Makefile.in
index 9eaf95a42..0f2048664 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1716,6 +1716,25 @@ check-misc:
done | $(ASSORT) -u ) > $@-t
chmod a-w $@-t
mv $@-t $@
+
+# The following rule is not designed to be portable,
+# and relies on tools that not everyone has.
+
+# Most functions in src/*.c should have static scope.
+# Any that don't must be marked with `extern', but `main'
+# and `usage' are exceptions. They're always extern, but
+# don't need to be marked.
+sc_src_functions_have_static_scope: $(all_programs)
+ @t=exceptions-$$$$; \
+ trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15; \
+ ( printf '^main$$\n^usage$$\n'; \
+ grep -h -A1 '^extern .*[^;]$$' $(SOURCES) \
+ | grep -vE '^(extern |--)' |sed 's/^/^/;s/ .*/$$/' ) > $$t; \
+ nm -e *.$(OBJEXT) \
+ | sed -n 's/.* T //p' \
+ | grep -Ev -f $$t && \
+ { echo 'the above functions should have static scope' 1>&2; \
+ exit 1; } || :
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT: