【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!

posted @ 2018-09-26 17:24  SoaringLee_fighting  阅读(1042)  评论(0编辑  收藏  举报