mans.am 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. ## automake - create Makefile.in from Makefile.am
  2. ## Copyright (C) 1998-2017 Free Software Foundation, Inc.
  3. ## This program is free software; you can redistribute it and/or modify
  4. ## it under the terms of the GNU General Public License as published by
  5. ## the Free Software Foundation; either version 2, or (at your option)
  6. ## any later version.
  7. ## This program is distributed in the hope that it will be useful,
  8. ## but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ## GNU General Public License for more details.
  11. ## You should have received a copy of the GNU General Public License
  12. ## along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. include inst-vars.am
  14. man%SECTION%dir = $(mandir)/man%SECTION%
  15. ## ------------ ##
  16. ## Installing. ##
  17. ## ------------ ##
  18. ## MANS primary are always installed in mandir, hence install-data
  19. ## is hard coded.
  20. .PHONY: install-man
  21. ?INSTALL-MAN?install-data-am: install-man
  22. ?INSTALL-MAN?am__installdirs += "$(DESTDIR)$(man%SECTION%dir)"
  23. .PHONY install-man: install-man%SECTION%
  24. install-man%SECTION%: %DEPS%
  25. @$(NORMAL_INSTALL)
  26. if %?NOTRANS_MANS%
  27. ## Handle MANS with notrans_ prefix
  28. @list1='%NOTRANS_SECT_LIST%'; \
  29. ?!HAVE_NOTRANS? list2=''; \
  30. ?HAVE_NOTRANS? list2='%NOTRANS_LIST%'; \
  31. test -n "$(man%SECTION%dir)" \
  32. && test -n "`echo $$list1$$list2`" \
  33. || exit 0; \
  34. echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
  35. $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
  36. { for i in $$list1; do echo "$$i"; done; \
  37. ## Extract all items from notrans_man_MANS that should go in this section.
  38. ## This must be done dynamically to support conditionals.
  39. if test -n "$$list2"; then \
  40. for i in $$list2; do echo "$$i"; done \
  41. ## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
  42. | sed -n '/\.%SECTION%[a-z]*$$/p'; \
  43. fi; \
  44. ## Extract basename of manpage, change the extension if needed.
  45. } | while read p; do \
  46. ## Find the file.
  47. if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
  48. echo "$$d$$p"; echo "$$p"; \
  49. done | \
  50. ## Extract the basename of the man page and change the extension if needed.
  51. sed 'n;s,.*/,,;p;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,' | \
  52. sed 'N;N;s,\n, ,g' | { \
  53. ## We now have a list "sourcefile basename installed-name".
  54. list=; while read file base inst; do \
  55. if test "$$base" = "$$inst"; then list="$$list $$file"; else \
  56. echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
  57. $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || exit $$?; \
  58. fi; \
  59. done; \
  60. for i in $$list; do echo "$$i"; done | $(am__base_list) | \
  61. while read files; do \
  62. test -z "$$files" || { \
  63. echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man%SECTION%dir)'"; \
  64. $(INSTALL_DATA) $$files "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; }; \
  65. done; }
  66. endif %?NOTRANS_MANS%
  67. if %?TRANS_MANS%
  68. ## Handle MANS without notrans_ prefix
  69. @list1='%TRANS_SECT_LIST%'; \
  70. ?!HAVE_TRANS? list2=''; \
  71. ?HAVE_TRANS? list2='%TRANS_LIST%'; \
  72. test -n "$(man%SECTION%dir)" \
  73. && test -n "`echo $$list1$$list2`" \
  74. || exit 0; \
  75. echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
  76. $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
  77. { for i in $$list1; do echo "$$i"; done; \
  78. ## Extract all items from notrans_man_MANS that should go in this section.
  79. ## This must be done dynamically to support conditionals.
  80. if test -n "$$list2"; then \
  81. for i in $$list2; do echo "$$i"; done \
  82. ## Accept for 'man1' files like `foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
  83. | sed -n '/\.%SECTION%[a-z]*$$/p'; \
  84. fi; \
  85. ## Extract basename of manpage, change the extension if needed.
  86. } | while read p; do \
  87. ## Find the file.
  88. if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
  89. echo "$$d$$p"; echo "$$p"; \
  90. done | \
  91. ## Extract the basename of the man page and change the extension if needed.
  92. sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
  93. -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
  94. sed 'N;N;s,\n, ,g' | { \
  95. ## We now have a list "sourcefile basename installed-name".
  96. list=; while read file base inst; do \
  97. if test "$$base" = "$$inst"; then list="$$list $$file"; else \
  98. echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
  99. $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || exit $$?; \
  100. fi; \
  101. done; \
  102. for i in $$list; do echo "$$i"; done | $(am__base_list) | \
  103. while read files; do \
  104. test -z "$$files" || { \
  105. echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man%SECTION%dir)'"; \
  106. $(INSTALL_DATA) $$files "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; }; \
  107. done; }
  108. endif %?TRANS_MANS%
  109. ## -------------- ##
  110. ## Uninstalling. ##
  111. ## -------------- ##
  112. .PHONY: uninstall-man
  113. ?INSTALL-MAN?uninstall-am: uninstall-man
  114. .PHONY uninstall-man: uninstall-man%SECTION%
  115. uninstall-man%SECTION%:
  116. @$(NORMAL_UNINSTALL)
  117. if %?NOTRANS_MANS%
  118. ## Handle MANS with notrans_ prefix
  119. @list='%NOTRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
  120. files=`{ for i in $$list; do echo "$$i"; done; \
  121. ## Extract all items from notrans_man_MANS that should go in this section.
  122. ## This must be done dynamically to support conditionals.
  123. ?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
  124. ## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
  125. ?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
  126. ## Extract basename of manpage, change the extension if needed.
  127. } | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \
  128. dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
  129. endif %?NOTRANS_MANS%
  130. if %?TRANS_MANS%
  131. ## Handle MANS without notrans_ prefix
  132. @list='%TRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
  133. files=`{ for i in $$list; do echo "$$i"; done; \
  134. ## Extract all items from man_MANS that should go in this section.
  135. ## This must be done dynamically to support conditionals.
  136. ?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
  137. ## Accept for 'man1' files like 'foo.1c' but not 'sub.1/foo.2' or 'foo-2.1.4'.
  138. ?HAVE_TRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
  139. ## Extract basename of manpage, run it through the program rename
  140. ## transform, and change the extension if needed.
  141. } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
  142. -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
  143. dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
  144. endif %?TRANS_MANS%