various VPATH-related fixes
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Fri, 12 Sep 2008 19:23:43 +0000 (21:23 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 14 Sep 2008 15:42:48 +0000 (17:42 +0200)
* 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.

maint.mk
man/Makefile.am
src/Makefile.am

index 492fb0f..f3bbf9a 100644 (file)
--- a/maint.mk
+++ b/maint.mk
@@ -31,7 +31,7 @@ GIT = git
 VC = $(GIT)
 VC-tag = git tag -s -m '$(VERSION)'
 
-VC_LIST = build-aux/vc-list-files
+VC_LIST = $(srcdir)/build-aux/vc-list-files
 
 VC_LIST_EXCEPT = \
   $(VC_LIST) | if test -f .x-$@; then grep -vEf .x-$@; else grep -v ChangeLog; fi
@@ -507,11 +507,16 @@ epoch_date = 1970-01-01 00:00:00.000000000 +0000
 # Ensure that the c99-to-c89 patch applies cleanly.
 patch-check:
        rm -rf src-c89 $@.1 $@.2
-       cp -a src src-c89
-       (cd src-c89; patch -p1 -V never --fuzz=0) < src/c99-to-c89.diff \
+       cp -a $(srcdir)/src src-c89
+       if test "x$(srcdir)" != x.; then \
+         cp -a src/* src-c89; \
+         dotfiles=`ls src/.[!.]* 2>/dev/null`; \
+         test -z "$$dotfiles" || cp -a src/.[!.]* src-c89; \
+       fi
+       (cd src-c89; patch -p1 -V never --fuzz=0) < $(srcdir)/src/c99-to-c89.diff \
          > $@.1 2>&1
        if test "$(REGEN_PATCH)" = yes; then                    \
-         diff -upr src src-c89 | sed 's,src-c89/,src/,'        \
+         diff -upr $(srcdir)/src src-c89 | sed 's,$(srcdir)/src-c89/,src/,'    \
            | grep -vE '^(Only in|File )'                       \
            | perl -pe 's/^((?:\+\+\+|---) \S+\t).*/$${1}$(epoch_date)/;' \
               -e 's/^ $$//'                                    \
index 67ac4bd..415eb82 100644 (file)
@@ -161,7 +161,6 @@ mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'`
                     --output=$t/$@ $t/$*;                      \
               }                                                \
            && sed 's|$*\.td/||g' $t/$@ > $@                    \
-           && chmod a-w $@                                     \
            && rm -rf $t ;;                                     \
        esac
 
index dee26a4..80313ae 100644 (file)
@@ -442,11 +442,14 @@ 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';                                       \
-         grep -h -A1 '^extern .*[^;]$$' $(SOURCES)                     \
+         grep -h -A1 '^extern .*[^;]$$' $$src                          \
            | grep -vE '^(extern |--)' | sed 's/ .*//';                 \
-         perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"'           \
-           $(noinst_HEADERS);                                          \
+         perl -ne '/^extern \S+ (\S*) \(/ and print "$$1\n"' $$hdr;    \
        ) | $(ASSORT) -u | sed 's/^/^/;s/$$/$$/' > $$t;                 \
        nm -e *.$(OBJEXT)                                               \
            | sed -n 's/.* T //p'                                       \
@@ -455,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 &&                                        \