1 # Generate code to set up dependency tracking. -*- Autoconf -*-
3 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 # _AM_OUTPUT_DEPENDENCY_COMMANDS
23 # ------------------------------
24 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
25 [for mf in $CONFIG_FILES; do
26 # Strip MF so we end up with the name of the file.
27 mf=`echo "$mf" | sed -e 's/:.*$//'`
28 if (sed 1q $mf | fgrep 'generated by automake') > /dev/null 2>&1; then
29 dirpart=`AS_DIRNAME("$mf")`
33 grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
34 # Extract the definition of DEP_FILES from the Makefile without
36 DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
37 test -z "$DEPDIR" && continue
38 # When using ansi2knr, U may be empty or an underscore; expand it
39 U=`sed -n -e '/^U = / s///p' < "$mf"`
40 test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
41 # We invoke sed twice because it is the simplest approach to
42 # changing $(DEPDIR) to its actual value in the expansion.
43 for file in `sed -n -e '
44 /^DEP_FILES = .*\\\\$/ {
53 /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
54 sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
55 # Make sure the directory exists.
56 test -f "$dirpart/$file" && continue
57 fdir=`AS_DIRNAME(["$file"])`
58 AS_MKDIR_P([$dirpart/$fdir])
59 # echo "creating $dirpart/$file"
60 echo '# dummy' > "$dirpart/$file"
63 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
66 # AM_OUTPUT_DEPENDENCY_COMMANDS
67 # -----------------------------
68 # This macro should only be invoked once -- use via AC_REQUIRE.
70 # This code is only required when automatic dependency tracking
71 # is enabled. FIXME. This creates each `.P' file that we will
72 # need in order to bootstrap the dependency handling code.
73 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
74 [AC_CONFIG_COMMANDS([depfiles],
75 [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
76 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])