Merge branch 'maint'
[platform/upstream/automake.git] / lib / am / mans.am
index 5c563b3..bfc71dc 100644 (file)
@@ -30,16 +30,24 @@ man%SECTION%dir = $(mandir)/man%SECTION%
 .PHONY install-man: install-man%SECTION%
 install-man%SECTION%: %DEPS%
        @$(NORMAL_INSTALL)
-       test -z "$(man%SECTION%dir)" || $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)"
 if %?NOTRANS_MANS%
 ## Handle MANS with notrans_ prefix
-       @list='%NOTRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
-       { for i in $$list; do echo "$$i"; done;  \
+       @list1='%NOTRANS_SECT_LIST%'; \
+?!HAVE_NOTRANS?        list2=''; \
+?HAVE_NOTRANS? list2='%NOTRANS_LIST%'; \
+       test -n "$(man%SECTION%dir)" \
+         && test -n "`echo $$list1$$list2`" \
+         || exit 0; \
+       echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
+       $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
+       { for i in $$list1; do echo "$$i"; done;  \
 ## Extract all items from notrans_man_MANS that should go in this section.
 ## This must be done dynamically to support conditionals.
-?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+       if test -n "$$list2"; then \
+         for i in $$list2; do echo "$$i"; done \
 ## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
-?HAVE_NOTRANS?   sed -n '/\.%SECTION%[a-z]*$$/p'; \
+           | sed -n '/\.%SECTION%[a-z]*$$/p'; \
+       fi; \
 ## Extract basename of manpage, change the extension if needed.
        } | while read p; do \
 ## Find the file.
@@ -65,13 +73,22 @@ if %?NOTRANS_MANS%
 endif %?NOTRANS_MANS%
 if %?TRANS_MANS%
 ## Handle MANS without notrans_ prefix
-       @list='%TRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
-       { for i in $$list; do echo "$$i"; done; \
+       @list1='%TRANS_SECT_LIST%'; \
+?!HAVE_TRANS?  list2=''; \
+?HAVE_TRANS?   list2='%TRANS_LIST%'; \
+       test -n "$(man%SECTION%dir)" \
+         && test -n "`echo $$list1$$list2`" \
+         || exit 0; \
+       echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
+       $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
+       { for i in $$list1; do echo "$$i"; done;  \
 ## Extract all items from notrans_man_MANS that should go in this section.
 ## This must be done dynamically to support conditionals.
-?HAVE_TRANS?   l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
-## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
-?HAVE_TRANS?     sed -n '/\.%SECTION%[a-z]*$$/p'; \
+       if test -n "$$list2"; then \
+         for i in $$list2; do echo "$$i"; done \
+## Accept for 'man1' files like `foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
+           | sed -n '/\.%SECTION%[a-z]*$$/p'; \
+       fi; \
 ## Extract basename of manpage, change the extension if needed.
        } | while read p; do \
 ## Find the file.