Alex Rivera | Logout

Makefile pattern rule fails?

Asked 2011-03-01T14:01:33.797
14

While using GNU-make, my Makefile has some pattern rule as:

%.o:%.c
    gcc $< -o:$@

This rule is added by me.

But when I do make it gives an error saying No rule to make target %.o and doesn't build the targets.

At times, there is this other behaviour as well. It does not build the target when I say make first time(It gives error saying No rule to make target), but when i say make again immediately, it does build correctly.

So when i explicity specify each source file separately, then it builds the targets fine first time itself.

EDIT: I am using GNU-make on a Centos (v6.3 i guess, not sure). Could this be some permission/user id /group id issue?

Any pointers to understand what might be happening and solution for this?

thank you, -AD.

Edit
Report

1 Answer

0

Are you sure the .c file exists? I think using -d as suggested earlier should help debug this.

answered 2013-03-28T18:05:51.517

Your Answer