[net.unix] Help needed with Makefile rules

jwp@uwmacc.UUCP (jeffrey w percival) (05/17/85)

A simple question, I hope.

I know about rules like .c.o: and so on, but can one
define a rule to go from .o to something with no suffix?
I am using the 2.9BSD make program, and the manual appears
not to cover this.  Thanks!


-- 
	Jeff Percival ...!uwvax!uwmacc!jwp

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/17/85)

> ... can one define a rule to go from .o to something with no suffix?

Sure, for example:

.o:
	$(CC) -o $@ $< -lm

jwp@uwmacc.UUCP (jeffrey w percival) (05/17/85)

In article <10767@brl-tgr.ARPA> gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) writes:
>> ... can one define a rule to go from .o to something with no suffix?
>Sure, for example:
>.o:
>	$(CC) -o $@ $< -lm

This didn't work for me... we're talking 2.9BSD, right?



-- 
	Jeff Percival ...!uwvax!uwmacc!jwp

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/19/85)

> >.o:
> >	$(CC) -o $@ $< -lm
> 
> This didn't work for me... we're talking 2.9BSD, right?

Sorry if it didn't work; this is the built-in rule in my copy of "make".
This really should work, but "make" has always had lots of bugs...
I don't have a 2.9BSD and it sounds very much as though I don't want one.

donn@utah-gr.UUCP (Donn Seeley) (05/19/85)

	From: gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>)

	> This didn't work for me... we're talking 2.9BSD, right?

	...  I don't have a 2.9BSD and it sounds very much as though I
	don't want one.

We can do without this kind of 'help', I think.  What is it about this
network that makes so many people behave like children?  I don't recall
anything about the original posting that deserved a sneer like this.
Unless you can contribute something useful and original, why post it at
all?  I only post this response because I have some faint hope that the
net at large will benefit from it...  Further flames by mail, please.

I certainly hope that exchanges like this won't go on in mod.unix,

Donn Seeley    University of Utah CS Dept    donn@utah-cs.arpa
40 46' 6"N 111 50' 34"W    (801) 581-5668    decvax!utah-cs!donn

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (05/20/85)

> I know about rules like .c.o: and so on, but can one
> define a rule to go from .o to something with no suffix?

Donn Seeley informs me that the 2.9BSD make is based on the
7th Edition make, so the answer is, that usage is not supported
by the version of make that you have.

Two alternatives:
	Use a makefile dependency generator (every so often one
	gets posted to the net);
	Get hold of a newer version of make and install it.

jmsellens@watmath.UUCP (John M Sellens) (05/21/85)

The paper "Make -- A Program for Maintaining Computer Programs" by S.I. Feldman
of Bell Labs, Murray Hill, dated August 15, 1978 only mentions rules for use
when creating a file with a suffix from another file of the same name but with
a different suffix e.g. the .c.o rule.  (I believe that this is the original
documentation and specification of Make.)

The 4.2bsd make does not allow you to specify a rule with only one suffix
but the System Vr2 make does.  For example, a rule to create executables from
.o files could be
    .o:
	    cc -o $* $*.o  # $* is the common prefix

A trick that is used here at Waterloo is to use a .o.out rule to create
something.out and make a symbolic link to it with the appropriate suffix-less
name.

John

ado@elsie.UUCP (Arthur David Olson) (05/21/85)

> > I know about rules like .c.o: and so on, but can one
> > define a rule to go from .o to something with no suffix?
>
> Donn Seeley informs me that the 2.9BSD make is based on the
> 7th Edition make, so the answer is, that usage is not supported
> by the version of make that you have.
> 
> Two alternatives:
> 	Use a makefile dependency generator (every so often one
> 	gets posted to the net);
> 	Get hold of a newer version of make and install it.

By all means take the first route if you're interested in portability.
--
UNIX is an AT&T Bell Laboratories trademark.
--
	UUCP: ..decvax!seismo!elsie!ado    ARPA: elsie!ado@seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks