tests: fix automatic re-execution of tests with Zsh
[platform/upstream/automake.git] / lib / am / libs.am
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-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 if %?INSTALL%
18 include inst-vars.am
19 endif %?INSTALL%
20
21 ## ------------ ##
22 ## Installing.  ##
23 ## ------------ ##
24
25 if %?INSTALL%
26 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
27 .PHONY install-%EXEC?exec:data%-am: install-%DIR%LIBRARIES
28 install-%DIR%LIBRARIES: $(%DIR%_LIBRARIES)
29         @$(NORMAL_INSTALL)
30 if %?BASE%
31 ## Funny invocation because Makefile variable can be empty, leading to
32 ## a syntax error in sh.
33         @list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
34         list2=; for p in $$list; do \
35           if test -f $$p; then \
36             list2="$$list2 $$p"; \
37           else :; fi; \
38         done; \
39         test -z "$$list2" || { \
40           echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
41           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
42           echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
43           $(INSTALL_DATA) $$list2 "$(DESTDIR)$(%NDIR%dir)" || exit $$?; }
44 else !%?BASE%
45 ## Funny invocation because Makefile variable can be empty, leading to
46 ## a syntax error in sh.
47         @list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
48         if test -n "$$list"; then \
49           echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
50           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
51         fi; \
52         $(am__nobase_list) | while read dir files; do \
53           xfiles=; for p in $$files; do \
54             if test -f "$$p"; then xfiles="$$xfiles $$p"; else :; fi; done; \
55           test -z "$$xfiles" || { \
56             test "x$$dir" = x. || { \
57               echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
58               $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
59             echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
60             $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
61         done
62 endif !%?BASE%
63 ## We do two loops here so that $(POST_INSTALL) can be empty.  If we
64 ## merge the two loops, we get a syntax error from sh.  Anyway, having
65 ## $(POST_INSTALL) in the middle of the loop essentially renders it
66 ## useless; sh never actually executes this command.  Read the GNU
67 ## Standards for a little enlightenment on this.
68         @$(POST_INSTALL)
69         @list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
70         for p in $$list; do \
71           if test -f $$p; then \
72             %BASE?$(am__strip_dir):f=$$p;% \
73 ## Must ranlib after installing because mod time changes.
74 ## cd to target directory because AIX ranlib messes up with whitespace
75 ## in the argument.
76             echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && $(RANLIB) $$f )"; \
77             ( cd "$(DESTDIR)$(%NDIR%dir)" && $(RANLIB) $$f ) || exit $$?; \
78           else :; fi; \
79         done
80 endif %?INSTALL%
81
82
83 ## -------------- ##
84 ## Uninstalling.  ##
85 ## -------------- ##
86
87 if %?INSTALL%
88 .PHONY uninstall-am: uninstall-%DIR%LIBRARIES
89 uninstall-%DIR%LIBRARIES:
90         @$(NORMAL_UNINSTALL)
91         @list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
92 ?BASE?  files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
93 ?!BASE? $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
94         dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
95 endif %?INSTALL%
96
97
98 ## ---------- ##
99 ## Cleaning.  ##
100 ## ---------- ##
101
102 .PHONY clean-am: clean-%DIR%LIBRARIES
103 clean-%DIR%LIBRARIES:
104         -test -z "$(%DIR%_LIBRARIES)" || rm -f $(%DIR%_LIBRARIES)