iOS SDK同时支持模拟器和真机的静态包编译脚本

替换XXXXX为你的工程名字

XBUILD=/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
PROJECT_ROOT=.
PROJECT=$(PROJECT_ROOT)/XXXXXX.xcodeproj

# The name of the target is generated by the Xcode
TARGET=XXXXXX

# The name of the .a file is generated by the project, without the "lib" prefix or the ".a" suffix.
# This project will create libXXXXXX.a
LIB= XXXXXX

all: libXXXXXX.a

libXXXXXXi386.a:
	$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphonesimulator -configuration Release clean build 
	-mv $(PROJECT_ROOT)/build/Release-iphonesimulator/lib$(LIB).a $@

libXXXXXXArmv7.a:
	$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch armv7 -configuration Release clean build 
	-mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(LIB).a $@

libXXXXXXArm64.a:
	$(XBUILD) -project $(PROJECT) -target $(TARGET) -sdk iphoneos -arch arm64 -configuration Release clean build 
	-mv $(PROJECT_ROOT)/build/Release-iphoneos/lib$(LIB).a $@

# Without armv7s:
libXXXXXX.a: libXXXXXXi386.a libXXXXXXArmv7.a libXXXXXXArm64.a
	lipo -create -output lib$(LIB).a $^

clean:
	-rm -f *.a *.dll
	-rm -rf build

你可能感兴趣的:(iOS)