Update automake to version 1.10
[msysgit.git] / share / automake-1.10 / am / mans.am
blob29b8fea726565b32f821dc88fb88938092b903e6
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1998, 2001, 2003, 2004, 2006 Free Software Foundation, Inc.
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.
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.
14 ## You should have received a copy of the GNU General Public License
15 ## along with this program; if not, write to the Free Software
16 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 ## 02110-1301, USA.
19 man%SECTION%dir = $(mandir)/man%SECTION%
21 ## ------------ ##
22 ## Installing.  ##
23 ## ------------ ##
25 ## MANS primary are always installed in mandir, hence install-data
26 ## is hard coded.
28 .PHONY: install-man
29 ?INSTALL-MAN?install-data-am: install-man
30 ?INSTALL-MAN?am__installdirs += "$(DESTDIR)$(man%SECTION%dir)"
31 .PHONY install-man: install-man%SECTION%
32 install-man%SECTION%: $(man%SECTION%_MANS) $(man_MANS)
33         @$(NORMAL_INSTALL)
34         test -z "$(man%SECTION%dir)" || $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)"
35         @list='$(man%SECTION%_MANS) $(dist_man%SECTION%_MANS) $(nodist_man%SECTION%_MANS)'; \
36 ## Extract all items from man_MANS that should go in this section.
37 ## This must be done dynamically to support conditionals.
38         l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
39         for i in $$l2; do \
40           case "$$i" in \
41 ## Have to accept files like `foo.1c'.
42             *.%SECTION%*) list="$$list $$i" ;; \
43           esac; \
44         done; \
45         for i in $$list; do \
46 ## Find the file.
47           if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
48           else file=$$i; fi; \
49 ## Change the extension if needed.
50           ext=`echo $$i | sed -e 's/^.*\\.//'`; \
51           case "$$ext" in \
52             %SECTION%*) ;; \
53             *) ext='%SECTION%' ;; \
54           esac; \
55 ## Extract basename of man page and run it through the program rename
56 ## transform.
57           inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
58           inst=`echo $$inst | sed -e 's/^.*\///'`; \
59           inst=`echo $$inst | sed '$(transform)'`.$$ext; \
60           echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
61           $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \
62         done
65 ## -------------- ##
66 ## Uninstalling.  ##
67 ## -------------- ##
69 ## This is just completely gross.
70 .PHONY: uninstall-man
71 ?INSTALL-MAN?uninstall-am: uninstall-man
72 .PHONY uninstall-man: uninstall-man%SECTION%
73 uninstall-man%SECTION%:
74         @$(NORMAL_UNINSTALL)
75         @list='$(man%SECTION%_MANS) $(dist_man%SECTION%_MANS) $(nodist_man%SECTION%_MANS)'; \
76 ## Extract all items from man_MANS that should go in this section.
77 ## This must be done dynamically to support conditionals.
78         l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
79         for i in $$l2; do \
80           case "$$i" in \
81 ## Have to accept files like `foo.1c'.
82             *.%SECTION%*) list="$$list $$i" ;; \
83           esac; \
84         done; \
85         for i in $$list; do \
86 ## Change the extension if needed.
87           ext=`echo $$i | sed -e 's/^.*\\.//'`; \
88           case "$$ext" in \
89             %SECTION%*) ;; \
90             *) ext='%SECTION%' ;; \
91           esac; \
92 ## Extract basename of man page and run it through the program rename
93 ## transform.
94           inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
95           inst=`echo $$inst | sed -e 's/^.*\///'`; \
96           inst=`echo $$inst | sed '$(transform)'`.$$ext; \
97           echo " rm -f '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
98           rm -f "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \
99         done