【makefile】mac和ios通用编译环境
Date: 2018.9.26
1、MAC编译环境配置
mac32:
ifeq ( $(findstring mac32, $(platform)), mac32)
CC = gcc
CPP = g++
LD = ld
AR = ar
CFLAGS += -fPIC -arch i386 -m32
LDFLAGS += -Wl, -Bsymbolic-functions
LDFLAGS += -m32 -read_only_relocs suppress
endif
mac64:
ifeq ( $(findstring mac64, $(platform)), mac64)
CC = gcc
CPP = g++
LD = ld
AR = ar
CFLAGS += -fPIC -arch x86_64 -m64
LDFLAGS += -Wl, -Bsymbolic-functions -m64
LDFLAGS += -m64 -read_only_relocs suppress
endif
2、ios编译环境配置
ios32:
ifeq ( $(findstring ios32, $(platform)), ios32)
CC = xcrun -sdk iphoneos clang
CPP = xcrun -sdk iphoneos clang
AR = ar
CFLAGS += -arch armv7 -mios-version-min=6.0 -march=armv7-a
LDFLAGS += -arch armv7 -mios-version-min=6.0 -march=armv7-a -Wl, -Bsymbolic-functions -read_only_relocs suppress
endif
ios64:
ifeq ( $(findstring ios64, $(platform)), ios64)
CC = xcrun -sdk iphoneos clang
CPP = xcrun -sdk iphoneos clang
AR = ar
CFLAGS += -Wall -O3 -arch arm64 -mios-version-min=6.0
LDFLAGS += -arch arm64 -mios-version-min=6.0 -Wl, -Bsymbolic-functions
endif
i386模拟器环境:
ifeq ( $(findstring ios_i386, $(platform)), ios_i386)
CC = xcrun -sdk iphonesimulator clang
CPP = xcrun -sdk iphonesimulator clang
AR = ar
CFLAGS += -Wall -O3 -arch i386 -mios-simulator-version-min=6.0 -DIOS
LDFLAGS += -arch i386 -mios-simulator-version-min=6.0 -Wl, -Bsymbolic-functions
endif
x86_64模拟器环境:
ifeq ( $(findstring ios_x86_64, $(platform)), ios_x86_64)
CC = xcrun -sdk iphonesimulator clang
CPP = xcrun -sdk iphonesimulator clang
AR = ar
CFLAGS += -Wall -O3 -arch x86_64 -mios-simulator-version-min=6.0 -DIOS
LDFLAGS += -arch x86_64 -mios-simulator-version-min=6.0 -Wl, -Bsymbolic-functions
endif
THE END!
本文为博主原创文章,未经博主允许不得转载。若允许转载,请注明来源https://www.cnblogs.com/SoaringLee/,否则保留追究法律责任的权利!
另外,本人提供付费咨询服务并长期承接各类毕设以及外包项目。联系QQ:2963033731。加Q备注:CNBLOG外包