Visual Studio的*.mak文件?

时间:2021-02-05 16:44:17

I've inherited a body of Visual C++ source that consists of about a dozen sub-projects. One of these is an empty "MakeAll" project that depends on all the others, so I can build the entire project by setting the MakeAll project active and selecting "Build All."

我继承了一个由大约十二个子项目组成的Visual C ++源代码。其中一个是空的“MakeAll”项目,它依赖于所有其他项目,因此我可以通过设置MakeAll项目并选择“Build All”来构建整个项目。

I'd like to automate this process, and coming from a linux environment, my instinct was to generate a Makefile and build from the command line. The IDE will generate .mak files for each of the sub-projects, but not for the top-level MakeAll. (I'm assuming this is because it contains nothing but dependencies.)

我想自动化这个过程,来自linux环境,我的本能是生成一个Makefile并从命令行构建。 IDE将为每个子项目生成.mak文件,但不为*MakeAll生成.mak文件。 (我假设这是因为它只包含依赖项。)

The linux answer would be a Makefile that simply descends into each of the sub-projects and executes make in each one. But a quick look at the .mak files showed that each wants to be told which of several configurations to use -- and apparently some use Debug, some use Release, and some use configurations concocted by a previous developer.

linux的答案是一个Makefile,它简单地下载到每个子项目中并在每个子项目中执行make。但是快速查看.mak文件显示每个人都希望被告知要使用几种配置中的哪一种 - 显然有些使用Debug,有些使用Release,有些使用前一个开发人员调制的配置。

What's the accepted way to build a set of projects like this from the command line?

从命令行构建一组这样的项目的可接受方法是什么?

Thank you!

1 个解决方案

#1


1  

You don't have to use make - if you have everything as solution files (.sln) then you can automate the build by using the msbuild tool:

您不必使用make - 如果您将所有内容都作为解决方案文件(.sln),则可以使用msbuild工具自动执行构建:

msbuild solution.sln

Also, why do you have a "MakeAll" project? Visual Studio doesn't require this kind of hackery, just do a "build all" and it will build everything satisfying dependancies just like a typical "make all" rule would.

另外,为什么你有一个“MakeAll”项目? Visual Studio不需要这种hackery,只需要“构建所有”,它将构建满足依赖性的所有内容,就像典型的“make all”规则一样。

#1


1  

You don't have to use make - if you have everything as solution files (.sln) then you can automate the build by using the msbuild tool:

您不必使用make - 如果您将所有内容都作为解决方案文件(.sln),则可以使用msbuild工具自动执行构建:

msbuild solution.sln

Also, why do you have a "MakeAll" project? Visual Studio doesn't require this kind of hackery, just do a "build all" and it will build everything satisfying dependancies just like a typical "make all" rule would.

另外,为什么你有一个“MakeAll”项目? Visual Studio不需要这种hackery,只需要“构建所有”,它将构建满足依赖性的所有内容,就像典型的“make all”规则一样。