Specifying compiler options on the command line

There are two kinds of command-line options:

Command-line options in the -q option_keyword format are similar to on and off switches. For most -q options, if a given option is specified more than once, the last appearance of that option on the command line is the one recognized by the compiler. For example, qsource turns on the source option to produce a compiler listing, and -qnosource turns off the source option so that no source listing is produced.

Example: The following example would produce a source listing for both MyNewProg.C and MyFirstProg.C because the last source option specified (-qsource) takes precedence:
 xlC -qnosource MyFirstProg.C -qsource MyNewProg.C

You can have multiple -q option_keyword instances in the same command line, but they must be separated by blanks. Option keywords can appear in mixed case, but you must specify the -q in lowercase.

Example: You can specify any -q option_keyword before or after the file name:
xlC -qLIST -qnomaf file.c
xlC file.c -qxref -qsource

Some options have suboptions. You specify these with an equal sign following the -qoption. If the option permits more than one suboption, a colon (:) must separate each suboption from the next.

Example: The following example compiles the C source file file.c using the option -qipa to specify the inter procedural analysis options. The suboption level=2 tells the compiler to use the full inter procedural data flow and alias analysis, map tells the compiler to produce a report, and the noobj tells the compiler to produce only an IPA object without a regular object. The option -qattr with suboption full will produce an attribute listing of all identifiers in the program.
xlc -qipa=level=2:map:noobj -qattr=full file.c