如何强制makefile重建目标 [英] How do you force a makefile to rebuild a target

查看:181
本文介绍了如何强制makefile重建目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个makefile生成,然后调用另一个makefile。因为这个makefile调用更多的makefile,它做的工作真的改变。因此,它一直认为项目是建立和更新。

I have a makefile that builds and then calls another makefile. Since this makefile calls more makefiles that does the work it doesnt really change. Thus it keeps thinking the project is built and upto date.

dnetdev11 ~ # make
make: `release' is up to date.

如何强制makefile重建目标?

How do i force the makefile to rebuild the target?

clean = $(MAKE) -f ~/xxx/xxx_compile.workspace.mak clean


build = svn up ~/xxx                                                       \
        $(clean)                                                                \
        ~/cbp2mak/cbp2mak -C ~/xxx ~/xxx/xxx_compile.workspace        \
        $(MAKE) -f ~/xxx/xxx_compile.workspace.mak $(1)                    \


release:
        $(build )

debug:
        $(build DEBUG=1)

clean:
        $(clean)

install:
        cp ~/xxx/source/xxx_utility/release/xxx_util /usr/local/bin
        cp ~/xxx/source/xxx_utility/release/xxxcore.so /usr/local/lib

注意:删除名称以保护无辜

Note: Names removed to protect the innocent

编辑:最终修正版本:

clean = $(MAKE) -f xxx_compile.workspace.mak clean;


build = svn up;                                         \
        $(clean)                                        \
        ./cbp2mak/cbp2mak -C . xxx_compile.workspace;   \
        $(MAKE) -f xxx_compile.workspace.mak    $(1);   \


.PHONY: release debug clean install

release:
        $(call build,)

debug:
        $(call build,DEBUG=1)

clean:
        $(clean)

install:
        cp ./source/xxx_utillity/release/xxx_util /usr/bin
        cp ./dlls/Release/xxxcore.so /usr/lib


推荐答案

您可以将一个或多个目标声明为 phony

You could declare one or more of your targets to be phony.


假的目标不是真的文件的名称;而是
只是一个要在执行显式
请求时执行的食谱的名称。使用伪造目标有两个原因:避免
与同名文件的冲突,并提高性能。

A phony target is one that is not really the name of a file; rather it is just a name for a recipe to be executed when you make an explicit request. There are two reasons to use a phony target: to avoid a conflict with a file of the same name, and to improve performance.

...

虚假目标不应该是真实目标文件的先决条件;如果
,它的食谱将运行每次make去更新
文件。只要假的目标不是真正的
目标的先决条件,则只有当假定的目标是bb的目标是指定的目标时,才会执行假目标配方

A phony target should not be a prerequisite of a real target file; if it is, its recipe will be run every time make goes to update that file. As long as a phony target is never a prerequisite of a real target, the phony target recipe will be executed only when the phony target is a specified goal

这篇关于如何强制makefile重建目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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