Variants

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

# Chapter 13. Variants

This is the first paragraph of Variants.

    Here is an example how build variants can be specified:

    	:variant OPT
    		some
    		    CFLAGS = -O2
    		much  compiler == "gcc"
    		    CFLAGS = -O6
    		*
    		    CFLAGS = -O

    "OPT" is the name of a variable.  It is used to select one of the variants.
    Each possible value is listed in the following line and further lines with the
    same indent.  In the example these are "some" and "much".  "*" is used to
    accept any value, it must be the last one.  The first value mentioned is the
    default when the variable isn't set.

    The $BDIR variable will be adjusted for the variant used. CAREFUL: this means
    that using $BDIR before ":variant" commands will use a different value, that
    might not always be what you want.

    Inside the ":variant" command the value of $BDIR has already been adjusted.

    When a target that is being build starts with $BDIR and $BDIR doesn't exist,
    it is created.

    $BDIR is relative to the recipe.  When using ":child dir/main.aap" the child
    recipe will use a different build directory "dir/$BDIR".
    Note that when building the same source file twice from recipes that are in
    different directories, you will get two results.

Prev | Contents | Next
Dependencies, Rules and Actions | Up | Publishing