From d840a53e906477b332b888f967e7505a2f2fdf16 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 9 Apr 2004 11:33:53 +0000 Subject: [PATCH] (.re-list): New rule/file, to replace hard-coded list of header file names. (sc_system_h_headers): Use the new file. --- Makefile.maint | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/Makefile.maint b/Makefile.maint index 198584c48d..97e84d4c62 100644 --- a/Makefile.maint +++ b/Makefile.maint @@ -165,40 +165,25 @@ sc_dd_max_sym_length: exit 1; \ fi -header_regexp = \ - alloca\ - |closeout\ - |ctype\ - |dirent\ - |errno\ - |exitfail\ - |fcntl\ - |file-type\ - |inttypes\ - |limits\ - |locale\ - |pathmax\ - |std(lib|bool)\ - |string\ - |sys/(stat|dir|time)\ - |time\ - |unistd\ - |utime\ - |version-etc\ - |xalloc -h_re := $(shell echo '$(header_regexp)'|tr -d ' ') +# Create a list of regular expressions matching the names +# of files included from system.h. Exclude a couple. +.re-list: + @sed -n '/^# *include /s///p' $(srcdir)/src/system.h \ + | grep -Ev 'sys/(param|file)\.h' \ + | sed 's/ .*//;;s/^["<]/^# *include [<"]/;s/\.h[">]$$/\\.h[">]/' \ + > $@-t + @mv $@-t $@ # Files in src/ should not include directly any of # the headers already included via system.h. -# Get list of candidates with this: -# grep -h include src/system.h|sed 's/.*include //'|sort - -sc_system_h_headers: +sc_system_h_headers: .re-list @if test -f $(srcdir)/src/system.h; then \ - ( cvsu --list ) > /dev/null 2>&1 || : && \ - grep -E '^# *include ["<]($(h_re))\.h[">]' \ + ( cvsu --list ) > /dev/null 2>&1 || exit 0; \ + trap 'rm -f .re-list' 0 1 2 3 15; \ + grep -E -f .re-list \ $$(cvsu --list src | grep -Ev 'system\.h$$') \ && { echo '$(ME): the above are already included via system.h'\ - 1>&2; exit 1; } || :; \ + 1>&2; exit 1; } || :; \ fi sc_sun_os_names: -- 2.47.2