[comp.unix.aix] cc ignores the -o flag when -c is present

buchanan@cs.ubc.ca (John (juancho) buchanan) (10/16/90)

We have a variety of programs which we maintain over a variety of platforms,
since there is no decent tool under unix for this we have found a workable
kludge is to maintain different Makefiles and different 'o' directories.
The  particular scheme that we have adopted requires that a line of the form

	cc -c foo.c -o o/ibm/foo.o 

deposit the file foo.o in the directory o/ibm, however it seems that if the
-c flag is present then the -o flag is ignored silently and the foo.o file
is placed in the current directory.  Upon checking their 'key concepts :-('
man page it is clear that the -o flag is only used for renaming the final
executable, i.e. this flag is interpreted by ld and by nothing else.  The
work around is that in our Makefile for ibm we have lines as follows.

	cc -c foo.c
	mv foo.o o/ibm/foo.o 

Is there another work around or is IBM going to screw this one up to.

bengsig@oracle.nl (Bjorn Engsig) (10/17/90)

Article <10114@ubc-cs.UUCP> by buchanan@cs.ubc.ca (John (juancho) buchanan) says:
|
|The  particular scheme that we have adopted requires that a line of the form
|
|	cc -c foo.c -o o/ibm/foo.o 
|
|deposit the file foo.o in the directory o/ibm, however it seems that if the
|-c flag is present then the -o flag is ignored silently and the foo.o file
|is placed in the current directory.
|  ...
|Is there another work around or is IBM going to screw this one up to.
First, please tell which AIX system this is on, there is at least three
possibilities.  Second, the AIX behaviour of the C compiler is very common
in the Unix world, so I don't see any point in your IBM flame.
-- 
Bjorn Engsig,         E-mail: bengsig@oracle.com, bengsig@oracle.nl
ORACLE Corporation    From IBM: auschs!ibmaus!cs.utexas.edu!uunet!oracle!bengsig

            "Stepping in others footsteps, doesn't bring you ahead"

guy@auspex.auspex.com (Guy Harris) (10/18/90)

 >The  particular scheme that we have adopted requires that a line of the form
 >
 >	cc -c foo.c -o o/ibm/foo.o 
 >
 >deposit the file foo.o in the directory o/ibm,

Be aware that not all UNIX systems support this; IBM isn't unique here. 
V7 didn't support it, either....

buchanan@cs.ubc.ca (John (juancho) buchanan) (10/18/90)

In article <1021@nlsun1.oracle.nl> bengsig@oracle.nl (Bjorn Engsig) writes:
>Article <10114@ubc-cs.UUCP> by buchanan@cs.ubc.ca (John (juancho) buchanan) says:
>|  ...
>|Is there another work around or is IBM going to screw this one up to.

>First, please tell which AIX system this is on, there is at least three
>possibilities.
	Sorry 3.1!  Or the golden version as our local tech called it.
>Second, the AIX behaviour of the C compiler is very common
>in the Unix world, so I don't see any point in your IBM flame.
	Sorry I guess My mistake here, I only have experience with BSD 4.2,
	Bsd 4.3, IRIX, Apollo unix, NeXT unix, SunOS (3.0 - 4.0), MIPS
	unix.
=========================================================================
|					|===============================|
|	John Buchanan (juancho)		|	buchanan@cs.ubc.ca	|
|	Imager Manager			|===============================|
|	Imager				|	(604) 228-2218		|
|	Department of Computer Science	|===============================|
|	University of British Columbia	|	Standard disclaimer	|
|	Vancouver, BC, Canada		|	included in this	|
|					|	box, right here.	|
=========================================================================
	

jeffe@sandino.austin.ibm.com (Peter Jeffe 512.823.4091) (10/18/90)

In article <10131@ubc-cs.UUCP> buchanan@cs.ubc.ca (John (juancho) buchanan) writes:
>>Second, the AIX behaviour of the C compiler is very common
>>in the Unix world, so I don't see any point in your IBM flame.
>	Sorry I guess My mistake here, I only have experience with BSD 4.2,
>	Bsd 4.3, IRIX, Apollo unix, NeXT unix, SunOS (3.0 - 4.0), MIPS
>	unix.

Look here, fella, that cc -o -c stuff won't work on our Sun 4.1, and I
remember quite well that it didn't work on an Apollo SR9 (?)/BSD compiler.
So quit your bitching and learn to put up with the vagaries of different
systems' implementations.  I'm sure it wouldn't be too hard to find a
portable way to do what you want.

-------------------------------------------------------------------------------
Peter Jeffe   ...uunet!cs.utexas.edu!ibmchs!auschs!sandino.austin.ibm.com!jeffe
        first they want a disclaimer, then they make you pee in a jar,
                   then they come for you in the night

buchanan@cs.ubc.ca (John (juancho) buchanan) (10/19/90)

 I tried to keep this of the net but the mail bounced
jeffe@sandino.austin.ibm.com 

You write.  

	Look here, fella, that cc -o -c stuff won't work on our Sun 4.1

sam : rlogin SunCpu
Last login: Thu Oct 18 09:58:22 from sam.cs.ubc.cs
SunOS Release 4.1 (GENERIC_SMALL) #1: Wed Mar 7 10:54:19 PST 1990
SunCpu : mkdir f
SunCpu : echo int foo = 1\; > foo.c
SunCpu : cc -o f/foo.o -c foo.c
SunCpu : ls f
foo.o
SunCpu : ^Dlogout

The problem I have with the current implementation of the -o flag is that
it is easy to make it work with -c but serves no useful purpose to implement
it the way that it was done in V7 unix and by AIX.  

You also write

So quit your bitching and learn to put up with the vagaries of different
systems' implementations.

	who is bitching?

I'm sure it wouldn't be too hard to find a portable way to do what you want.

	I thought we had.

jeffe@sandino.austin.ibm.com (Peter Jeffe 512.823.4091) (10/23/90)

In article <10139@ubc-cs.UUCP> buchanan@cs.ubc.ca (John (juancho) buchanan) writes:
> I tried to keep this of the net but the mail bounced

Hmmm, just like my reply of several days ago seems to have disappeared.
This is turning out to be a jinxed thread.

If you want to mail to me, you must do as I .sig, not as I From:.  IBM
Austin is actually getting an internet connection, but I'll be long gone
before then.

>	Look here, fella, that cc -o -c stuff won't work on our Sun 4.1
>
>sam : rlogin SunCpu
>Last login: Thu Oct 18 09:58:22 from sam.cs.ubc.cs
>SunOS Release 4.1 (GENERIC_SMALL) #1: Wed Mar 7 10:54:19 PST 1990
>SunCpu : mkdir f
>SunCpu : echo int foo = 1\; > foo.c
>SunCpu : cc -o f/foo.o -c foo.c
>SunCpu : ls f
>foo.o
>SunCpu : ^Dlogout

You're completely right about the Sun; I screwed up by doing "-o f/foo",
which is how I'm used to using -o, and the Sun complains about that.

But the point remains: other systems definitely have trouble with this
combination of flags, so why not do it portably instead?

>You also write
>
>So quit your bitching and learn to put up with the vagaries of different
>systems' implementations.
>
>	who is bitching?

I guess your comment about "IBM screwing up again" sounded like it to me;
but I should have had a couple of :-)'s sprinkled around that reply, so
please don't take it too seriously.

>I'm sure it wouldn't be too hard to find a portable way to do what you want.
>
>	I thought we had.

Nope.  "cc && mv" is portable, but using the -o flag to stick the .o file
somewhere isn't.

-------------------------------------------------------------------------------
Peter Jeffe   ...uunet!cs.utexas.edu!ibmchs!auschs!sandino.austin.ibm.com!jeffe
        first they want a disclaimer, then they make you pee in a jar,
                   then they come for you in the night