summaryrefslogtreecommitdiff
path: root/lib/am/scripts.am
diff options
context:
space:
mode:
authorAlexandre Duret-Lutz <adl@gnu.org>2002-06-09 11:12:35 +0000
committerAlexandre Duret-Lutz <adl@gnu.org>2002-06-09 11:12:35 +0000
commit7ad201bb30517298f74e082df932d6d584d08560 (patch)
treee32ee848811b22c2e0c9dcb395e3fd46d9991b85 /lib/am/scripts.am
parent788a63b300568b1c1876e4ad30b966df2f0710fc (diff)
downloadautomake-7ad201bb30517298f74e082df932d6d584d08560.tar.gz
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.
Diffstat (limited to 'lib/am/scripts.am')
-rw-r--r--lib/am/scripts.am24
1 files changed, 16 insertions, 8 deletions
diff --git a/lib/am/scripts.am b/lib/am/scripts.am
index 821aa2688..b50e19d95 100644
--- a/lib/am/scripts.am
+++ b/lib/am/scripts.am
@@ -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