summaryrefslogtreecommitdiff
path: root/maint.mk
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2008-06-02 17:48:11 +0200
committerJim Meyering <meyering@redhat.com>2008-06-02 18:50:00 +0200
commit77b1bfc85cdf4ec01094ee31c8c85e2a83dea466 (patch)
tree1908bbb83337186cba75c0f95b10a7196d178587 /maint.mk
parent434258ca739c0cd820f6359ee248ce2d196d302f (diff)
downloadcoreutils-77b1bfc85cdf4ec01094ee31c8c85e2a83dea466.tar.xz
each file with a "main" must also declare program_name
* maint.mk (sc_program_name): New rule. * .x-sc_program_name: New file. * Makefile.am (EXTRA_DIST): Add .x-sc_program_name.
Diffstat (limited to 'maint.mk')
-rw-r--r--maint.mk12
1 files changed, 12 insertions, 0 deletions
diff --git a/maint.mk b/maint.mk
index 91e26a495..25551a84a 100644
--- a/maint.mk
+++ b/maint.mk
@@ -341,6 +341,18 @@ sc_system_h_headers: .re-list
1>&2; exit 1; } || :; \
fi
+# Ensure that each .c file containing a "main" function also
+# declares "char *program_name", with or without "const".
+sc_program_name:
+ @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then \
+ files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
+ grep -EL '^(char const|(const )?char) \*program_name;' $$files \
+ | grep . && \
+ { echo '$(ME): the above files do not declare program_name' \
+ 1>&2; exit 1; } || :; \
+ else :; \
+ fi
+
# Require that the final line of each test-lib.sh-using test be this one:
# (exit $fail); exit $fail
# Note: this test requires GNU grep's --label= option.