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