在makefile中的功能? [英] functions in makefiles?

查看:60
本文介绍了在makefile中的功能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多makefile目标,它们可以做同样的事情:

I have a slew of makefile targets that do the same thing:

${SOME_FILE}:
    ${FILES} | ${DIST_DIR}

    @@cat ${FILES} |                     \
        sed 's/@DATE/'"${DATE}"'/' |     \
        sed 's/@VERSION/'"${CR_VER}"'/'  \
        > ${OUT_FILE};

其中,${FILES}${OUT_FILE}是唯一更改的内容.我试图弄清楚是否可以将这些目标简化为类似的东西:

where ${FILES} and ${OUT_FILE} are the only things changing. I'm trying to figure out if it's possible to simplify these targets to something like:

${SOME_FILE}:
    compile(${FILES},${OUT_FILE})

感谢您的见解.

推荐答案

GNU make具有以下功能:

GNU make has this:

要定义多行功能,请使用以下语法:

To define a multi-line function, you would use this syntax:

这篇关于在makefile中的功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆