doc: modernize version control doc
[automake.git] / lib / am / ltlib.am
blob5ed189e2063fd8c0748b6a87596afcec75003349
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 1994-2024 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, see <https://www.gnu.org/licenses/>.
17 if %?INSTALL%
18 include inst-vars.am
19 endif %?INSTALL%
21 ## ------------ ##
22 ## Installing.  ##
23 ## ------------ ##
25 if %?INSTALL%
27 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
29 ?EXEC?.PHONY install-exec-am: install-%DIR%LTLIBRARIES
30 ?!EXEC?.PHONY install-data-am: install-%DIR%LTLIBRARIES
32 install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES)
33         @$(NORMAL_INSTALL)
34 if %?BASE%
35 ## Funny invocation because Makefile variable can be empty, leading to
36 ## a syntax error in sh.
37         @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
38         list2=; for p in $$list; do \
39           if test -f $$p; then \
40             list2="$$list2 $$p"; \
41           else :; fi; \
42         done; \
43         test -z "$$list2" || { \
44           echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
45           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
46 ## Note that we explicitly set the libtool mode.  This avoids problems
47 ## if the program doesn't have a name that libtool expects.
48 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
49 ## permissions to use.
50 ?LIBTOOL?         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
51 ?LIBTOOL?         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(%NDIR%dir)"; \
52 ?!LIBTOOL?        echo " $(INSTALL) $(INSTALL_STRIP_FLAG) $$list '$(DESTDIR)$(%NDIR%dir)'"; \
53 ?!LIBTOOL?        $(INSTALL) $(INSTALL_STRIP_FLAG) $$list "$(DESTDIR)$(%NDIR%dir)"; \
54         }
55 else !%?BASE%
56         @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)"  || list=; \
57         if test -n "$$list"; then \
58             echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
59             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
60         fi; \
61         for p in $$list; do if test -f "$$p"; then echo "$$p $$p"; else :; fi; done | \
62         sed '/ .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
63         $(AWK) 'BEGIN { cur = "." } \
64           { if ($$2 == cur) { files = files " " $$1 } \
65             else { print cur, files; files = $$1; cur = $$2 } } \
66           END { print cur, files }' | \
67         while read dir files; do \
68           test -z "$$files" || { \
69             test "x$$dir" = x. || { \
70               echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
71               $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
72 ## Note that we explicitly set the libtool mode.  This avoids problems
73 ## if the program doesn't have a name that libtool expects.
74 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
75 ## permissions to use.
76 ?LIBTOOL?           echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$files '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
77 ?LIBTOOL?           $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$files "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
78 ?!LIBTOOL?          echo " $(INSTALL) $(INSTALL_STRIP_FLAG) $$files '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
79 ?!LIBTOOL?          $(INSTALL) $(INSTALL_STRIP_FLAG) $$files "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
80           }; \
81         done
82 endif !%?BASE%
83 endif %?INSTALL%
86 ## -------------- ##
87 ## Uninstalling.  ##
88 ## -------------- ##
90 if %?INSTALL%
91 .PHONY uninstall-am: uninstall-%DIR%LTLIBRARIES
92 uninstall-%DIR%LTLIBRARIES:
93         @$(NORMAL_UNINSTALL)
94         @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
95         for p in $$list; do \
96 ?BASE?    $(am__strip_dir) \
97 ?!BASE?   f=$$p; \
98 ?LIBTOOL?         echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
99 ?LIBTOOL?         $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
100 ?!LIBTOOL?        echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
101 ?!LIBTOOL?        rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
102         done
103 endif %?INSTALL%
106 ## ---------- ##
107 ## Cleaning.  ##
108 ## ---------- ##
110 .PHONY clean-am: clean-%DIR%LTLIBRARIES
111 clean-%DIR%LTLIBRARIES:
112         -$(am__rm_f) $(%DIR%_LTLIBRARIES)
113 ## 'so_locations' files are created by some linkers (IRIX, OSF) when
114 ## building a shared object.  Libtool places these files in the
115 ## directory where the shared object is created.
116         @list='$(%DIR%_LTLIBRARIES)'; \
117         locs=`for p in $$list; do echo $$p; done | \
118               sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
119               sort -u`; \
120         echo rm -f $${locs}; \
121         $(am__rm_f) $${locs}