开发者

Equivalent of ${@} in the dependency list for GNU-style makefiles

In Sun make, I can create a rule resembling the following:

${OBJECTS} : ${@F:%.o=%.c}
     (...) ${<}

... where ${@} in the dependency list is the same as ${@} in开发者_运维问答 the rule portion of the target. That way, ${<} always evaluates to the right source file for the object being built.

This is somewhat like doing rules of the form:

%.o : %.c
     (...) ${<}

My question is: is there a way to do this with GNU make?


Yes.

%.o : %.c
    (...) $<

Or if you want to restrict the rule to ${OBJECTS}:

${OBJECTS} : %.o : %.c
    (...) $<
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜