* configure.in, NEWS: Bump version to 1.7.9.
[automake.git] / lib / am / scripts.am
bloba2b62ab321a61402c17e774bbb192c4d62d4d23e
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright 1994, 1995, 1996, 1998, 1999, 2001 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., 59 Temple Place - Suite 330, Boston, MA
17 ## 02111-1307, USA.
20 ## ------------ ##
21 ## Installing.  ##
22 ## ------------ ##
24 if %?INSTALL%
25 ## if doesn't work properly for Automake variables yet.
26 am__installdirs += $(DESTDIR)$(%NDIR%dir)
27 ?BASE?%DIR%SCRIPT_INSTALL = $(INSTALL_SCRIPT)
28 ?!BASE?%DIR%SCRIPT_INSTALL = $(install_sh_SCRIPT)
29 ?EXEC?.PHONY install-exec-am: install-%DIR%SCRIPTS
30 ?!EXEC?.PHONY install-data-am: install-%DIR%SCRIPTS
31 install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
32         @$(NORMAL_INSTALL)
33         $(mkinstalldirs) $(DESTDIR)$(%NDIR%dir)
34 ## Funny invocation because Makefile variable can be empty, leading to
35 ## a syntax error in sh.
36         @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
37 ## A file can be in the source directory or the build directory.
38           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
39           if test -f $$d$$p; then \
40 ## If the _SCRIPTS variable has an entry like foo/bar, install it as
41 ## $(destdir)/bar, not $(destdir)/foo/bar.  The user can make a
42 ## new dir variable or use a nobase_ target for the latter case.
43 ## However in all cases $(transform) applies only to the basename,
44 ## so we have to strip the directory part.
45             f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
46 ## Prepend the directory part if nobase_ is used.
47 ?!BASE?     f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
48             echo " $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
49             $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \
50           else :; fi; \
51         done
52 endif %?INSTALL%
55 ## -------------- ##
56 ## Uninstalling.  ##
57 ## -------------- ##
59 if %?INSTALL%
60 .PHONY uninstall-am: uninstall-%DIR%SCRIPTS
61 uninstall-%DIR%SCRIPTS:
62         @$(NORMAL_UNINSTALL)
63         @list='$(%DIR%_SCRIPTS)'; for p in $$list; do \
64 ## Remove any leading directory before applying $(transform).
65           f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \
66 ## Prepend the directory part if nobase_ is used.
67 ?!BASE?   f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
68           echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \
69           rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \
70         done
71 endif %?INSTALL%
74 ## -------------- ##
75 ## Distributing.  ##
76 ## -------------- ##
78 if %?DIST%
79 DIST_COMMON += $(%DIR%_SCRIPTS)
80 endif %?DIST%
83 ## ---------- ##
84 ## Checking.  ##
85 ## ---------- ##
87 if %?CK-OPTS%
88 .PHONY installcheck-am: installcheck-%DIR%SCRIPTS
89 installcheck-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
90         bad=0; pid=$$$$; list="$(%DIR%_SCRIPTS)"; for p in $$list; do \
91           case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
92 ## Match $(srcdir)/$$p in addition to $$p because Sun make might rewrite
93 ## filenames in AM_INSTALLCHECK_STD_OPTIONS_EXEMPT during VPATH builds.
94            *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
95           esac; \
96 ## Strip any leading directory before applying $(transform).
97           f=`echo "$$p" | sed 's,^.*/,,;$(transform)'`; \
98 ## Insert the directory back if nobase_ is used.
99 ?!BASE?   f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \
100           for opt in --help --version; do \
101             if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \
102                  && test -n "`cat c$${pid}_.out`" \
103                  && test -z "`cat c$${pid}_.err`"; then :; \
104             else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
105           done; \
106         done; rm -f c$${pid}_.???; exit $$bad
107 endif %?CK-OPTS%