简体   繁体   English

如何从 Xcode 项目生成 Makefile?

[英]How can you generate a Makefile from an Xcode project?

I want to generate a Makefile from an existing Xcode project on the Mac.我想从 Mac 上的现有 Xcode 项目生成一个 Makefile。 Specifically, an existing iPhone, Objective-C program on the Mac.具体来说,一个现有的 iPhone,Mac 上的 Objective-C 程序。

I found PBToMake , but it looks like it is for Xcode 2.1 and when I tried using it, it did not work for an Xcode 3.1 project.我找到了PBToMake ,但它看起来像 Xcode 2.1,当我尝试使用它时,它不适用于 Xcode 3.1 项目。

GNUStep provides ' pbxbuild ' to convert a .xcodeproj file into a GNUMakefile. GNUStep 提供“ pbxbuild ”来将 .xcodeproj 文件转换为GNUMakefile

UPDATE: pbxbuild is now deprecated更新: pbxbuild 现已弃用

It's not an automated way of generating a Makefile, but I found it at least gets a list of source files that are built for a target.这不是生成 Makefile 的自动方式,但我发现它至少可以获得为目标构建的源文件列表。

I'm using Xcode 4.0.2 in this case..在这种情况下,我使用的是 Xcode 4.0.2。

  • select the project top node选择项目顶部节点
  • select the target in the target list.在目标列表中选择目标。
  • Choose "Build Phases"选择“构建阶段”
  • Open the "Compile Sources"打开“编译源”
  • Select one of the source files选择源文件之一
  • PRess Command-A to select all按 Command-A 选择全部
  • Press Command-C to copy按 Command-C 复制
  • Paste in your favorite text editor and Regex away to restructure.粘贴到您最喜欢的文本编辑器和 Regex 中以进行重组。

The pasted output is FULL pathnames to each source file.粘贴的输出是每个源文件的完整路径名。

Xcode does not support generating a Makefile from a project. Xcode 不支持从项目生成 Makefile。 If you just want to build your project outside of the IDE, check out the xcodebuild command-line tool.如果您只想在 IDE 之外构建项目,请查看xcodebuild命令行工具。

You could try mfg .你可以试试mfg It is template based and I think (I haven't played with it too much) you could get it to generate a suitable makefile.它是基于模板的,我认为(我没有玩过太多)你可以用它来生成一个合适的 makefile。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM