# Configuration for iPhone OS, making static libs # this will generate both iPhone (arm) and iPhoneSimulator (i686) libs include Makefile.srcs CFLAGS = -g -O2 -Wall -Wmissing-prototypes -std=c99 -ffast-math -fno-strict-aliasing CXXFLAGS = -g -O2 -Wall -fno-strict-aliasing GCC_VERSION = 4.2 IPHONEOS_DEPLOYMENT_TARGET = 5.0 MACOSX_DEPLOYMENT_TARGET = 10.6 PLATFORM_SIM = iPhoneSimulator PLATFORM_PHONE = iPhoneOS ARCH_SIM = i686 ARCH_PHONE = armv7 PLATFORM_SIM_DEVELOPER_BIN_DIR = /Developer/Platforms/$(PLATFORM_SIM).platform/Developer/usr/bin PLATFORM_PHONE_DEVELOPER_BIN_DIR = /Developer/Platforms/$(PLATFORM_PHONE).platform/Developer/usr/bin SDKROOT_SIM = /Developer/Platforms/$(PLATFORM_SIM).platform/Developer/SDKs/$(PLATFORM_SIM)$(IPHONEOS_DEPLOYMENT_TARGET).sdk SDKROOT_PHONE = /Developer/Platforms/$(PLATFORM_PHONE).platform/Developer/SDKs/$(PLATFORM_PHONE)$(IPHONEOS_DEPLOYMENT_TARGET).sdk EXTRA_CFLAGS_SIM += -arch $(ARCH_SIM) -pipe -mdynamic-no-pic -fvisibility=hidden $(INCLUDE) -isysroot $(SDKROOT_SIM) EXTRA_LDFLAGS_SIM += -arch $(ARCH_SIM) -isysroot $(SDKROOT_SIM) -Wl,-dead_strip EXTRA_CFLAGS_SIM += -D__IPHONE_OS_VERSION_MIN_REQUIRED=20000 -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) EXTRA_LDFLAGS_SIM += -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET) # Xcode complains about the -mdynamic-no-pic with an Apple Mach-O Linker Warning, so removed #EXTRA_CFLAGS_PHONE += -arch $(ARCH_PHONE) -pipe -mdynamic-no-pic -fvisibility=hidden $(INCLUDE) -isysroot $(SDKROOT_PHONE) EXTRA_CFLAGS_PHONE += -arch $(ARCH_PHONE) -pipe -fvisibility=hidden $(INCLUDE) -isysroot $(SDKROOT_PHONE) EXTRA_LDFLAGS_PHONE += -arch $(ARCH_PHONE) -isysroot $(SDKROOT_PHONE) -Wl,-dead_strip EXTRA_CFLAGS_PHONE += -miphoneos-version-min=$(IPHONEOS_DEPLOYMENT_TARGET) EXTRA_LDFLAGS_PHONE += -miphoneos-version-min=$(IPHONEOS_DEPLOYMENT_TARGET) AR_SIM = $(PLATFORM_SIM_DEVELOPER_BIN_DIR)/ar AR_PHONE = $(PLATFORM_PHONE_DEVELOPER_BIN_DIR)/ar CC_SIM = $(PLATFORM_SIM_DEVELOPER_BIN_DIR)/gcc CC_PHONE = $(PLATFORM_PHONE_DEVELOPER_BIN_DIR)/gcc CFLAGS_SIM = $(CFLAGS) $(EXTRA_CFLAGS_SIM) LDFLAGS_SIM = $(EXTRA_LDFLAGS_SIM) CXX_SIM = $(PLATFORM_SIM_DEVELOPER_BIN_DIR)/g++ CXXFLAGS_SIM += $(EXTRA_CFLAGS_SIM) -fvisibility-inlines-hidden LIBTOOL_SIM = /Developer/Platforms/$(PLATFORM_SIM).platform/Developer/usr/bin/libtool CFLAGS_PHONE = $(CFLAGS) $(EXTRA_CFLAGS_PHONE) LDFLAGS_PHONE += $(EXTRA_LDFLAGS_PHONE) CXX_PHONE = $(PLATFORM_PHONE_DEVELOPER_BIN_DIR)/g++ CXXFLAGS_PHONE += $(EXTRA_CFLAGS_PHONE) -fvisibility-inlines-hidden LIBTOOL_PHONE = /Developer/Platforms/$(PLATFORM_PHONE).platform/Developer/usr/bin/libtool TARGET = freeimage STATICLIB_SIM = lib$(TARGET)-iphonesimulator.a STATICLIB_PHONE = lib$(TARGET)-iphone.a HEADER = Source/FreeImage.h .SUFFIXES: .o-i686 .o-arm MODULES_ARM = $(SRCS:.c=.o-arm) MODULES_ARM := $(MODULES_ARM:.cpp=.o-arm) MODULES_i686 = $(SRCS:.c=.o-i686) MODULES_i686 := $(MODULES_i686:.cpp=.o-i686) default: all all: dist dist: FreeImage mkdir -p Dist cp *.a Dist/ cp Source/FreeImage.h Dist/ FreeImage: $(STATICLIB_SIM) $(STATICLIB_PHONE) $(STATICLIB_SIM): $(MODULES_i686) $(LIBTOOL_SIM) -arch_only i686 -o $@ $(MODULES_i686) .c.o-i686: $(CC_SIM) $(CFLAGS_SIM) -c $< -o $@ .cpp.o-i686: $(CXX_SIM) $(CXXFLAGS_SIM) -c $< -o $@ $(STATICLIB_PHONE): $(MODULES_ARM) $(LIBTOOL_PHONE) -arch_only $(ARCH_PHONE) -o $@ $(MODULES_ARM) .c.o-arm: $(CC_PHONE) $(CFLAGS_PHONE) -c $< -o $@ .cpp.o-arm: $(CXX_PHONE) $(CXXFLAGS_PHONE) -c $< -o $@ clean: rm -f core Dist/*.* u2dtmp* $(MODULES_i686) $(MODULES_ARM) $(STATICLIB_SIM) $(STATICLIB_PHONE)