[英]MSVS2012 c++ nmake how do run nmake on a makefile in a subdirectory?
I have a project with a top-level makefile and three sub-folders each with a makefile in them. 我有一个项目,其中包含一个顶级makefile和三个子文件夹,每个子文件夹中都包含一个makefile。
In normal makefiles (gnu make) I can do this: 在普通的makefile(gnu make)中,我可以这样做:
# Just for me so I can read my own makefile --> TARGET: DEPEND
_TARGET = $@
_DEPEND = $<
# Sub projects to build in dependency order
SUB_PROJECTS = folder2 folder1 folder3
.PHONY: $(SUB_PROJECTS)
all: $(SUB_PROJECTS)
@echo makeing all
$(SUB_PROJECTS):
@echo "*******************************"
@echo "* MAKING: $(_TARGET)"
@echo "*******************************"
$(MAKE) -C $(_TARGET)
@echo
Where here I am basically calling make -C folder1
to run make on the makefile in sub folder "folder1". 在这里,我基本上是在调用make -C folder1
在子文件夹“ folder1”中的makefile上运行make。
So I am trying to translate my gnu makefile into nmake. 因此,我正在尝试将我的gnu makefile转换为nmake。 For the most part I have not had too much trouble (the .phony thing is different to here). 在大多数情况下,我并没有遇到太多麻烦(.phony与此处有所不同)。
But I can't seem to find the syntax to call nmake on the sub folder: 但是我似乎找不到在子文件夹上调用nmake的语法:
nmake folder1
does not work. nmake folder1
不起作用。 I looked at all the flags for nmake an non of them looked obvious. 我看了看所有标志,没有一个看起来很明显。 The documentation on nmake is not easy to navigate (ie to find what you want). 关于nmake的文档不容易浏览(即找到所需内容)。
I don't believe nmake has anything like (gnu)make's -C
option, you'll need to do something like 我不相信nmake具有(gnu)make的-C
选项,您需要做类似的事情
$(SUB_PROJECTS):
cd $@
$(MAKE) /$(MAKEFLAGS)
cd $(MAKEDIR)
I just found this link: UsingNmake which suggests: 我刚刚找到以下链接: UsingNmake ,它建议:
Traversing Directories "makefile" 遍历目录“ makefile”
DIRS = \
dir1 \
dir2 \
dir3
all: $(DIRS)
$(DIRS):
pushd $@ & nmake & popd
It explains why this is better to do it in one line... 它解释了为什么最好一口气做这件事...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.