Makefile pattern rule fails?

后端 未结 5 1024
春和景丽
春和景丽 2021-01-04 08:18

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 mak

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 08:28

    Just ran through this problem.

    If this is your rule:

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

    Make sure that you have a tab and not spaces on the second line before the gcc. Took me a couple of hours to figure out. Also no ':' after the -o flag, as somebody else pointed out.

提交回复
热议问题