cc -o -c

Dennis Ferguson dennis at gpu.utcs.utoronto.ca
Sun Jun 2 05:03:12 AEST 1991


In article <1991May31.144929.2471 at turnkey.tcc.com> jackv at turnkey.TCC.COM (Jack F. Vogel) writes:
>In article <AUVNELE.91May30171500 at auvc7.tamu.edu> auvnele at auvc7.tamu.edu (Eric L. Nelson) writes:
>>I'm working on a large software program where sources are in one
>>directory and objects go into another. I cannot get:
>>
>> cc -c -o../dir/foo.o foo.c 
>>
>>to put foo.o in ../dir. It insists on putting it in the same dir as
>>foo.c. 
>
>The problem, I believe, is that the '-c' flag overrides the '-o' and it
>naturally puts the object in the current directory. What you want to do
>can be accomplished in another way, run your builds in the target compilation
>directory and then specify the path to the source. Either keep the makefile
>in the target directory or symlink it there. This is what we do in our
>build systems all the time.

The 4.3 Reno distribution implements about the nicest scheme I have
ever seen for building binaries for multiple architectures from a
single source tree (with the sources mounted readonly via NFS if
you wish).  The scheme requires that the compiler support
"cc -c -o../dir/foo.o foo.c".

To support this requires a small change to the compiler driver.
The change should be backward compatible with all existing makefiles
and scripts.  "-c -o" is unlikely to be used anywhere since it doesn't
currently do anything useful.

I would much prefer that you made the change to the compiler rather
than me having to change makefiles.

Dennis Ferguson
University of Toronto



More information about the Comp.unix.aix mailing list