1. 程式人生 > >【makefile】mac和ios通用編譯環境

【makefile】mac和ios通用編譯環境

Date: 2018.9.26

1、MAC編譯環境配置
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
ifeq ( $(findstring mac64, $(platform)), mac64)
CC = gcc
CPP = g++
LD =
ld AR = ar CFLAGS += -fPIC -m64 LDFLAGS += -Wl, -Bsymbolic-functions -m64 LDFLAGS += -m64 endif
2、ios編譯環境配置
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 endif
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

THE END!