Except for the -W, -D, and -U flag options, all flag options that are supported by the c89 utility are supported by the xlc utility with the same semantics as documented in c89 — Compiler invocation using host environment variables. The xlc utility does not recognize constructs such as -Wl,I or -Wl,p. All other aspects of the -W flag are the same as with the c89 utility. -D and -U flag options are not preprocessed by the xlc utility. Instead, they are converted to the DEFINE and UNDEFINE native options and are passed to the compiler. The xlc utility also supports several additional flag options, which are described below:
>>- -#---------------------------------------------------------><
>>- -B--+--------+--+--------------+--------------------------->< '-prefix-' '- -t--program-'
xlc myprogram.c -B/lib/tmp/mine/
xlc myprogram.c -B/lib/tmp/mine/ -tl
Suboptions are:
>>- -F--+-config_file--+-----------+-+------------------------->< | '-:--stanza-' | '-:--stanza------------------'
Example: To compile myprogram.c using a configuration file called /usr/tmp/mycbc.cfg, enter:
xlc myprogram.c -F/usr/tmp/mycbc.cfg
The compiler will generate as many dependency files as there are source files specified.
-M is the equivalent of specifying -qmakedep with no suboption.
>>- -M---------------------------------------------------------><
xlc -c -M myprogram.c
CFLAGS = -M -qLSE=lib1 -qfloat=ieee
all: program
# Compile recipe; will also regenerate
# dependencies, used on the next compile.
%.o: %.c
xlc -c $(CFLAGS) $^
program: file1.o file2.o
xlc $(CFLAGS) -o program $&
# This line will include the generated
# file1.u and/or file2.u only if they exist.
.INCLUDE .IGNORE : file1.u file2.u
>>- -MF--file_name---------------------------------------------><
In the syntax, file_name can be either a file name or a directory. By default, the dependency file name and path is the same as the -o compiler option but with .u suffix. The default suffix can be modified through "usuffix" configuration file attribute. If a directory is specified, the default dependency file name is used and placed in this directory. If a relative file name is specified, it is relative to the current working directory.
Description | Command | Dependency File |
---|---|---|
-MF is not specified |
|
./t.u is generated |
|
./obj.u is generated | |
|
./dir/t.u is generated if ./dir is writable | |
-MF specifies a file |
|
./dep.u is generated |
|
../dep.x is generated | |
|
./dir/dep.d is generated for b.c only. | |
-MF specifies a directory |
|
./dir/a.u and ./dir/b.u are generated for a.c and b.c respectively if ./dir/ is writable |
>>- -MG--------------------------------------------------------><
When used with -qmakedep=pponly, -MG instructs the compiler to include missing header files into the make dependencies file and suppress diagnostic messages about missing header files.
When used with -M, -qmakedep, or -qmakedep=gcc, -MG instructs the C compiler to include missing header files into the make dependency output file, but the C compiler emits only warning messages and proceeds to create an object file if the missing headers do not cause subsequent severe compile errors.
>>- -MT--target_name-------------------------------------------><
> xlc -M -MT t1.o -MT t2.o t.c
t1.o t2.o : t.c
t1.o t2.o : t1.h
t1.o t2.o : t2.h
> xlc -M -MT t1.o -MT t2.o -qmakedep=gcc t.c
t1.o t2.o : t.c \
t1.h \
t2.h
If the -MT option is specified multiple times, the targets from each specification are included in the dependency file.
>>- -MQ--target_name-------------------------------------------><
> xlc -MQ '$(prefix)t.o' -qmakedep=gcc t.c
$$(prefix)t.o : t.c \
t1.h \
t2.h
If the -MQ option is specified multiple times, the targets from each specification are included in the dependency file.
If -MT and -MQ are mixed on the command line, the targets from all -MQ flags will precede the targets from all -MT flags when they are emitted in the make dependency file.
>>- -O---------------------------------------------------------><
>>- -O2--------------------------------------------------------><
>>- -O3--------------------------------------------------------><
>>- -O4--------------------------------------------------------><
>>- -O5--------------------------------------------------------><
As with the -E option, the -C option can be combined with the -P option to preserve the comments.
Produces an assembler source file for C source that is compiled with the METAL compiler option. The -o option can be used to override the default file name produced by -S. The default file name is the C source file name with the suffix determined by the ssuffix and ssuffix_host attributes in the configuration file.
xlc -S -qmetal hello.c
xlc -S -qmetal -o hello.s hello.c
xlc -S -qmetal -c hello.c
xlc -S -qmetal -c -o hello.s hello.c
.-------. V | >>- -t----+-a-+-+---------------------------------------------->< +-c-+ +-L-+ '-l-'
If -B is specified but the prefix is not, the default prefix is /usr/lpp/cbclib/xlc/bin/. If -Bprefix is not specified at all, the prefix of the standard program names is /usr/lib/cbclib/xlc/bin/.
If -B is specified but -tprograms is not, the default is to construct path names for all of the standard program names: a, c, L, and l.
xlc myprogram.c -B/u/new/compilers/ -tla
.------------------------------. | .--------------. | V V | | >>--- -W--+-a-+----,--directory-+-+---------------------------->< +-c-+ +-I-+ '-l-'
xlc myprogram.s -Wl,map -Wa,list
-Wl\,map,-Wa\,list