]> sourceware.org Git - automake.git/commitdiff
For PR automake/318:
authorAlexandre Duret-Lutz <adl@gnu.org>
Sun, 9 Jun 2002 11:12:32 +0000 (11:12 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Sun, 9 Jun 2002 11:12:32 +0000 (11:12 +0000)
* tests/nobase.test: Rewrite to test _HEADERS, _DATA, _SCRIPTS,
_PROGRAMS, _LIBRARIES, and _LTLIBRARIES.
* lib/am/scripts.am (install-%DIR%SCRIPTS,
uninstall-%DIR%SCRIPTS): Honor nobase_; strip the directory by
default.
(?%DIR%SCRIPT_INSTALL): New variable.
* lib/am/header-vars.am (install_sh_SCRIPT): New variable.
Reported by Eric Siegerman.

ChangeLog
lib/am/header-vars.am
lib/am/scripts.am
tests/nobase.test

index b880cd8014d0648f0c80663cc87101e2feff75e2..ee92a027e22a8cd0e950fb5cbbb80724a7fb7183 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2002-06-09  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       For PR automake/318:
+       * tests/nobase.test: Rewrite to test _HEADERS, _DATA, _SCRIPTS,
+       _PROGRAMS, _LIBRARIES, and _LTLIBRARIES.
+       * lib/am/scripts.am (install-%DIR%SCRIPTS,
+       uninstall-%DIR%SCRIPTS): Honor nobase_; strip the directory by
+       default.
+       (?%DIR%SCRIPT_INSTALL): New variable.
+       * lib/am/header-vars.am (install_sh_SCRIPT): New variable.
+       Reported by Eric Siegerman.
+
 2002-06-08  Alexandre Duret-Lutz  <duret_g@epita.fr>
 
        * automake.in (lang_yacc_target_hook): Add rule to recover from
index 58cd39fc92382bc2d4c9c857d9f3eeeefcc13b0c..3810ba1df3881d32edae2066e896cab5e2774d2f 100644 (file)
@@ -43,6 +43,7 @@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 INSTALL = @INSTALL@
 install_sh_DATA = $(install_sh) -c -m 644
 install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
 INSTALL_HEADER = $(INSTALL_DATA)
 
 ## These are defined because otherwise make on NetBSD V1.1 will print
index 821aa2688a9c497e1a1f78f70a1d36f8b705a6ad..b50e19d954b9bb7615a0f53784ee74d6f2a43f85 100644 (file)
@@ -24,6 +24,8 @@
 if %?INSTALL%
 ## if doesn't work properly for Automake variables yet.
 _am_installdirs += $(DESTDIR)$(%NDIR%dir)
+?BASE?%DIR%SCRIPT_INSTALL = $(INSTALL_SCRIPT)
+?!BASE?%DIR%SCRIPT_INSTALL = $(install_sh_SCRIPT)
 ?EXEC?.PHONY install-exec-am: install-%DIR%SCRIPTS
 ?!EXEC?.PHONY install-data-am: install-%DIR%SCRIPTS
 install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
@@ -32,13 +34,17 @@ install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
        @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
-         f="`echo $$p|sed '$(transform)'`"; \
-         if test -f $$p; then \
-           echo " $(INSTALL_SCRIPT) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
-           $(INSTALL_SCRIPT) $$p $(DESTDIR)$(%NDIR%dir)/$$f; \
-         elif test -f $(srcdir)/$$p; then \
-           echo " $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
-           $(INSTALL_SCRIPT) $(srcdir)/$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
+## A file can be in the source directory or the build directory.
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+## If the _SCRIPTS variable has an entry like foo/bar, install it as
+## $(destdir)/bar, not $(destdir)/foo/bar.  The user can make a
+## new dir variable or use a nobase_ target for the latter case.
+?BASE?   f="`echo $$p | sed -e 's|^.*/||'`"; \
+?!BASE?          f="$$p"; \
+         if test -f $$d$$p; then \
+           f="`echo $$f|sed '$(transform)'`"; \
+           echo " $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
+           $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
          else :; fi; \
        done
 endif %?INSTALL%
@@ -53,7 +59,9 @@ if %?INSTALL%
 uninstall-%DIR%SCRIPTS:
        @$(NORMAL_UNINSTALL)
        @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
-         f="`echo $$p|sed '$(transform)'`"; \
+?BASE?   f="`echo $$p | sed -e 's|^.*/||'`"; \
+?!BASE?          f="$$p"; \
+         f="`echo $$f|sed '$(transform)'`"; \
          echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \
          rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \
        done
index a9bf79bf31cfda451b5fcef8d895b9d07d643162..fa3fb1e0cd5f9eb15004d9de3572b6166b984044 100755 (executable)
 #! /bin/sh
-# Test to make sure nobase_*_HEADERS work.
+# Make sure nobase_* works.
 
+required=libtoolize
 . $srcdir/defs || exit 1
 
+set -e
+
 cat >> configure.in <<'EOF'
+AC_PROG_CC
+AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
 
 cat > Makefile.am << 'EOF'
 foodir = $(prefix)/foo
-nobase_foo_HEADERS = bar/baz.h
+fooexecdir = $(prefix)/foo
+
+foo_HEADERS = sub/base.h
+nobase_foo_HEADERS = sub/nobase.h
+
+foo_DATA = sub/base.dat
+nobase_foo_DATA = sub/nobase.dat
+
+fooexec_SCRIPTS = sub/base.sh
+nobase_fooexec_SCRIPTS = sub/nobase.sh
+
+fooexec_PROGRAMS = sub/base
+nobase_fooexec_PROGRAMS = sub/nobase
+sub_base_SOURCES = source.c
+sub_nobase_SOURCES = source.c
+
+fooexec_LIBRARIES = sub/libbase.a
+nobase_fooexec_LIBRARIES = sub/libnobase.a
+sub_libbase_a_SOURCES = source.c
+sub_libnobase_a_SOURCES = source.c
+
+fooexec_LTLIBRARIES = sub/libbase.la
+nobase_fooexec_LTLIBRARIES = sub/libnobase.la
+sub_libbase_la_SOURCES = source2.c
+sub_libnobase_la_SOURCES = source2.c
 EOF
 
-mkdir bar
-: > bar/baz.h
+mkdir sub
 
-set -e
+: > sub/base.h
+: > sub/nobase.h
+: > sub/base.dat
+: > sub/nobase.dat
+: > sub/base.sh
+: > sub/nobase.sh
 
+cat >source.c <<'EOF'
+int
+main (int argc, char *argv[])
+{
+  return 0;
+}
+EOF
+cp source.c source2.c
+
+libtoolize
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-./configure --prefix `pwd`/install
+./configure --prefix `pwd`/inst
+
+$MAKE
 $MAKE install-data
-test -f install/foo/bar/baz.h
+
+test   -f inst/foo/sub/nobase.h
+test ! -f inst/foo/nobase.h
+test   -f inst/foo/base.h
+
+test   -f inst/foo/sub/nobase.dat
+test ! -f inst/foo/nobase.dat
+test   -f inst/foo/base.dat
+
+test ! -f inst/foo/sub/nobase.sh
+test ! -f inst/foo/base.sh
+test ! -f inst/foo/sub/nobase
+test ! -f inst/foo/base
+test ! -f inst/foo/sub/libnobase.a
+test ! -f inst/foo/libbase.a
+test ! -f inst/foo/sub/libnobase.la
+test ! -f inst/foo/libbase.la
+
+$MAKE install-exec
+
+test   -f inst/foo/sub/nobase.sh
+test ! -f inst/foo/nobase.sh
+test   -f inst/foo/base.sh
+
+test   -f inst/foo/sub/nobase
+test ! -f inst/foo/nobase
+test   -f inst/foo/base
+
+test   -f inst/foo/sub/libnobase.a
+test ! -f inst/foo/libnobase.a
+test   -f inst/foo/libbase.a
+
+test   -f inst/foo/sub/libnobase.la
+test ! -f inst/foo/libnobase.la
+test   -f inst/foo/libbase.la
+
+$MAKE uninstall
+
+test `find inst/foo -type f -print | wc -l` = 0
+
+$MAKE install-strip
This page took 0.037934 seconds and 5 git commands to generate.