Merge branch 'maint'
[platform/upstream/automake.git] / m4 / depout.m4
1 # Generate code to set up dependency tracking.              -*- Autoconf -*-
2
3 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
4 # Free Software Foundation, Inc.
5 #
6 # This file is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
9
10 #serial 5
11
12 # _AM_OUTPUT_DEPENDENCY_COMMANDS
13 # ------------------------------
14 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
15 [{
16   # Autoconf 2.62 quotes --file arguments for eval, but not when files
17   # are listed without --file.  Let's play safe and only enable the eval
18   # if we detect the quoting.
19   case $CONFIG_FILES in
20   *\'*) eval set x "$CONFIG_FILES" ;;
21   *)   set x $CONFIG_FILES ;;
22   esac
23   shift
24   for mf
25   do
26     # Strip MF so we end up with the name of the file.
27     mf=`echo "$mf" | sed -e 's/:.*$//'`
28     # Check whether this is an Automake generated Makefile or not.
29     # We used to match only the files named `Makefile.in', but
30     # some people rename them; so instead we look at the file content.
31     # Grep'ing the first line is not enough: some people post-process
32     # each Makefile.in and add a new line on top of each file to say so.
33     # Grep'ing the whole file is not good either: AIX grep has a line
34     # limit of 2048, but all sed's we know have understand at least 4000.
35     if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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     # Find all dependency output files, they are included files with
48     # $(DEPDIR) in their names.  We invoke sed twice because it is the
49     # simplest approach to changing $(DEPDIR) to its actual value in the
50     # expansion.
51     for file in `sed -n "
52       s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
53          sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
54       # Make sure the directory exists.
55       test -f "$dirpart/$file" && continue
56       fdir=`AS_DIRNAME(["$file"])`
57       AS_MKDIR_P([$dirpart/$fdir])
58       # echo "creating $dirpart/$file"
59       echo '# dummy' > "$dirpart/$file"
60     done
61   done
62 }
63 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
64
65
66 # AM_OUTPUT_DEPENDENCY_COMMANDS
67 # -----------------------------
68 # This macro should only be invoked once -- use via AC_REQUIRE.
69 #
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"])
77 ])