summaryrefslogtreecommitdiff
path: root/objective-c/config/Make.rules.Darwin
blob: ba80e55440f9dfa8b91984f3b728cbaf81c82fd6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# **********************************************************************
#
# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
#
# This copy of Ice is licensed to you under the terms described in the
# ICE_LICENSE file included in this distribution.
#
# **********************************************************************

#
# This file is included by Make.rules when uname is Darwin.
#

OSX_TARGET_MIN_SDK_VERSION = 10.9

CC     		= xcrun clang
CXX    		= xcrun clang++

CPPFLAGS	+= -pthread -fvisibility=hidden
OBJCFLAGS	+= -Wall -Werror -mmacosx-version-min=$(OSX_TARGET_MIN_SDK_VERSION)

#
# By default we build x86_64 binaries.
#
ifeq ($(OBJCARCHFLAGS),)
    OBJCARCHFLAGS   := -arch x86_64
endif

ifeq ($(OPTIMIZE),yes)
    OBJCFLAGS	:= $(OBJCARCHFLAGS) -O2 -DNDEBUG $(OBJCFLAGS)
else
    OBJCFLAGS	:= $(OBJCARCHFLAGS) -g $(OBJCFLAGS)
endif

LOADER_PATH = @loader_path

ifeq ($(RPATH_DIR),)
    ifdef ice_src_dist
        RPATH_DIR = @loader_path/$(libdir)
    else
        RPATH_DIR = $(ice_dir)/$(libsubdir)
    endif
endif

#
# Clear rpath setting when doing a system install
#
ifeq ($(ice_dir),/usr)
    RPATH_DIR =
endif

ifneq ($(RPATH_DIR),)
    LDEXEFLAGS		= -Wl,-rpath,$(RPATH_DIR)
    ifndef ice_src_dist
        LDEXEFLAGS += -Wl,-rpath,@loader_path/$(testlibdir)
    endif
endif

ifdef ice_src_dist
    rpathlink	= -Wl,-rpath,$(1)
endif

#
# Enable ARC for targets in demo/ and test/ subdirectories
# when COMPILE_WITH_ARC is defined.
#
ifneq ($(findstring demo/,${CURDIR}),)
    TARGET_SUPPORT_ARC = yes
endif

ifneq ($(findstring test/,${CURDIR}),)
    TARGET_SUPPORT_ARC = yes
endif

ifeq ($(TARGET_SUPPORT_ARC),yes)
    ifeq ($(COMPILE_WITH_ARC),yes)
        #
        # Don't add these to OBJCFLAGS flex and bison generated files used in
        # some demos doesn't support ARC.
        #
        ARCFLAGS = -fobjc-arc -fobjc-arc-exceptions
    endif
endif

mklib 		= libtool -static -o $(1) $(2)
mkshlib		= $(CXX)  -dynamiclib $(LDFLAGS) -o $(1) -install_name @rpath/$(2) $(3) $(4)

BASELIBS	= -L$(ice_cpp_dir)/$(libsubdir) -lIce -lIceUtil -framework Foundation
LIBS		= -lIceObjC$(libsuffix) -framework Foundation
ICESSL_LIBS 	= -lIceSSLObjC$(libsuffix)
TEST_LIBS	= -lTestCommonObjC $(LIBS)