Newsgroups: comp.unix.aix
Path: utzoo!utgpu!dennis
From: dennis@gpu.utcs.utoronto.ca (Dennis Ferguson)
Subject: Re: cc -o -c
Message-ID: <1991Jun1.190312.12328@gpu.utcs.utoronto.ca>
Organization: none at all
References: <AUVNELE.91May30171500@auvc7.tamu.edu> <1991May31.144929.2471@turnkey.tcc.com>
Distribution: comp
Date: Sat, 1 Jun 1991 19:03:12 GMT

In article <1991May31.144929.2471@turnkey.tcc.com> jackv@turnkey.TCC.COM (Jack F. Vogel) writes:
>In article <AUVNELE.91May30171500@auvc7.tamu.edu> auvnele@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
