summaryrefslogtreecommitdiff
path: root/objective-c/config/Make.rules
blob: 637f894f6e371573b663ea469e495ae063889768 (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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# **********************************************************************
#
# 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.
#
# **********************************************************************

# ----------------------------------------------------------------------
# Don't change anything below this line!
# ----------------------------------------------------------------------

#
# Objective-C mapping configurations
#
supported-configs	= shared static arc-shared arc-static

ifeq ($(os),Darwin)
include		$(lang_srcdir)/config/Make.xcodesdk.rules
endif

ifneq ($(filter arc-%,$(CONFIGS)),)
# Make sure that the non-ARC configuration is also enabled
override CONFIGS := $(call unique,$(CONFIGS) $(patsubst arc-%,%,$(CONFIGS)))
endif

#
# Build only few components with the static configuration (libraries)
#
static_components 	= Ice IceSSL IceObjC IceSSLObjC Glacier2ObjC IceStormObjC IceGridObjC
static_projects		= test/%
static_ldflags		+= $(if $(filter program,$($1_target)),-ObjC)

#
# Build only the tests with the ARC configuration
#
arc_projects		= test/Slice/% test/Ice/%

#
# Define the arc configuration to build the tests with ARC support.
#
# Note that we clear the dependency variable to not include the "arc"
# sub-configuration into the dependency name (for example, if "client"
# depends on "IceObjC", client[osx-arc-shared] will still depend on
# Ice[osx-shared] not Ice[osx-arc-shared]). This is necessary since
# we don't have an ARC specific build of the libraries.
#
arc_cppflags 		:= -fobjc-arc -fobjc-arc-exceptions
arc_dependency	 	:=

#
# Define slice2objc target extension since it can't be figured out
# automatically from the slice2objc translator name.
#
slice2objc_targetext	= m

# Rule for installing headers file from include/objc directory
ifeq ($(filter all obj%c,$(ICE_BIN_DIST)),)
$(DESTDIR)$(install_includedir)/objc:
	$(Q)$(MKDIR) -p $(DESTDIR)$(install_includedir)/objc

$(DESTDIR)$(install_includedir)/objc/%.h: include/objc/%.h | $(DESTDIR)$(install_includedir)/objc
	$(Q)$(call install-data,objc/$(*).h,include,$(DESTDIR)$(install_includedir))
endif

#
# $(make-objc-src-project $1=project)
#
define make-objc-src-project
ifeq ($(filter all obj%c,$(ICE_BIN_DIST)),)
$1_slicecompiler 	:= slice2objc
$1_sliceflags		+= -I$(slicedir)
$1_cppflags 		+= -I$(includedir) -I$(includedir)/generated
$1_ldflags		+= -framework Foundation
$(make-project)
srcs:: $1
endif
endef

#
# $(make-objc-test-project $1=project)
#
define make-objc-test-project
$1_slicecompiler 	:= slice2objc
$1_sliceflags		:= -I$(slicedir) $$($1_sliceflags)
$1_cppflags		:= -I$(includedir) -Itest/include -I$1 -I$1/generated $$($1_cppflags)
$1_ldflags		+= -framework Foundation
ifeq ($(filter all obj%c,$(ICE_BIN_DIST)),)
$1_cppflags		+= -I$(includedir)/generated
endif
$(make-project)
tests:: $1
endef

#
# $(create-objc-test-project $1=test)
#
define create-objc-test-project
$1_srcext		:= m
$1_dependencies 	:= $$(or $$($1_dependencies),TestCommonObjC IceObjC)
$1_cppflags		+= -Itest/Ice

# Also link with IceSSL when compiling the project with the static configuration
$1[static]_dependencies	:= IceSSL

# Dependencies for Xcode SDK configuration
$1[xcodesdk]_dependencies := IceSSL

$(create-test-project)
endef