最新iPhone开发进阶(4)-----使用Makefile自动编译iPhone程序.docx
《最新iPhone开发进阶(4)-----使用Makefile自动编译iPhone程序.docx》由会员分享,可在线阅读,更多相关《最新iPhone开发进阶(4)-----使用Makefile自动编译iPhone程序.docx(34页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-dateiPhone开发进阶(4)-使用Makefile自动编译iPhone程序iPhone开发进阶(4)-使用Makefile自动编译iPhone程序iPhone开发进阶(4) - 使用Makefile自动编译iPhone程序 Xcode 也支持以命令行形式来编译 iPhone 程序。另外还可以手动的编写 Makefile 文件,实现编译安装的自动化批处理过程。如果你习惯了
2、命令行的操作方式(linux,unix),那么这样的操作还是很方便的。首先看看 Xcode 的命令行格式:12xcodebuild -target Project_Namexcodebuild install -target Project_Name下面我们来实现程序的编译,并通过 ldid 转换编码格式,最后用 ssh 将编译好的程序安装到 iPhone 上的 /Applications/目录下。首先安装 ssh 的公开密匙到 iPhone 上1). 在Mac的终端上产生密匙12345678910ssh-keygen -t rsaGenerating public/private rsa k
3、ey pair.Enter file in which to save the key (/home/xxxx/.ssh/id_rsa):Created directory /home/xxxx/.ssh.Enter passphrase (empty for no passphrase): xxxEnter same passphrase again: xxxYour identification has been saved in /home/xxxx/.ssh/id_rsa.Your public key has been saved in /home/xxxx/.ssh/id_rsa.
4、pub.The key fingerprint is:e4:e8:b7:05:06:b3:f0:ff:af:13:fc:50:6a:5b:d1:b5 xxxxlocalhost.localdomain过程中会提问你通行证(passphrase),输入你常用的秘密。2). 在 iPhone 上创建.ssh目录(iPhone的IP地址是10.0.2.2)1ssh root10.0.2.2 mkdir -p .ssh如果问道你iPhone root password,输入 alpine。3). 拷贝刚才生成的公开密匙到 iPhone1cat /.ssh/id_rsa.pub | ssh root10
5、.0.2.2 cat .ssh/authorized_keys如果问道你iPhone root password,输入 alpine。4). 在 iPhone 上编辑 /etc/ssh/sshd_config 文件1234567891011#将#StrictModes yes#PubkeyAuthentication yes#AuthorizedKeysFile .ssh/authorized_keys#替换为StrictModes noPubkeyAuthentication yesAuthorizedKeysFile .ssh/authorized_keys5). 重新启动iPhone接下
6、来,编译生成ldid工具123456789101112wget http:/svn.telesphoreo.org/trunk/data/ldid/ldid-1.0.610.tgztar -zxf ldid-1.0.610.tgz# 如果是 PowerPC 下载下面的补丁# wget -qO- | patch -p0cd ldid-1.0.610g+ -I . -o util/ldid,.cpp -x c util/lookup2,sha1.csudo cp -a util/ldid /usr/bin最后,让我们看看Makefile中都有什么项目中的文件如下所示:Classes : sourc
7、e code (.m .c .cpp etc)Resources : png file and other support filesProject folder : *.xib Info.plist12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210
8、3104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154Makefile: Select allPREFIX = arm-apple-darwin9-#/# Executable files#/CC = $(PREFIX)gccCXX = $(PREFIX)g+LD = $(CC)AR = $(PREFIX)arSTRIP = $(PREFIX)
9、stripOBJCOPY = $(PREFIX)objcopy# debug/releaseDEBUG ?= nDEVEL ?= n# SDK版本SDKVER = 3.1.2# iPhone的IP地址IPHONE_IP = 10.0.2.2# iPhone SDK路径IPHONESDK = /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS$(SDKVER).sdk# include 路径INCPATH += -I$(IPHONESDK)/usr/includeINCPATH += -I/Developer/Platfo
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 最新 iPhone 开发 进阶 使用 Makefile 自动 编译 程序
限制150内