bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] various VPATH-related fixes


From: Jim Meyering
Subject: Re: [PATCH] various VPATH-related fixes
Date: Sun, 14 Sep 2008 11:20:38 +0200

Ralf Wildenhues <address@hidden> wrote:

> * maint.mk (VC_LIST): Prepend '$(srcdir)/'.
> (patch-check): Fix to make it work with a VPATH build.
> * src/Makefile.am (sc_tight_scope): Likewise.
> * man/Makefile.am (.x.1): Do not make outputs unwritable.
> ---
>
> Hello Jim,
>
> this makes maintainer-distcheck work better in a VPATH build setup.
> Sorry, but non-VPATH builds simply are too much of a hassle for me
> (why should I keep around two source trees of coreutils for the
> root and the non-root build?).
...
> With this patch, I get as far as the sc_tight_scope test, which then
> fails with
>
> | ls_mode
> | ls_mode
> | ls_mode
> | uname_mode
> | uname_mode
> | the above variables should have static scope
> | make[1]: *** [sc_tight_scope] Error 1
> | make[1]: Leaving directory `/home/ralf/coreutils/build/src'
> | make: *** [sc_tight_scope] Error 2

Thanks, Ralf!
I expect to fold in the following change.
It makes the sc_tight_scope pass once again.
The key was to search $$hdr as well as *.h for extern declarations.
In order to be able to use $$hdr there, I pulled its definition "up"
out of the subshell.  I also pulled src up and made both a little
more concise.

diff --git a/src/Makefile.am b/src/Makefile.am
index 6e62d32..80313ae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -442,15 +442,11 @@ s2 = '/^\#define AUTHORS \\\\/{;n;$(sed_filter);p;q;}'
 sc_tight_scope: $(all_programs)
        @t=exceptions-$$$$;                                             \
        trap "s=$$?; rm -f $$t; exit $$s" 0 1 2 13 15;                  \
+       src=`for f in $(SOURCES); do                                    \
+              test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`;   \
+       hdr=`for f in $(noinst_HEADERS); do                             \
+              test -f $$f && d= || d=$(srcdir)/; echo $$d$$f; done`;   \
        ( printf 'main\nusage\n';                                       \
-         src=`for f in $(SOURCES); do                                  \
-                 if test -f $$f; then echo $$f;                        \
-                 else echo $(srcdir)/$$f; fi;                          \
-               done`;                                                  \
-         hdr=`for f in $(noinst_HEADERS); do                           \
-                 if test -f $$f; then echo $$f;                        \
-                 else echo $(srcdir)/$$f; fi;                          \
-               done`;                                                  \
          grep -h -A1 '^extern .*[^;]$$' $$src                          \
            | grep -vE '^(extern |--)' | sed 's/ .*//';                 \
          perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' $$hdr;    \
@@ -462,7 +458,7 @@ sc_tight_scope: $(all_programs)
            exit 1; } || : ;                                            \
        ( printf '^program_name$$\n';                                   \
          perl -ne '/^extern .*?\**(\w+);/ and print "^$$1\$$\n"'       \
-           *.h ) > $$t;                                                \
+           $$hdr *.h ) | $(ASSORT) -u > $$t;                           \
        nm -e *.$(OBJEXT)                                               \
            | sed -n 's/.* [BD] //p'                                    \
            | grep -Ev -f $$t &&                                        \




reply via email to

[Prev in Thread] Current Thread [Next in Thread]