问题描述
我有一个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
推荐答案
您可以将一个或多个目标声明为。
You could declare one or more of your targets to be phony.
...
虚假目标不应该是真实目标文件的先决条件;如果
,它的食谱将运行每次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重建目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!