summaryrefslogtreecommitdiff
path: root/lib/am/mans.am
blob: bfc71dc99a0055d2b3e3e05e46f0776cd3623207 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
## automake - create Makefile.in from Makefile.am
## Copyright (C) 1998-2012 Free Software Foundation, Inc.

## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2, or (at your option)
## any later version.

## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with this program.  If not, see <http://www.gnu.org/licenses/>.

include inst-vars.am
man%SECTION%dir = $(mandir)/man%SECTION%

## ------------ ##
## Installing.  ##
## ------------ ##

## MANS primary are always installed in mandir, hence install-data
## is hard coded.

.PHONY: install-man
?INSTALL-MAN?install-data-am: install-man
?INSTALL-MAN?am__installdirs += "$(DESTDIR)$(man%SECTION%dir)"
.PHONY install-man: install-man%SECTION%
install-man%SECTION%: %DEPS%
	@$(NORMAL_INSTALL)
if %?NOTRANS_MANS%
## Handle MANS with notrans_ prefix
	@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.
	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.
	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; echo "$$p"; \
	done | \
## Extract the basename of the man page and change the extension if needed.
	sed 'n;s,.*/,,;p;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,' | \
	sed 'N;N;s,\n, ,g' | { \
## We now have a list "sourcefile basename installed-name".
	list=; while read file base inst; do \
	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || exit $$?; \
	  fi; \
	done; \
	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
	while read files; do \
	  test -z "$$files" || { \
	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man%SECTION%dir)'"; \
	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; }; \
	done; }
endif %?NOTRANS_MANS%
if %?TRANS_MANS%
## Handle MANS without notrans_ prefix
	@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.
	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.
	  if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
	  echo "$$d$$p"; echo "$$p"; \
	done | \
## Extract the basename of the man page and change the extension if needed.
	sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
	sed 'N;N;s,\n, ,g' | { \
## We now have a list "sourcefile basename installed-name".
	list=; while read file base inst; do \
	  if test "$$base" = "$$inst"; then list="$$list $$file"; else \
	    echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
	    $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || exit $$?; \
	  fi; \
	done; \
	for i in $$list; do echo "$$i"; done | $(am__base_list) | \
	while read files; do \
	  test -z "$$files" || { \
	    echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man%SECTION%dir)'"; \
	    $(INSTALL_DATA) $$files "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; }; \
	done; }
endif %?TRANS_MANS%


## -------------- ##
## Uninstalling.  ##
## -------------- ##

.PHONY: uninstall-man
?INSTALL-MAN?uninstall-am: uninstall-man
.PHONY uninstall-man: uninstall-man%SECTION%
uninstall-man%SECTION%:
	@$(NORMAL_UNINSTALL)
if %?NOTRANS_MANS%
## Handle MANS with notrans_ prefix
	@list='%NOTRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
	files=`{ for i in $$list; 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 | \
## 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'; \
## Extract basename of manpage, change the extension if needed.
	} | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \
	dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
endif %?NOTRANS_MANS%
if %?TRANS_MANS%
## Handle MANS without notrans_ prefix
	@list='%TRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
	files=`{ for i in $$list; do echo "$$i"; done; \
## Extract all items from 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'; \
## Extract basename of manpage, run it through the program rename
## transform, and change the extension if needed.
	} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' \
	      -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
	dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
endif %?TRANS_MANS%