Make.rules.Darwin 4.03 KB
#
# Copyright (c) ZeroC, Inc. All rights reserved.
#

supported-platforms             = macosx iphoneos iphonesimulator

macosx_ar                       = libtool
macosx_cppflags                 = -mmacosx-version-min=10.9 -arch x86_64
macosx_ldflags                  = $(macosx_cppflags)
macosx_targetdir                = $(if $(filter %/build,$5),/macosx)

iphoneos_ar                     = libtool
iphoneos_cc                     = xcrun -sdk iphoneos clang
iphoneos_cxx                    = xcrun -sdk iphoneos clang++
iphoneos_cppflags               = -miphoneos-version-min=7.1 -arch armv7 -arch arm64 -fembed-bitcode
iphoneos_ldflags                = -miphoneos-version-min=7.1 -arch armv7 -arch arm64
iphoneos_configs                = %xcodesdk
iphoneos_targetdir              = $(if $(filter %/build,$5),/iphoneos)

iphonesimulator_ar              = libtool
iphonesimulator_cc              = xcrun -sdk iphonesimulator clang
iphonesimulator_cxx             = xcrun -sdk iphonesimulator clang++
iphonesimulator_cppflags        = -mios-simulator-version-min=7.1 -arch i386 -arch x86_64
iphonesimulator_ldflags         = $(iphonesimulator_cppflags)
iphonesimulator_configs         = %xcodesdk
iphonesimulator_targetdir       = $(if $(filter %/build,$5),/iphonesimulator)

# If building objects for a shared library, enable fPIC
shared_cppflags = $(if $(filter-out program,$($1_target)),-fPIC) -fvisibility=hidden

cppflags        = -Wall -Wextra -Wshadow -Wshadow-all -Wredundant-decls \
                  -Wdeprecated -Wstrict-prototypes -Werror -pthread \
                  $(if $(filter yes,$(OPTIMIZE)),-O2 -DNDEBUG,-g)

ifeq ($(MAXWARN),yes)
    cppflags	+=  -Wweak-vtables
endif

# -Wshadow issues false warnings with clang 3.x (Apple LLVM 9.0)
ifeq ($(shell clang -v 2>&1 | sed -ne 's/.*version \([0-9]*\)\.\([0-9]*\).*/\1\2/p'),90)
    cppflags    := $(filter-out -Wshadow -Wshadow-all,$(cppflags))
endif

nodeprecatedwarnings-cppflags := -Wno-deprecated-declarations
nounusedparameter-cppflags    := -Wno-unused-parameter

loader_path     = @loader_path

# $(call machoversion,$1=version)
machoversion    = $(subst b,.6,$(subst a,.5,$1))

# $(call mklib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform)
mklib           = $(or $($7_ar),$(AR)) -static -no_warning_for_no_symbols -o $1 $2

# $(call mkshlib,$1=target,$2=objects,$3=libname,$4=version,$5=soversion,$6=ldflags,$7=platform)
mkshlib         = $(or $($7_cxx),$(CXX)) -dynamiclib $(if $5,-install_name @rpath/$(call mkshlibfilename,$3,$4,$5))\
                  $(if $4,-current_version $(call machoversion,$4) -compatibility_version \
                     $(call machoversion,$(if $(filter $4,$(version)),$(compatversion),$4))) \
                  -o $1 $2 $6

# system install directory
system-install-dir = /usr/local

#
# $(call mkxxx,$1=libname,$2=version,$3=soversion)
#
mkshlibfilename   = lib$1$(if $3,.$3).dylib
mkshlibname       = lib$1.dylib
mkshlibnametarget = $(mkshlibfilename)

mkpymodulename  = $1.so
mkrbmodulename  = $1.bundle
mkphpmodulename = $1.so

escape-ldflags   = $(subst -framework$(space),-framework+,$1)
unescape-ldflags = $(subst -framework+,-framework$(space),$1)

#
# System libraries
#
Ice_system_libs := -ldl

# Frameworks for macos
IceSSL[macosx]_system_libs := -framework Security -framework CoreFoundation

# Frameworks requires for iphoneos
Ice[iphoneos]_system_libs := -framework CFNetwork -framework UIKit -framework Foundation
IceSSL[iphoneos]_system_libs := -framework Security
IceIAP[iphoneos]_system_libs := -framework ExternalAccessory

# Same frameworks as iphoneos for iphonesimulator
Ice[iphonesimulator]_system_libs := $(Ice[iphoneos]_system_libs)
IceSSL[iphonesimulator]_system_libs := $(IceSSL[iphoneos]_system_libs)
IceIAP[iphonesimulator]_system_libs := $(IceIAP[iphoneos]_system_libs)

Glacier2CryptPermissionsVerifier[macosx]_system_libs := $(IceSSL[macosx]_system_libs)
Glacier2CryptPermissionsVerifier[iphoneos]_system_libs := $(IceSSL[iphoneos]_system_libs)
Glacier2CryptPermissionsVerifier[iphonesimulator]_system_libs := $(IceSSL[iphonesimulator]_system_libs)