Go to the first, previous, next, last section, table of contents.


Compile mode

For compile mode, mode-args is a compiler command to be used in creating a `standard' object file. These arguments should begin with the name of the C compiler, and contain the `-c' compiler flag so that only an object file is created.

Libtool determines the name of the output file by removing the directory component from the source file name, then substituting the source code suffix (e.g. `.c' for C source code) with the library object suffix, `.lo'.

If shared libraries are being built, any necessary PIC generation flags are substituted into the compilation command. You can pass compiler and linker specific flags using `-Wc,flag' and `-Xcompiler flag' or `-Wl,flag' and `-Xlinker flag', respectively.

If the `-static' option is given, then a `.o' file is built, even if libtool was configured with `--disable-static'.

Note that the `-o' option is now fully supported. It is emulated on the platforms that don't support it (by locking and moving the objects), so it is really easy to use libtool, just with minor modifications to your Makefiles. Typing for example

libtool gcc -c foo/x.c -o foo/x.lo

will do what you expect.

Note, however, that, if the compiler does not support `-c' and `-o', it is impossible to compile `foo/x.c' without overwriting an existing `./x.o'. Therefore, if you do have a source file `./x.c', make sure you introduce dependencies in your `Makefile' to make sure `./x.o' (or `./x.lo') is re-created after any sub-directory's `x.lo':

x.o x.lo: foo/x.lo bar/x.lo

This will also ensure that make won't try to use a temporarily corrupted `x.o' to create a program or library. It may cause needless recompilation on platforms that support `-c' and `-o' together, but it's the only way to make it safe for those that don't.


Go to the first, previous, next, last section, table of contents.