+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
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
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)
## 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%
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
#! /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