PAC_C_DEPENDS
In addition, the variable C_DEPEND_DIR must be set to indicate the directory in which the dependency files should live.
#
# Dependency processing
.SUFFIXES: .dep
DEP_SOURCES = ${SOURCES:%.c=.dep/%.dep}
C_DEPEND_DIR = .dep
Depends: ${DEP_SOURCES}
@-rm -f Depends
cat .dep/*.dep >Depends
.dep/%.dep:%.c
@if [ ! -d .dep ] ; then mkdir .dep ; fi
@@C_DEPEND_PREFIX@ ${C_COMPILE} @C_DEPEND_OPT@ $< @C_DEPEND_OUT@
@@C_DEPEND_MV@
depends-clean:
@-rm -f *.dep ${srcdir}/*.dep Depends ${srcdir}/Depends
@-touch Depends
For each file foo.c, this creates a file foo.dep and creates a file Depends that contains all of the *.dep files.
For your convenience, the autoconf variable C_DO_DEPENDS names a file that may contain this code (you must have dependsrule or dependsrule.in in the same directory as the other auxillery configure scripts (set with dnl AC_CONFIG_AUX_DIR). If you use dependsrule.in, you must have dependsrule in AC_OUTPUT before this Makefile.