* COPYING, lib/COPYING: Update to GPLv3. All uses changed.
[platform/upstream/automake.git] / lib / am / scripts.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2003, 2004, 2006
3 ## Free Software Foundation, Inc.
4
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 3, or (at your option)
8 ## any later version.
9
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 ## 02110-1301, USA.
19
20 if %?INSTALL%
21 if ! %?BASE%
22 include inst-vars.am
23 endif ! %?BASE%
24 endif %?INSTALL%
25
26 ## ------------ ##
27 ## Installing.  ##
28 ## ------------ ##
29
30 if %?INSTALL%
31 ## if doesn't work properly for Automake variables yet.
32 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
33 ?BASE?%DIR%SCRIPT_INSTALL = $(INSTALL_SCRIPT)
34 ?!BASE?%DIR%SCRIPT_INSTALL = $(install_sh_SCRIPT)
35 ?EXEC?.PHONY install-exec-am: install-%DIR%SCRIPTS
36 ?!EXEC?.PHONY install-data-am: install-%DIR%SCRIPTS
37 install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
38         @$(NORMAL_INSTALL)
39         test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
40 ?!BASE? @$(am__vpath_adj_setup) \
41 ## Funny invocation because Makefile variable can be empty, leading to
42 ## a syntax error in sh.
43 ?!BASE? list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
44 ?BASE?  @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
45 ?!BASE?   $(am__vpath_adj) p=$$f; \
46 ## A file can be in the source directory or the build directory.
47           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
48           if test -f $$d$$p; then \
49 ## If the _SCRIPTS variable has an entry like foo/bar, install it as
50 ## $(destdir)/bar, not $(destdir)/foo/bar.  The user can make a
51 ## new dir variable or use a nobase_ target for the latter case.
52 ## However in all cases $(transform) applies only to the basename,
53 ## so we have to strip the directory part.
54             f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
55 ## Prepend the directory part if nobase_ is used.
56 ?!BASE?     f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
57             echo " $(%DIR%SCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
58             $(%DIR%SCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \
59           else :; fi; \
60         done
61 endif %?INSTALL%
62
63
64 ## -------------- ##
65 ## Uninstalling.  ##
66 ## -------------- ##
67
68 if %?INSTALL%
69 .PHONY uninstall-am: uninstall-%DIR%SCRIPTS
70 uninstall-%DIR%SCRIPTS:
71         @$(NORMAL_UNINSTALL)
72 ?!BASE? @$(am__vpath_adj_setup) \
73 ?!BASE? list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
74 ?BASE?  @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
75 ?!BASE?   $(am__vpath_adj) p=$$f; \
76 ## Remove any leading directory before applying $(transform).
77           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
78 ## Prepend the directory part if nobase_ is used.
79 ?!BASE?   f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
80           echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
81           rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
82         done
83 endif %?INSTALL%
84
85
86 ## -------------- ##
87 ## Distributing.  ##
88 ## -------------- ##
89
90 if %?DIST%
91 DIST_COMMON += %DISTVAR%
92 endif %?DIST%
93
94
95 ## ---------- ##
96 ## Checking.  ##
97 ## ---------- ##
98
99 if %?CK-OPTS%
100 .PHONY installcheck-am: installcheck-%DIR%SCRIPTS
101 installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
102         bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
103           case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
104 ## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
105 ## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
106            *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
107           esac; \
108 ## Strip any leading directory before applying $(transform).
109           f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \
110 ## Insert the directory back if nobase_ is used.
111 ?!BASE?   f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
112           for opt in --help --version; do \
113             if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt >c$${pid}_.out \
114                  2>c$${pid}_.err </dev/null \
115                  && test -n "`cat c$${pid}_.out`" \
116                  && test -z "`cat c$${pid}_.err`"; then :; \
117             else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
118           done; \
119         done; rm -f c$${pid}_.???; exit $$bad
120 endif %?CK-OPTS%