summaryrefslogtreecommitdiff
path: root/lib/am
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2008-09-13 09:55:23 +0200
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2008-09-13 09:55:23 +0200
commit00c3eb2317235c2b851cdc7c4faf18ed83d7fba2 (patch)
tree0c800547d775af566feb791157c23e89c758eff4 /lib/am
parent7726a26a5337ae0215f77295503ecd7b21369f2a (diff)
downloadautomake-00c3eb2317235c2b851cdc7c4faf18ed83d7fba2.tar.gz
install: cope with non-injective $(transform).
* lib/am/progs.am (install-%DIR%PROGRAMS): Rewrite rule to not try to use the installed name as key in a hash, so destructive $(transform) scripts still work. * lib/am/scripts.am (install-%DIR%SCRIPTS): Likewise. * tests/transform.test: Fix test to look in right place for installed files. * tests/transform2.test: New test. * tests/Makefile.am: Adjust. Report by Jim Meyering. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'lib/am')
-rw-r--r--lib/am/progs.am42
-rw-r--r--lib/am/scripts.am39
2 files changed, 41 insertions, 40 deletions
diff --git a/lib/am/progs.am b/lib/am/progs.am
index 28505cf84..ea14053ce 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -47,29 +47,31 @@ install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
## The following awk script turns that into one line containing directories
-## and then lines of `target_name_or_directory sources...'.
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = "" } { \
- if ($$2 == $$4) tgt = $$3; else tgt = $$3 "/" $$4; \
- files[tgt] = files[tgt] " " $$1; dirs[$$3] = 1 } \
- END { d=""; for (dir in dirs) d = d " " dir; print d; \
- for (dir in files) print dir, files[dir] }' | { \
- read dirs; \
-?!BASE? for dir in $$dirs; do test . = $$dir || { \
-?!BASE? echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
-?!BASE? }; done; \
- while read dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
-?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
-?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
+## and then lines of 'type target_name_or_directory sources...', with type
+## 'd' designating directories, and 'f' files.
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+?!BASE? case $$type in \
+?!BASE? d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
+?!BASE? f) \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
+?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
## Note that we explicitly set the libtool mode. This avoids any
## lossage if the install program doesn't have a name that libtool
## expects.
-?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
-?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
- }; \
- done; }
+?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
+?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
+ } \
+?!BASE? ;; esac \
+ ; done
+
endif %?INSTALL%
diff --git a/lib/am/scripts.am b/lib/am/scripts.am
index 6db83daeb..e4b61d176 100644
--- a/lib/am/scripts.am
+++ b/lib/am/scripts.am
@@ -48,26 +48,25 @@ install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
?BASE? -e 'h;s|.*|.|' \
?!BASE? -e "s|$$srcdirstrip/||" -e 'h;s|[^/]*$$||; s|^$$|.|' \
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
- $(AWK) 'BEGIN { files["."] = ""; dirs["."] = ""; list[""] = "" } { \
- if ($$2 == $$4) tgt = $$3; else tgt = $$3 "/" $$4; \
- files[tgt] = files[tgt] " " $$1; dirs[$$3] = 1; \
- if (++n[tgt] == $(am__install_max)) \
- { list[++lno] = tgt " " files[tgt]; n[tgt] = 0; files[tgt] = "" } } \
- END { d = ""; for (dir in dirs) d = d " " dir; print d; \
- for (l in list) print list[l]; \
- for (dir in files) print dir, files[dir] }' | { \
- read dirs; \
-?!BASE? for dir in $$dirs; do test . = $$dir || { \
-?!BASE? echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
-?!BASE? }; done; \
- while read dir files; do \
- if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
- test -z "$$files" || { \
- echo " $(%DIR%SCRIPT_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
- $(%DIR%SCRIPT_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
- }; \
- done; }
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+?!BASE? case $$type in \
+?!BASE? d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+?!BASE? $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
+?!BASE? f) \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(%DIR%SCRIPT_INSTALL) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
+ $(%DIR%SCRIPT_INSTALL) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
+ } \
+?!BASE? ;; esac \
+ ; done
endif %?INSTALL%