test: check that subsecond mtime works with make.
[automake.git] / lib / am / inst-vars.am
blob323292678aab2d9e7ec731ea41d45ecdf92a84db
1 ## automake - create Makefile.in from Makefile.am
2 ## Copyright (C) 2004-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 %?FIRST%
19 ## These variables help stripping any $(VPATH) that some
20 ## Make implementations prepend before VPATH-found files.
21 ## The issue is discussed at length in distdir.am.
22 am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
23 am__vpath_adj = case $$p in \
24     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
25     *) f=$$p;; \
26   esac;
27 ## Strip all directories.
28 am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
29 ## Number of files to install concurrently.
30 am__install_max = 40
31 ## Take a $list of nobase files, strip $(srcdir) from them.
32 ## Split apart in setup variable and an action that can be used
33 ## in backticks or in a pipe.
34 am__nobase_strip_setup = \
35   srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
36 am__nobase_strip = \
37   for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
38 ## Take a $list of nobase files, collect them, indexed by their
39 ## srcdir-stripped dirnames.  For up to am__install_max files, output
40 ## a line containing the dirname and the files, space-separated.
41 ## The arbitrary limit helps avoid the quadratic scaling exhibited by
42 ## string concatenation in most shells, and should avoid line length
43 ## limitations, while still offering only negligible performance impact
44 ## through spawning more install commands than absolutely needed.
45 am__nobase_list = $(am__nobase_strip_setup); \
46   for p in $$list; do echo "$$p $$p"; done | \
47   sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
48   $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
49     if (++n[$$2] == $(am__install_max)) \
50       { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
51     END { for (dir in files) print dir, files[dir] }'
52 ## Collect up to 40 files per line from stdin.
53 am__base_list = \
54   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
55   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
57 ## A shell code fragment to uninstall files from a given directory.
58 ## It expects the $dir and $files shell variables to be defined respectively
59 ## to the directory where the files to be removed are, and to the list of
60 ## such files.
61 am__uninstall_files_from_dir = { \
62 ## At least Solaris /bin/sh still lacks 'test -e', so we use the multiple
63 ## tests below instead.  We expect $dir to be either non-existent or a
64 ## directory, so the failure we'll experience if it is a regular file
65 ## is indeed desired and welcome (better to fail loudly thasn silently).
66   { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
67   || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
68        $(am__cd) "$$dir" && echo $$files | $(am__xargs_n) 40 $(am__rm_f); }; \
69   }
71 endif %?FIRST%