4.7.3 Generating the Command Line Switches

Once you have created the list of directories as explained in the previous section (Automatically Creating a List of Directories), you can easily generate the command line arguments to pass to gnatmake.

For the sake of completeness, this example assumes that the source path is not the same as the object path, and that you have two separate lists of directories.

# see "Automatically creating a list of directories" to create
# these variables

GNATMAKE_SWITCHES := ${patsubst %,-aI%,${SOURCE_DIRS}}
GNATMAKE_SWITCHES += ${patsubst %,-aO%,${OBJECT_DIRS}}

        gnatmake ${GNATMAKE_SWITCHES} main_unit