Next: , Previous: Automatically Creating a List of Directories, Up: Using the GNU make Utility


19.3 Generating the Command Line Switches

Once you have created the list of directories as explained in the previous section (see 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
     SOURCE_DIRS=
     OBJECT_DIRS=
     
     GNATMAKE_SWITCHES := ${patsubst %,-aI%,${SOURCE_DIRS}}
     GNATMAKE_SWITCHES += ${patsubst %,-aO%,${OBJECT_DIRS}}
     
     all:
             gnatmake ${GNATMAKE_SWITCHES} main_unit