Customizing Automatic Depedencies

A-A-P home page | A-A-P Recipe Executive
--- | ---
Prev |  | Next

# Chapter 24. Customizing Automatic Depedencies

    For various file types A-A-P can scan a source file for header files it
    includes.  This implies that when a target depends on the source file, it also
    depends on the header files it includes.  For example, a C language source
    file uses #include lines to include code from header files.  The object file
    generated from this C source needs to be rebuild when one of the header files
    changes.  Thus the inclusing of the header file has an implied dependency.

    Aap defines a series of standard dependency checks.  You don't need to do
    anything to use them.

    The filetype used for the dependency check is detected automatically.  For
    files with an ignored suffix like ".in" and ".gz" no dependency checking is
    done.

    To avoid all automatic dependency checks, set the variable "autodepend" to
    "off":

    	autodepend = off

    To avoid automatic dependencies for a specific file, set the attribute
    "autodepend" to "off":

    	foo.o : foo.c {autodepend = off}

    You can add your own dependency checks.  This is done with the ":action"
    command.  Its arguments are "depend" and the file types for which the check
    works.  A block of commands follows, which is expected to inspect $source and
    produce the detected dependencies in $target, which has the form of a
    dependency.  Example:

    	:action depend c,cpp
    		:sys $CC $CFLAGS -MM $source > $target

    The build commands are expected to generate a file that specifies the
    dependency:

    	foo.o : foo.c foo.h

    The first item (before the colon) is ignored.  The items after the colon are
    used as implied dependencies.  The source file itself may appear, this is
    ignored.  Thus these results have the same meaning:

    	foo.xyz : foo.c foo.h
    	foo.o : foo.h

    Comments starting with "#" are ignored.  Line continuation with "\" is
    supported.  Only the first (continued) line is read.

    Aap will take care of executing the dependency check when the source changes
    or when the command changes (e.g., the value of $CFLAGS).  This can be changed
    with a "buildcheck" attribute after "depend".

    	:action depend {buildcheck = $CFLAGS} c
    		:sys $CC $CFLAGS -MM $source > $target

    Aap expects the dependency checker to only inspect the source file.  If it
    recursively inspects the files the source files include, this must be
    indicated with a "recursive" attribute.  That avoids Aap will take care of
    this and do much more work than is required.  Example:

    	:action depend {recursive}  c,cpp
    		:sys $CC $CFLAGS -MM $source > $target

Prev | Contents | Next
Customizing Filetype Detection and Actions | Up | Reference Manual