[comp.unix.questions] problem with make suffix rules

ARaman@massey.ac.nz (A.V. Raman) (07/17/90)

I've got a Makefile that says:

.SUFFIXES:
.SUFFIXES: .o .c
.o:
	cc -o $@ $< misc.a
.c.o:
	cc -c $<

In the ucb universe,
When I say
`make program' for example,

make says
"Don't know how to make program"

Shouldn't it try to apply the second suffix rule to generate program.o and
then the first one to generate program from program.o ?

In the att universe,
make tries
	cc -O program.c -o program
instead of
	cc -c program.c
which is what the suffix rule tells it to do.

What's more, when I don't have a Makefile at all, and type
`make program' (ucb)
make doesn't apply the default suffix rule to run
cc program.c -o program
Instead, it comes up with the same message as before.

Thanks for any help on where I'm goofing.

- & (Anand)

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

>In the ucb universe,

Some UNIX flavors have "ucb" and "att" "universes".  Others don't.  You
might want to indicate which UNIX flavor you have (although in this case
the answer might be guessable without it).

>When I say
>`make program' for example,
>
>make says
>"Don't know how to make program"
>
>Shouldn't it try to apply the second suffix rule to generate program.o and
>then the first one to generate program from program.o ?

Probably not in the UCB universe, given that the first rule uses a
feature of "make" that first crawled into a "make" available outside
AT&T in System III.  The V7 "make" that comes with 4.xBSD doesn't
support single-suffix rules like

	.o:
		cc -o $@ $< misc.a

>
>In the att universe,
>make tries
>	cc -O program.c -o program
>instead of
>	cc -c program.c
>which is what the suffix rule tells it to do.

while the System V "make" that comes with, well, System V does.

gwyn@smoke.BRL.MIL (Doug Gwyn) (07/24/90)

In article <862@massey.ac.nz> ARaman@massey.ac.nz (A.V. Raman) writes:
-In the att universe,
-make tries
-	cc -O program.c -o program
-instead of
-	cc -c program.c
-which is what the suffix rule tells it to do.

No, the built-in .c: rule is used, not the .c.o: then .o: rules that
your Makefile specified.  What you should probably do is to quit
trying to override the built-in rules and instead set CFLAGS=

-What's more, when I don't have a Makefile at all, and type
-`make program' (ucb)
-make doesn't apply the default suffix rule to run
-cc program.c -o program
-Instead, it comes up with the same message as before.

That's simply a difference in the behavior of the two versions of "make".