本文介绍了MSVS2012 C ++ nmake如何在子目录中的makefile上运行nmake?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目,其中包含一个顶级makefile和三个子文件夹,每个子文件夹中都包含一个makefile.

I have a project with a top-level makefile and three sub-folders each with a makefile in them.

在普通的 makefiles (gnu make) 中,我可以这样做:

In normal makefiles (gnu make) I can do this:

# 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

在这里,我基本上是在调用 make -C folder1 在子文件夹"folder1"中的makefile上运行make.

Where here I am basically calling make -C folder1 to run make on the makefile in sub folder "folder1".

因此,我正在尝试将我的gnu makefile转换为nmake.在大多数情况下,我没有遇到太多麻烦(.phony 与此处不同).

So I am trying to translate my gnu makefile into nmake. For the most part I have not had too much trouble (the .phony thing is different to here).

但是我似乎找不到在子文件夹上调用nmake的语法:

But I can't seem to find the syntax to call nmake on the sub folder:

nmake folder1 不起作用.我看了看所有标志,没有一个看起来很明显.关于nmake的文档不容易浏览(即找到所需内容).

nmake folder1 does not work. I looked at all the flags for nmake an non of them looked obvious. The documentation on nmake is not easy to navigate (i.e. to find what you want).

推荐答案

我不相信nmake具有(gnu)make的 -C 选项,您需要执行

I don't believe nmake has anything like (gnu)make's -C option, you'll need to do something like

$(SUB_PROJECTS):
    cd $@
    $(MAKE) /$(MAKEFLAGS)
    cd $(MAKEDIR)

这篇关于MSVS2012 C ++ nmake如何在子目录中的makefile上运行nmake?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-19 06:28