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