summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-10-13 06:47:07 +0000
committerJim Meyering <jim@meyering.net>2002-10-13 06:47:07 +0000
commit380f554a4617275f6930d5aa2edafe0b0fc13d58 (patch)
tree849deb8bc0e316c3d1533887103449581ec1de97 /src
parentc19c8b595228e1ecb4a9fe01dff86eca315f361a (diff)
downloadcoreutils-380f554a4617275f6930d5aa2edafe0b0fc13d58.tar.xz
(../AUTHORS): New target/rule.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 4375b16bf..7215f42c3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -182,6 +182,12 @@ false.c: true.c
$(srcdir)/true.c > $@-t
mv $@-t $@
+all_programs = \
+ $(bin_PROGRAMS) \
+ $(bin_SCRIPTS) \
+ $(EXTRA_PROGRAMS) \
+ $(EXTRA_SCRIPTS)
+
pm = progs-makefile
pr = progs-readme
# Ensure that the list of programs in README matches the list
@@ -190,8 +196,32 @@ check: check-README
.PHONY: check-README
check-README:
rm -rf $(pr) $(pm)
- echo $(EXTRA_PROGRAMS) $(EXTRA_SCRIPTS) $(bin_SCRIPTS) $(bin_PROGRAMS) \
+ echo $(all_programs) \
| tr -s ' ' '\n' | sort -u > $(pm)
sed -n '/^The programs .* are:/,/^[a-zA-Z]/p' $(top_srcdir)/README \
| sed -n '/^ */s///p' | tr -s ' ' '\n' > $(pr)
diff $(pm) $(pr) && rm -rf $(pr) $(pm)
+
+# Extract the list of authors from each file.
+sed_filter = s/^ *//;s/N_ (//;s/^"//;s/")*$$//
+# Sometimes the string is on the same line as the #define...
+s1 = '/^\#define AUTHORS \([^\\]\)/{;s//\1/;$(sed_filter);p;q;}'
+# Sometimes the string is on the backslash-continued line after the #define.
+s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
+# FIXME: handle *.sh
+../AUTHORS: $(SOURCES)
+ ( \
+ set -e; \
+ echo "Here are the names of the programs in this package,"; \
+ echo "each followed by the name(s) of its author(s)."; \
+ echo; \
+ for i in $(SOURCES); do \
+ a=`sed -n $(s1) $$i`; \
+ test "$$a" && : \
+ || a=`sed -n $(s2) $$i`; \
+ if test "$$a"; then \
+ prog=`echo $$i|sed 's/\.c$$//'`; \
+ echo "$$prog: $$a"; \
+ fi; \
+ done | sort -u ) > $@-t
+ mv $@-t $@