iPhone 开发进阶 使用 Makefile 自动编译 iPhone 程序
2010-02-27 23:28:00 来源:WEB开发网OBJS += $(patsubst %.m,%.o,$(wildcard ./*.m))
OBJS += $(patsubst %.c,%.o,$(wildcard $(SRCDIR)/*.c))
OBJS += $(patsubst %.cpp,%.o,$(wildcard $(SRCDIR)/*.cpp))
NIBS = $(patsubst %.xib,%.nib,$(wildcard *.xib))
RESOURCES= $(wildcard $(RESDIR)/*)
APPFOLDER= $(TARGET).app
.PHONY: all
all: $(TARGET) bundle
$(TARGET): $(OBJS)
$(LD) $(LDFLAGS) -o $@ $^
%.o: %.m
$(CC) -c $(CFLAGS) $< -o $@
%.o: %.c
$(CC) -c $(CFLAGS) $< -o $@
%.o: %.cpp
$(CXX) -x objective-c++ $(CFLAGS) $< -o $@
%.nib: %.xib
ibtool $< --compile $@
bundle: $(TARGET)
@rm -rf $(BUILDDIR)
@mkdir -p $(BUILDDIR)/$(APPFOLDER)
@cp -r $(RESDIR)/* $(BUILDDIR)/$(APPFOLDER)
@cp Info.plist $(BUILDDIR)/$(APPFOLDER)/Info.plist
@echo "APPL" > $(BUILDDIR)/$(APPFOLDER)/PkgInfo
mv $(NIBS) $(BUILDDIR)/$(APPFOLDER)
# export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
@ldid -S $(TARGET)
@mv $(TARGET) $(BUILDDIR)/$(APPFOLDER)/$(TARGET)_
install: bundle
@ssh root@$(IP) "cd /Applications/$(APPFOLDER) && rm -R * || echo 'not found' "
@scp -rp $(BUILDDIR)/$(APPFOLDER) root@$(IP):/Applications
@ssh root@$(IP) "cd /Applications/$(APPFOLDER) ; ldid -S $(TARGET)_; killall SpringBoard"
@echo "Application $(APPFOLDER) installed"
uninstall:
ssh root@$(IPHONE_IP) 'rm -fr /Applications/$(APPFOLDER); respring'
@echo "Application $(APPFOLDER) uninstalled, please respring iPhone"
install_respring:
scp respring_arm root@$(IPHONE_IP):/usr/bin/respring
.PHONY: clean
clean:
@rm -f $(OBJS) $(TARGET)
@rm -rf $(BUILDDIR)
然后执行下面的make命令,我们就可以直接在 iPhone 上测试我们的程序了。
make install_respring
make
make install
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››iphone图片拉伸的几种方法
- ››iphone正则表达式的简单使用
- ››iPhone开发Unresolved Symbols CAKeyframeAnimati...
- ››IPhone开发-“此证书是由未知颁发机构签名”解决方...
- ››IPhone开发-整合私钥和证书,生成.p12文件
- ››iPhone应用开发-UIPickerView选取器详解
- ››iphone 获取屏幕的宽度和高度
- ››iPhone读取工程包中的二进制文件
- ››iPhone新手机 不挂YouTube APP
更多精彩
赞助商链接