tests: quote 'like this', not `like this', as per GCS recommendation
[platform/upstream/automake.git] / lib / am / ltlib.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%LTLIBRARIES
28 install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES)
29         @$(NORMAL_INSTALL)
30         test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
31 if %?BASE%
32 ## Funny invocation because Makefile variable can be empty, leading to
33 ## a syntax error in sh.
34         @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
35         list2=; for p in $$list; do \
36           if test -f $$p; then \
37             list2="$$list2 $$p"; \
38           else :; fi; \
39         done; \
40         test -z "$$list2" || { \
41 ## Note that we explicitly set the libtool mode.  This avoids any lossage
42 ## if the program doesn't have a name that libtool expects.
43 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
44 ## permissions to use.
45 ?LIBTOOL?         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
46 ?LIBTOOL?         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(%NDIR%dir)"; \
47 ?!LIBTOOL?        echo " $(INSTALL) $(INSTALL_STRIP_FLAG) $$list '$(DESTDIR)$(%NDIR%dir)'"; \
48 ?!LIBTOOL?        $(INSTALL) $(INSTALL_STRIP_FLAG) $$list "$(DESTDIR)$(%NDIR%dir)"; \
49         }
50 else !%?BASE%
51         @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)"  || list=; \
52         for p in $$list; do if test -f "$$p"; then echo "$$p $$p"; else :; fi; done | \
53         sed '/ .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
54         $(AWK) 'BEGIN { cur = "." } \
55           { if ($$2 == cur) { files = files " " $$1 } \
56             else { print cur, files; files = $$1; cur = $$2 } } \
57           END { print cur, files }' | \
58         while read dir files; do \
59           test -z "$$files" || { \
60             test "x$$dir" = x. || { \
61               echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
62               $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
63 ## Note that we explicitly set the libtool mode.  This avoids any lossage
64 ## if the program doesn't have a name that libtool expects.
65 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
66 ## permissions to use.
67 ?LIBTOOL?           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$files '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
68 ?LIBTOOL?           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$files "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
69 ?!LIBTOOL?          echo " $(INSTALL) $(INSTALL_STRIP_FLAG) $$files '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
70 ?!LIBTOOL?          $(INSTALL) $(INSTALL_STRIP_FLAG) $$files "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
71           }; \
72         done
73 endif !%?BASE%
74 endif %?INSTALL%
75
76
77 ## -------------- ##
78 ## Uninstalling.  ##
79 ## -------------- ##
80
81 if %?INSTALL%
82 .PHONY uninstall-am: uninstall-%DIR%LTLIBRARIES
83 uninstall-%DIR%LTLIBRARIES:
84         @$(NORMAL_UNINSTALL)
85         @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
86         for p in $$list; do \
87           %BASE?$(am__strip_dir):f=$$p;% \
88 ?LIBTOOL?         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
89 ?LIBTOOL?         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
90 ?!LIBTOOL?        echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
91 ?!LIBTOOL?        rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
92         done
93 endif %?INSTALL%
94
95
96 ## ---------- ##
97 ## Cleaning.  ##
98 ## ---------- ##
99
100 .PHONY clean-am: clean-%DIR%LTLIBRARIES
101 clean-%DIR%LTLIBRARIES:
102         -test -z "$(%DIR%_LTLIBRARIES)" || rm -f $(%DIR%_LTLIBRARIES)
103 ## `so_locations' files are created by some linkers (IRIX, OSF) when
104 ## building a shared object.  Libtool places these files in the
105 ## directory where the shared object is created.
106         @list='$(%DIR%_LTLIBRARIES)'; \
107         locs=`for p in $$list; do echo $$p; done | \
108               sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
109               sort -u`; \
110         test -z "$$locs" || { \
111           echo rm -f $${locs}; \
112           rm -f $${locs}; \
113         }