* Makefile.am (cvs-release): Upload to ~ftp/pub/automake, not
[automake.git] / m4 / depout.m4
blobbaad9ea5c22a387313eeedb3c3288c3d0efa945d
1 # Generate code to set up dependency tracking.   -*- Autoconf -*-
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
4 #   Free Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2, or (at your option)
9 # any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 # 02111-1307, USA.
21 #serial 2
23 # _AM_OUTPUT_DEPENDENCY_COMMANDS
24 # ------------------------------
25 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
26 [for mf in $CONFIG_FILES; do
27   # Strip MF so we end up with the name of the file.
28   mf=`echo "$mf" | sed -e 's/:.*$//'`
29   # Check whether this is an Automake generated Makefile or not.
30   # We used to match only the files named `Makefile.in', but
31   # some people rename them; so instead we look at the file content.
32   # Grep'ing the first line is not enough: some people post-process
33   # each Makefile.in and add a new line on top of each file to say so.
34   # So let's grep whole file.
35   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
36     dirpart=`AS_DIRNAME("$mf")`
37   else
38     continue
39   fi
40   # Extract the definition of DEPDIR, am__include, and am__quote
41   # from the Makefile without running `make'.
42   DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
43   test -z "$DEPDIR" && continue
44   am__include=`sed -n 's/^am__include = //p' < "$mf"`
45   test -z "am__include" && continue
46   am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
47   # When using ansi2knr, U may be empty or an underscore; expand it
48   U=`sed -n 's/^U = //p' < "$mf"`
49   # Find all dependency output files, they are included files with
50   # $(DEPDIR) in their names.  We invoke sed twice because it is the
51   # simplest approach to changing $(DEPDIR) to its actual value in the
52   # expansion.
53   for file in `sed -n "
54     s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
55        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
56     # Make sure the directory exists.
57     test -f "$dirpart/$file" && continue
58     fdir=`AS_DIRNAME(["$file"])`
59     AS_MKDIR_P([$dirpart/$fdir])
60     # echo "creating $dirpart/$file"
61     echo '# dummy' > "$dirpart/$file"
62   done
63 done
64 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
67 # AM_OUTPUT_DEPENDENCY_COMMANDS
68 # -----------------------------
69 # This macro should only be invoked once -- use via AC_REQUIRE.
71 # This code is only required when automatic dependency tracking
72 # is enabled.  FIXME.  This creates each `.P' file that we will
73 # need in order to bootstrap the dependency handling code.
74 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
75 [AC_CONFIG_COMMANDS([depfiles],
76      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
77      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])