Nasty 4.3 change to cc(1)

Steve Summit stevesu at copper.UUCP
Thu Aug 7 12:38:18 AEST 1986


In article <377 at curly.ucla-cs.ARPA>, David Smallberg writes:
> Under 4.3,
> 	cc -c -o blah blah.c
> 	  produces one object file, named blah, not blah.o!!!!
> 
> Obviously, someone decided that -o should mean "If there's a single obvious
> output file, -o should rename it," I think the change is a mistake, since it
> breaks existing software and there's no compelling reason I can see to
> prefer the new meaning of -o over the old.  Justifications?

And in article <2743 at umcp-cs.UUCP>, Chris Torek writes:
> I have no real idea why the change was installed; most likely
> Berkeley got a request for it and saw no good reason *not* to
> implement it.  I remember a few years ago being surprised that
> `cc -c -o x.o c.c' did not work this way.

I'm sorry about the broken Makefiles, but I'm happy to see this
change, as it can be extremely useful.  (I've been using cc
drivers with this change for about a year now.)

Currently, I am doing software development on a Sequent Balance
8000, but I also want to build Vax versions of my programs, using
a cross-compiler.  My Makefiles can do things like:

	.SUFFIXES: .ovax

	.c.ovax:
		vaxcc $(CFLAGS) -c $*.c -o $*.ovax

This lets me keep sources, native object (.o) files, and Vax
object (.ovax) files in the same directory.  Without a working -o
switch on cc -c, you have to do things like

	.c.ovax:
		cp $*.c tmp.c
		vaxcc $(CFLAGS) -c tmp.c
		mv tmp.o $*.ovax

Besides littering your directory with files called tmp.c, this
method does not work if you try to do a "parallel make," making
use of the Balance 8000's multi-processor architecture to do
several compilations at once.  (Yes, there are slightly more
clever ways to name the tmp files so that they do not step on
each other.)

I'd vote for keeping the new feature and fixing the broken
Makefiles.  Perhaps it would help if cc -c -o generated a
warning when given more than one input file, rather than silently
ignoring the -o.  (That might warn you that something was amiss,
if you had an old-fashioned Makefile that used -c and -o but
expected the -o not to make any difference.)

                                         Steve Summit
                                         tektronix!copper!stevesu



More information about the Comp.bugs.4bsd.ucb-fixes mailing list