]> git.saurik.com Git - apple/icu.git/blame - makefile
ICU-59117.0.1.tar.gz
[apple/icu.git] / makefile
CommitLineData
b75a7d8f 1##
46f4442e 2# Wrapper makefile for ICU
f3c0d7a5 3# Copyright (C) 2003-2017 Apple Inc. All rights reserved.
b75a7d8f
A
4#
5# See http://www.gnu.org/manual/make/html_chapter/make_toc.html#SEC_Contents
6# for documentation on makefiles. Most of this was culled from the ncurses makefile.
7#
51004dcb 8#################################
2ca993e8
A
9# Apple ICU repository tag and submission numbers
10#
11# The repository tag number consists of a main version and an optional branch version, as
12# follows:
13# ICU-MMmAA[.B]
14#
15# MM comes from the open-source ICU major version, and can range from 1 to 214 (the max is
f3c0d7a5 16# due to B&I limits on submission versions). As of March 2016 this is 57; it increases
2ca993e8
A
17# by 1 for each ICU major release (usually 2 / year). This corresponds to
18# U_ICU_VERSION_MAJOR_NUM.
19# m is a single digit specifying the open-source ICU minor version. This is 0 before final
20# release (e.g. for pre-release milestones), becomes 1 for release candidate and final
21# release, and may increase to 2 or a little more for occasional dot releases with
22# maintenance fixes. This corresponds to U_ICU_VERSION_MINOR_NUM.
23#
24# Note that the ICU release may also utilize U_ICU_VERSION_PATCHLEVEL_NUM; however
25# that is ignored for the Apple ICU tag and submission numbers, and any related code
26# or data changes will bne distinguished by updating the Apple delta version AA below.
27#
28# AA is a 2-digit value specifying the version of the additional Apple deltas after
29# integrating a major release. This is always 2 digits (zero padded) and ranges from
30# 00 (the first release after integrating a new ICU version) to 99.
31# B is an optional branch version, i.e. a branch from the mainline version specified by
32# the MMmAA part. It can range from 1 to 99 and is NOT zero-padded.
33#
34# For Windows builds, the first 3 values of the 4-part FILEVERSION and PRODUCTVERSION
35# are formed from U_ICU_VERSION_MAJOR_NUM, U_ICU_VERSION_MINOR_NUM, and
36# U_ICU_VERSION_PATCHLEVEL_NUM; the 4th value is ICU_BUILD, formed from AA and B as
37# ICU_BUILD = 100*AA + B.
38#
39# The B&I submission version always has 3 parts separated by '.':
40# MMmAA.(0 | B).T
41#
42# The first part MMmAA is the same as the repository tag number.
43# If the repository tag has no branch version, the second part is 0, otherwise it is
44# the same as the branch version (1..99).
45# The third part is a single digit designating the submission train; since the installsrc
46# target now submits different sources to different trains, we have to distinguish them.
47# The values currently defined for T are
48# 1 OSX trains
f3c0d7a5 49# 2 embedded trains (iOS, tvos, watchos, bridgeos) including simulator versions thereof
2ca993e8
A
50# 8 AAS for Windows
51# 9 linux for Siri servers
52# (additional train numbers for Apple platforms can be assigned from 3 up, additional
53# train numbers for non-Apple platforms can be assigned from 7 down).
54#
55#################################
f3c0d7a5 56# Notes on building for AAS using Windows (10) + Visual Studio (2015) + Cygwin:
51004dcb
A
57#
58# Either this should be run indirectly from the VS command prompt via the
59# BuildICUForAAS script or project, using the instructions there (which build
60# both 32-bit and 64-bit), or it should be run from within Cygwin using the
61# following instructions or equivalent (different steps for 32-bit or 64-bit):
62#
63# 1. From VS command prompt, run vcvarsall.bat to set various environment variables.
64# For a 32-bit build:
f3c0d7a5 65# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86
51004dcb 66# For a 64-bit build:
f3c0d7a5 67# > "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
51004dcb
A
68#
69# 2. Launch Cygwin, e.g.
f3c0d7a5 70# > C:\cygwin64\cygwin.bat
51004dcb
A
71#
72# 3. Within cygwin, cd to the top level of the ICU sources directory, e.g.
73# $ cd ICU
74#
75# 4. Adjust the PATH to put the appropriate VC tools directory first:
76# For a 32-bit build:
f3c0d7a5 77# $ export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/":$PATH
51004dcb 78# For a 64-bit build:
f3c0d7a5 79# $ export PATH="/cygdrive/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/amd64/":$PATH
51004dcb
A
80#
81# 5. Run the ICU makefile
82# For a 32-bit build:
83# make [install] WINDOWS=YES [ARCH64=NO] [DSTROOT=...]
84# For a 64-bit build:
85# make [install] WINDOWS=YES ARCH64=YES [DSTROOT=...]
86#
87#################################
b75a7d8f
A
88
89#################################
90#################################
91# MAKE VARS
92#################################
93#################################
94
95# ':=' denotes a "simply expanded" variable. It's value is
96# set at the time of definition and it never recursively expands
97# when used. This is in contrast to using '=' which denotes a
98# recursively expanded variable.
99
2ca993e8
A
100# Sane defaults, which are typically overridden on the command line
101#or by the environment
73c04bcf 102WINDOWS=NO
729e4ab9
A
103LINUX=NO
104ARCH64=NO
2ca993e8
A
105RC_ARCHS=
106ifndef RC_ProjectSourceVersion
107ifdef RC_PROJECTSOURCEVERSION
108 RC_ProjectSourceVersion=$(RC_PROJECTSOURCEVERSION)
109endif
110endif
111$(info # RC_ARCHS=$(RC_ARCHS))
112$(info # RC_ProjectName=$(RC_ProjectName))
113$(info # RC_ProjectSourceVersion=$(RC_ProjectSourceVersion))
114
115# Disallow $(WINDOWS) and $(LINUX) both YES
116ifeq "$(WINDOWS)" "YES"
117 ifeq "$(LINUX)" "YES"
118 $(error WINDOWS and LINUX cannot both be YES)
119 endif
120endif
729e4ab9 121
51004dcb 122# chicken and egg problem: we can't use cygpath until PATH & SHELL are set,
f3c0d7a5 123# but we have to convert VS140VCTOOLS_PATH in order to set PATH. So instead we
51004dcb
A
124# convert using subst.
125ifeq "$(WINDOWS)" "YES"
f3c0d7a5
A
126 ifneq "$(VS140VCTOOLS_PATH)" ""
127 VS140VCTOOLS_CYGPATH:= /cygdrive/$(subst :/,/,$(subst \,/,$(VS140VCTOOLS_PATH)))
128 PATH:=$(VS140VCTOOLS_CYGPATH):/usr/local/bin/:/usr/bin/:$(PATH)
51004dcb
A
129 endif
130endif
131$(info # PATH=$(PATH))
132
133# For some reason, cygwin bash (at least when run non-login) needs to use
134# bash for pwd, echo etc. (but uname does not work, see below)
135ifeq "$(WINDOWS)" "YES"
136 SHELL := /bin/bash
137else
138 SHELL := /bin/sh
139endif
140
141# if building for windows from batch script, convert Win-style paths
142# for SRCROOT etc. to cygwin-style paths. Don't define them if not
143# already defined.
144ifeq "$(WINDOWS)" "YES"
f3c0d7a5 145 ifneq "$(VS140VCTOOLS_PATH)" ""
51004dcb
A
146 ifdef SRCROOT
147 SRCROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(SRCROOT)))
148 endif
149 ifdef OBJROOT
150 OBJROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(OBJROOT)))
151 endif
152 ifdef DSTROOT
153 DSTROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(DSTROOT)))
154 endif
155 ifdef SYMROOT
156 SYMROOT:=$(shell /bin/cygpath -ua $(subst \,/,$(SYMROOT)))
157 endif
158 endif
159endif
160
161ifndef SRCROOT
162 SRCROOT:=$(shell pwd)
163endif
164ifndef OBJROOT
165 OBJROOT:=$(SRCROOT)/build
166endif
167ifndef DSTROOT
168 DSTROOT:=$(OBJROOT)
169endif
170ifndef SYMROOT
171 SYMROOT:=$(OBJROOT)
172endif
2ca993e8
A
173$(info # SRCROOT=$(SRCROOT))
174$(info # OBJROOT=$(OBJROOT))
175$(info # DSTROOT=$(DSTROOT))
176
177# Disallow $(SRCROOT) == $(OBJROOT)
178ifeq ($(OBJROOT), $(SRCROOT))
179$(error SRCROOT same as OBJROOT)
180endif
51004dcb
A
181
182ifeq "$(WINDOWS)" "YES"
183 ifeq "$(ARCH64)" "YES"
184 OBJROOT_CURRENT=$(OBJROOT)/obj64
185 SYMROOT_CURRENT=$(SYMROOT)/obj64
186 else
187 OBJROOT_CURRENT=$(OBJROOT)/obj32
188 SYMROOT_CURRENT=$(SYMROOT)/obj32
189 endif
190else ifeq "$(LINUX)" "YES"
191 ifeq "$(ARCH64)" "YES"
192 OBJROOT_CURRENT=$(OBJROOT)/obj64
193 SYMROOT_CURRENT=$(SYMROOT)/obj64
194 else
195 OBJROOT_CURRENT=$(OBJROOT)/obj32
196 SYMROOT_CURRENT=$(SYMROOT)/obj32
197 endif
198else
199 OBJROOT_CURRENT=$(OBJROOT)
200 SYMROOT_CURRENT=$(SYMROOT)
201endif
2ca993e8
A
202
203ifndef SDKROOT
204 SDKPATH:=/
205else ifeq "$(SDKROOT)" ""
206 SDKPATH:=/
207else
208 SDKPATH:=$(shell xcodebuild -version -sdk $(SDKROOT) Path)
209 ifeq "$(SDKPATH)" ""
210 SDKPATH:=/
211 endif
212endif
213$(info # SDKROOT=$(SDKROOT))
214$(info # SDKPATH=$(SDKPATH))
215
216# An Apple submission version (passed in RC_ProjectSourceVersion for official builds) is
217# X[.Y[.Z]]
218# where X is in range 0-214747, Y and Z are in range 0-99 (with no leading zeros).
219# This corresponds to MMmAA.(0 | B).T where
220# MM is U_ICU_VERSION_MAJOR_NUM
221# m is U_ICU_VERSION_MINOR_NUM
222# AA is the Apple delta version
223# B is the Apple branch version (1 or 2 digits)
224# T is the Apple train code for submissions.
225# Note The value for the SourceVersion property in version.plists will be calculated as
226# (X*10000 + Y*100 + Z).
227# We want ICU_BUILD = 100*AA + B.
228#
229ifneq "$(RC_ProjectSourceVersion)" ""
230 ifeq "$(WINDOWS)" "YES"
231 ICU_BUILD_AA := $(shell echo $(RC_ProjectSourceVersion) | sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\2/')
232 ICU_BUILD_B1 := $(shell echo $(RC_ProjectSourceVersion) | sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\4/')
233 ICU_BUILD_B2 := $(shell echo $(RC_ProjectSourceVersion) | sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\5/')
234 ICU_TRAIN_CODE := $(shell echo $(RC_ProjectSourceVersion) | sed -r -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\7/')
235 else
236 ICU_BUILD_AA := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\2/')
237 ICU_BUILD_B1 := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\4/')
238 ICU_BUILD_B2 := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\5/')
239 ICU_TRAIN_CODE := $(shell echo $(RC_ProjectSourceVersion) | sed -E -e 's/([0-9]+)([0-9]{2})(\.([0-9])([0-9])?(\.([0-9]{1,2}))?)?/\7/')
240 endif
241 ifeq "$(ICU_BUILD_AA)" ""
242 ICU_BUILD := 0
243 else
244 ICU_BUILD := $(subst a,$(ICU_BUILD_AA),abc)
245 ifeq "$(ICU_BUILD_B1)" ""
246 ICU_BUILD := $(subst b,0,$(ICU_BUILD))
247 ICU_BUILD := $(subst c,0,$(ICU_BUILD))
248 else
249 ifeq "$(ICU_BUILD_B2)" ""
250 ICU_BUILD := $(subst b,0,$(ICU_BUILD))
251 ICU_BUILD := $(subst c,$(ICU_BUILD_B1),$(ICU_BUILD))
252 else
253 ICU_BUILD := $(subst b,$(ICU_BUILD_B1),$(ICU_BUILD))
254 ICU_BUILD := $(subst c,$(ICU_BUILD_B2),$(ICU_BUILD))
255 endif
256 endif
257 endif
258 ifeq "$(ICU_TRAIN_CODE)" ""
259 ICU_TRAIN_CODE := 0
260 endif
261else
262 ICU_BUILD := 0
263 ICU_TRAIN_CODE := 0
264endif
265$(info # ICU_BUILD=$(ICU_BUILD))
266$(info # ICU_TRAIN_CODE=$(ICU_TRAIN_CODE))
267ifeq "$(ICU_BUILD)" "0"
268 DEFINE_BUILD_LEVEL =
269else
270 DEFINE_BUILD_LEVEL =-DU_ICU_VERSION_BUILDLEVEL_NUM=$(ICU_BUILD)
271endif
272
273# Determine build type. In some cases (e.g. running installsrc for submitproject)
274# the only accurate information we may have about build type is from ICU_TRAIN_CODE,
275# so give priority to that if nonzero.
276# The values currently defined for ICU_TRAIN_CODE and corresponding ICU_BUILD_TYPE are
277# 1 OSX trains
278# 2 embedded trains (iOS, tvos, watchos) including simulator versions thereof.
279# may have BUILD_TYPE=DEVICE,SIMULATOR,TOOL
280# 8 AAS for Windows
281# 9 linux for Siri servers
282#
283ifeq "$(WINDOWS)" "YES"
284 ICU_FOR_APPLE_PLATFORMS:=NO
285else ifeq "$(ICU_TRAIN_CODE)" "8"
286 override WINDOWS=YES
287 ICU_FOR_APPLE_PLATFORMS:=NO
288else ifeq "$(LINUX)" "YES"
289 ICU_FOR_APPLE_PLATFORMS:=NO
290else ifeq "$(ICU_TRAIN_CODE)" "9"
291 override LINUX=YES
292 ICU_FOR_APPLE_PLATFORMS:=NO
293else
294 ICU_FOR_APPLE_PLATFORMS:=YES
295endif
296
297# For Apple builds, get more details from the SDK if available
298# In TargetConditionals.h:
299# TARGET_OS_IPHONE -is 1 iff generating code for firmware, devices, or simulator (all embedded trains)
300# in that case:
301# exactly one of the following is 1: TARGET_OS_SIMULATOR, TARGET_OS_EMBEDDED (i.e. device)
f3c0d7a5 302# exactly one of the following is 1: TARGET_OS_IOS, TARGET_OS_TV, TARGET_OS_WATCH, TARGET_OS_BRIDGE
2ca993e8
A
303#
304ifeq "$(ICU_FOR_APPLE_PLATFORMS)" "YES"
305 HOSTCC := $(shell xcrun --sdk macosx --find cc)
306 HOSTCXX := $(shell xcrun --sdk macosx --find c++)
307 HOSTSDKPATH := $(shell xcrun --sdk macosx --show-sdk-path)
308 HOSTISYSROOT = -isysroot $(HOSTSDKPATH)
309 ifeq "$(SDKPATH)" "/"
310 ISYSROOT:= -isysroot $(HOSTSDKPATH)
311 CC := $(HOSTCC)
312 CXX := $(HOSTCXX)
313 NM := $(shell xcrun --sdk macosx --find nm)
314 STRIPCMD := $(shell xcrun --sdk macosx --find strip)
315 ifeq "$(ICU_TRAIN_CODE)" "2"
316 export ICU_FOR_EMBEDDED_TRAINS:=YES
317 else
318 export ICU_FOR_EMBEDDED_TRAINS:=NO
319 endif
320 else
321 ISYSROOT:= -isysroot $(SDKPATH)
322 CC := $(shell xcrun --sdk $(SDKPATH) --find cc)
323 CXX := $(shell xcrun --sdk $(SDKPATH) --find c++)
324 NM := $(shell xcrun --sdk $(SDKPATH) --find nm)
325 STRIPCMD := $(shell xcrun --sdk $(SDKPATH) --find strip)
326 EMBEDDEDTRAIN:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_IPHONE | cut -d' ' -f3)
327 ifeq "$(EMBEDDEDTRAIN)" "1"
328 export ICU_FOR_EMBEDDED_TRAINS:=YES
329 else
330 export ICU_FOR_EMBEDDED_TRAINS:=NO
331 endif
332 endif
333 SIMULATOROS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_SIMULATOR | cut -d' ' -f3)
334 TVOS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_TV | cut -d' ' -f3)
335 WATCHOS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_WATCH | cut -d' ' -f3)
f3c0d7a5 336 BRIDGEOS:=$(shell $(CXX) -E -dM -x c $(ISYSROOT) -include TargetConditionals.h /dev/null | fgrep define' 'TARGET_OS_BRIDGE | cut -d' ' -f3)
2ca993e8
A
337 ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
338 ifeq "$(SIMULATOROS)" "1"
339 BUILD_TYPE=SIMULATOR
340 else
341 BUILD_TYPE=DEVICE
342 endif
343 else ifeq "$(RC_ProjectName)" "tzTools"
344 BUILD_TYPE=TOOL
345 else
346 BUILD_TYPE=
347 endif
348else
349 ifeq "$(LINUX)" "YES"
350 ISYSROOT:=
351 CC := gcc
352 CXX := g++
353 endif
354 export ICU_FOR_EMBEDDED_TRAINS:=NO
355 TVOS:=0
356 WATCHOS:=0
f3c0d7a5 357 BRIDGEOS:=0
2ca993e8
A
358 BUILD_TYPE=
359endif
360
361CROSS_BUILD:=$(ICU_FOR_EMBEDDED_TRAINS)
729e4ab9 362CROSSHOST_OBJROOT=$(OBJROOT)/crossbuildhost
2ca993e8
A
363
364$(info # ICU_FOR_APPLE_PLATFORMS=$(ICU_FOR_APPLE_PLATFORMS))
365$(info # HOSTCC=$(HOSTCC))
366$(info # HOSTCXX=$(HOSTCXX))
367$(info # HOSTISYSROOT=$(HOSTISYSROOT))
368$(info # CC=$(CC))
369$(info # CXX=$(CXX))
370$(info # ISYSROOT=$(ISYSROOT))
371$(info # ICU_FOR_EMBEDDED_TRAINS=$(ICU_FOR_EMBEDDED_TRAINS))
372$(info # CROSS_BUILD=$(CROSS_BUILD))
373$(info # BUILD_TYPE=$(BUILD_TYPE))
374
375# Disallow cross builds on Windows/Linux for now
376# (since those builds are not out-of-source as required for cross-builds)
377ifeq "$(CROSS_BUILD)" "YES"
378ifeq "$(WINDOWS)" "YES"
379$(error Cross-builds currently not allowed on Windows)
380endif
381ifeq "$(LINUX)" "YES"
382$(error Cross-builds currently not allowed on Linux)
383endif
384endif
385
f3c0d7a5
A
386MAC_OS_X_VERSION_MIN_REQUIRED=101200
387OSX_HOST_VERSION_MIN_STRING=10.12
2ca993e8 388
b331163b 389ifndef IPHONEOS_DEPLOYMENT_TARGET
f3c0d7a5 390 IOS_VERSION_TARGET_STRING=11.0
b331163b 391else ifeq "$(IPHONEOS_DEPLOYMENT_TARGET)" ""
f3c0d7a5 392 IOS_VERSION_TARGET_STRING=11.0
b331163b
A
393else
394 IOS_VERSION_TARGET_STRING=$(IPHONEOS_DEPLOYMENT_TARGET)
395endif
2ca993e8 396
b331163b 397ifndef MACOSX_DEPLOYMENT_TARGET
f3c0d7a5 398 OSX_VERSION_TARGET_STRING=10.13
b331163b 399else ifeq "$(MACOSX_DEPLOYMENT_TARGET)" ""
f3c0d7a5 400 OSX_VERSION_TARGET_STRING=10.13
b331163b
A
401else
402 OSX_VERSION_TARGET_STRING=$(MACOSX_DEPLOYMENT_TARGET)
403endif
2ca993e8 404
b331163b 405ifndef WATCHOS_DEPLOYMENT_TARGET
f3c0d7a5 406 WATCHOS_VERSION_TARGET_STRING=4.0
b331163b 407else ifeq "$(WATCHOS_DEPLOYMENT_TARGET)" ""
f3c0d7a5 408 WATCHOS_VERSION_TARGET_STRING=4.0
b331163b
A
409else
410 WATCHOS_VERSION_TARGET_STRING=$(WATCHOS_DEPLOYMENT_TARGET)
411endif
2ca993e8 412
b331163b 413ifndef TVOS_DEPLOYMENT_TARGET
f3c0d7a5 414 TVOS_VERSION_TARGET_STRING=11.0
b331163b 415else ifeq "$(TVOS_DEPLOYMENT_TARGET)" ""
f3c0d7a5 416 TVOS_VERSION_TARGET_STRING=11.0
b331163b
A
417else
418 TVOS_VERSION_TARGET_STRING=$(TVOS_DEPLOYMENT_TARGET)
419endif
729e4ab9 420
f3c0d7a5
A
421ifndef BRIDGEOS_DEPLOYMENT_TARGET
422 BRIDGEOS_VERSION_TARGET_STRING=2.0
423else ifeq "$(BRIDGEOS_DEPLOYMENT_TARGET)" ""
424 BRIDGEOS_VERSION_TARGET_STRING=2.0
425else
426 BRIDGEOS_VERSION_TARGET_STRING=$(BRIDGEOS_DEPLOYMENT_TARGET)
427endif
428
b331163b
A
429$(info # IOS_VERSION_TARGET_STRING=$(IOS_VERSION_TARGET_STRING))
430$(info # OSX_VERSION_TARGET_STRING=$(OSX_VERSION_TARGET_STRING))
431$(info # WATCHOS_VERSION_TARGET_STRING=$(WATCHOS_VERSION_TARGET_STRING))
432$(info # TVOS_VERSION_TARGET_STRING=$(TVOS_VERSION_TARGET_STRING))
f3c0d7a5 433$(info # BRIDGEOS_VERSION_TARGET_STRING=$(BRIDGEOS_VERSION_TARGET_STRING))
51004dcb 434
2ca993e8
A
435ifeq "$(BUILD_TYPE)" "DEVICE"
436 ifeq "$(WATCHOS)" "1"
437 ICU_TARGET_VERSION := -mwatchos-version-min=$(WATCHOS_VERSION_TARGET_STRING)
438 else ifeq "$(TVOS)" "1"
439 ICU_TARGET_VERSION := -mtvos-version-min=$(TVOS_VERSION_TARGET_STRING)
f3c0d7a5
A
440 else ifeq "$(BRIDGEOS)" "1"
441 ICU_TARGET_VERSION := -mbridgeos-version-min=$(BRIDGEOS_VERSION_TARGET_STRING)
2ca993e8
A
442 else
443 ICU_TARGET_VERSION := -miphoneos-version-min=$(IOS_VERSION_TARGET_STRING)
444 endif
445else ifeq "$(BUILD_TYPE)" "SIMULATOR"
446 ifeq "$(WATCHOS)" "1"
447 ICU_TARGET_VERSION := -mwatchos-simulator-version-min=$(WATCHOS_VERSION_TARGET_STRING)
448 else ifeq "$(TVOS)" "1"
449 ICU_TARGET_VERSION := -mtvos-simulator-version-min=$(TVOS_VERSION_TARGET_STRING)
450 else
451 ICU_TARGET_VERSION := -mios-simulator-version-min=$(IOS_VERSION_TARGET_STRING)
452 endif
453else
454 ICU_TARGET_VERSION :=
455endif
456$(info # ICU_TARGET_VERSION=$(ICU_TARGET_VERSION))
457
458
459DISABLE_DRAFT:=$(ICU_FOR_EMBEDDED_TRAINS)
460ifeq "$(DISABLE_DRAFT)" "YES"
461 DRAFT_FLAG=--disable-draft
462else
463 DRAFT_FLAG=
464endif
465
51004dcb
A
466# For some reason, under cygwin, bash uname is not found, and
467# sh uname does not produce a result with -p or -m. So we just
468# hardcode here.
469ifeq "$(WINDOWS)" "YES"
470 UNAME_PROCESSOR:=i386
471else
472 UNAME_PROCESSOR:=$(shell uname -p)
473endif
57a6839d 474
729e4ab9 475ifneq "$(RC_ARCHS)" ""
729e4ab9 476 INSTALLHDRS_ARCH=-arch $(shell echo $(RC_ARCHS) | cut -d' ' -f1)
73c04bcf 477else
729e4ab9 478 INSTALLHDRS_ARCH=
73c04bcf 479endif
729e4ab9
A
480$(info # INSTALLHDRS_ARCH=$(INSTALLHDRS_ARCH))
481$(info # buildhost=$(UNAME_PROCESSOR))
57a6839d 482
729e4ab9
A
483
484# FORCEENDIAN below is to override silly configure behavior in which if
485# __APPLE_CC__ is defined and archs are in { ppc, ppc64, i386, x86_64 }
486# then it assumes a universal build (ac_cv_c_bigendian=universal) with
487# data file initially built big-endian.
488#
489ifeq "$(CROSS_BUILD)" "YES"
490 RC_ARCHS_FIRST=$(shell echo $(RC_ARCHS) | cut -d' ' -f1)
f3c0d7a5 491 TARGET_SPEC=$(RC_ARCHS_FIRST)-apple-darwin16.0.0
51004dcb 492 ENV_CONFIGURE_ARCHS=-arch $(RC_ARCHS_FIRST)
729e4ab9
A
493 ICUPKGTOOLIBS="$(CROSSHOST_OBJROOT)/lib:$(CROSSHOST_OBJROOT)/stubdata"
494 ICUPKGTOOL=$(CROSSHOST_OBJROOT)/bin/icupkg
495 ifeq "$(filter-out i386 x86_64,$(RC_ARCHS))" ""
496 FORCEENDIAN= ac_cv_c_bigendian=no
497 else
498 FORCEENDIAN=
499 endif
500else ifeq "$(LINUX)" "YES"
501 TARGET_SPEC=$(UNAME_PROCESSOR)-unknown-linux-gnu
502 ENV_CONFIGURE_ARCHS=
51004dcb
A
503 ICUPKGTOOLIBS="$(OBJROOT_CURRENT)/lib:$(OBJROOT_CURRENT)/stubdata"
504 ICUPKGTOOL=$(OBJROOT_CURRENT)/bin/icupkg
729e4ab9 505 FORCEENDIAN=
46f4442e 506else
f3c0d7a5 507 TARGET_SPEC=$(UNAME_PROCESSOR)-apple-darwin16.0.0
729e4ab9 508 ENV_CONFIGURE_ARCHS=
51004dcb
A
509 ICUPKGTOOLIBS="$(OBJROOT_CURRENT)/lib:$(OBJROOT_CURRENT)/stubdata"
510 ICUPKGTOOL=$(OBJROOT_CURRENT)/bin/icupkg
729e4ab9 511 FORCEENDIAN=
46f4442e 512endif
729e4ab9
A
513$(info # TARGET_SPEC=$(TARGET_SPEC))
514$(info # ENV_CONFIGURE_ARCHS=$(ENV_CONFIGURE_ARCHS))
46f4442e 515
57a6839d
A
516ICU_TARGET_VERSION_FOR_TZ_EXTRA :=
517ifeq "$(BUILD_TYPE)" "SIMULATOR"
518 ICU_TARGET_VERSION_FOR_TZ_EXTRA := -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING)
46f4442e
A
519endif
520
57a6839d 521ifeq "$(BUILD_TYPE)" "DEVICE"
729e4ab9 522 THUMB_FLAG = -mthumb
57a6839d
A
523else
524 THUMB_FLAG =
729e4ab9
A
525endif
526
5ea0322b
A
527# even for a crossbuild host build, we want to use the target's latest tzdata as pointed to by latest_tzdata.tar.gz;
528# first try RC_EMBEDDEDPROJECT_DIR (<rdar://problem/28141177>), else SDKPATH.
529ifdef RC_EMBEDDEDPROJECT_DIR
530 ifeq "$(shell test -L $(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/latest_tzdata.tar.gz && echo YES )" "YES"
531 export TZDATA:=$(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/$(shell readlink $(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/latest_tzdata.tar.gz)
532 endif
f3c0d7a5
A
533 ifeq "$(shell test -d $(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/icudata && echo YES )" "YES"
534 export TZAUXFILESDIR:=$(RC_EMBEDDEDPROJECT_DIR)/TimeZoneData/usr/local/share/tz/icudata
535 endif
5ea0322b
A
536endif
537ifndef TZDATA
538 ifeq "$(shell test -L $(SDKPATH)/usr/local/share/tz/latest_tzdata.tar.gz && echo YES )" "YES"
539 export TZDATA:=$(SDKPATH)/usr/local/share/tz/$(shell readlink $(SDKPATH)/usr/local/share/tz/latest_tzdata.tar.gz)
540 endif
f3c0d7a5
A
541 ifeq "$(shell test -d $(SDKPATH)/usr/local/share/tz/icudata && echo YES )" "YES"
542 export TZAUXFILESDIR:=$(SDKPATH)/usr/local/share/tz/icudata
543 endif
08b89b0a 544endif
5ea0322b 545$(info # RC_EMBEDDEDPROJECT_DIR=$(RC_EMBEDDEDPROJECT_DIR))
729e4ab9 546$(info # TZDATA=$(TZDATA))
f3c0d7a5
A
547$(info # TZAUXFILESDIR=$(TZAUXFILESDIR))
548ifndef TZAUXFILESDIR
549 TZAUXFILESDIR:=.
550endif
729e4ab9 551
2ca993e8 552APPLE_INTERNAL_DIR=/AppleInternal
51004dcb
A
553DSYMTOOL := /usr/bin/dsymutil
554DSYMSUFFIX := .dSYM
555
b75a7d8f
A
556#################################
557# Headers
558#################################
559
560# For installhdrs. Not every compiled module has an associated header. Normally,
2ca993e8 561# ICU installs headers as a sub-target of the install target. But since we only want
b75a7d8f
A
562# certain libraries to install (and since we link all of our own .o modules), we need
563# invoke the headers targets ourselves. This may be problematic because there isn't a
564# good way to dist-clean afterwards...we need to do explicit dist-cleans, especially if
565# install the extra libraries.
566
567EXTRA_HDRS =
2ca993e8
A
568# EXTRA_HDRS = ./extra/ustdio/ ./layout/
569ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
73c04bcf
A
570 HDR_MAKE_SUBDIR = ./common/ ./i18n/ $(EXTRA_HDRS)
571else ifeq "$(WINDOWS)" "YES"
572 HDR_MAKE_SUBDIR = ./common/ ./i18n/ $(EXTRA_HDRS)
573else
574 HDR_MAKE_SUBDIR = ./common/ ./i18n/ ./io/ $(EXTRA_HDRS)
575endif
576ifeq "$(WINDOWS)" "YES"
73c04bcf 577 PRIVATE_HDR_PREFIX=$(APPLE_INTERNAL_DIR)
2ca993e8 578else ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
73c04bcf
A
579 HDR_PREFIX=/usr
580 PRIVATE_HDR_PREFIX=/usr/local
729e4ab9
A
581else
582 PRIVATE_HDR_PREFIX=/usr/local
73c04bcf 583endif
b75a7d8f
A
584
585#################################
586# Install
587#################################
588
2ca993e8
A
589# For install. We currently don't install EXTRA_LIBS. We also don't install the data
590# directly into the ICU library. It is now installed at /usr/share/icu/*.dat. Thus we
b75a7d8f
A
591# don't use DATA_OBJ anymore. This could change if we decide to move the data back into
592# the icucore monolithic library.
593
594INSTALL = /usr/bin/install
595COMMON_OBJ = ./common/*.o
596I18N_OBJ = ./i18n/*.o
73c04bcf 597IO_OBJ = ./io/*.o
b75a7d8f
A
598STUB_DATA_OBJ = ./stubdata/*.o
599EXTRA_LIBS =
600#EXTRA_LIBS =./extra/ ./layout/ ./tools/ctestfw/ ./tools/toolutil/
601#DATA_OBJ = ./data/out/build/*.o
2ca993e8 602ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
73c04bcf
A
603 DYLIB_OBJS=$(COMMON_OBJ) $(I18N_OBJ) $(STUB_DATA_OBJ)
604else ifeq "$(WINDOWS)" "YES"
605 DYLIB_OBJS=$(COMMON_OBJ) ./common/common.res $(I18N_OBJ) $(STUB_DATA_OBJ)
606else
607 DYLIB_OBJS=$(COMMON_OBJ) $(I18N_OBJ) $(IO_OBJ) $(STUB_DATA_OBJ)
608endif
b75a7d8f 609
46f4442e
A
610#################################
611# Sources
612#################################
613
614# For installsrc (B&I)
615# Note that installsrc is run on the system from which ICU is submitted, which
616# may be a different environment than the one for a which a build is targeted.
617
b331163b
A
618INSTALLSRC_VARFILES=./ICU_embedded.order \
619 ./minimalapis.txt ./minimalapisTest.c ./minimalpatchconfig.txt ./windowspatchconfig.txt ./patchconfig.txt ./crosshostpatchconfig.txt \
620 BuildICUForAAS_script.bat EXPORT.APPLE
46f4442e 621
b75a7d8f
A
622#################################
623# Cleaning
624#################################
625
626#We need to clean after installing.
627
2ca993e8 628EXTRA_CLEAN =
b75a7d8f
A
629
630# Some directories aren't cleaned recursively. Clean them manually...
631MANUAL_CLEAN_TOOLS = ./tools/dumpce
632MANUAL_CLEAN_EXTRA = ./extra/scrptrun ./samples/layout ./extra/ustdio ./extra
2ca993e8 633MANUAL_CLEAN_TEST = ./test/collperf ./test/iotest ./test/letest ./test/thaitest ./test/threadtest ./test/testmap ./test
b75a7d8f
A
634MANUAL_CLEAN_SAMPLE = ./samples/layout ./samples
635
2ca993e8 636CLEAN_SUBDIR = ./stubdata ./common ./i18n ./io ./layout ./layoutex ./data ./tools ./$(MANUAL_CLEAN_TOOLS) $(MANUAL_CLEAN_EXTRA) $(MANUAL_CLEAN_TEST) $(MANUAL_CLEAN_SAMPLE)
b75a7d8f
A
637
638#################################
639# Config flags
640#################################
641
729e4ab9 642ifeq "$(WINDOWS)" "YES"
51004dcb
A
643 ifeq "$(ARCH64)" "YES"
644 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples --disable-icuio \
645 --with-data-packaging=library --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=64 \
646 $(DRAFT_FLAG)
647 else
648 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples --disable-icuio \
649 --with-data-packaging=library --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=32 \
650 $(DRAFT_FLAG)
651 endif
729e4ab9
A
652else ifeq "$(LINUX)" "YES"
653 ifeq "$(ARCH64)" "YES"
654 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
655 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=64 \
656 $(DRAFT_FLAG)
657 else
658 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
659 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) --with-library-bits=32 \
660 $(DRAFT_FLAG)
661 endif
2ca993e8
A
662else ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
663 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
729e4ab9 664 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) \
4388f060 665 $(DRAFT_FLAG)
73c04bcf 666else
729e4ab9
A
667 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-layout --disable-samples \
668 --with-data-packaging=archive --prefix=$(PRIVATE_HDR_PREFIX) \
4388f060 669 $(DRAFT_FLAG)
73c04bcf 670endif
b75a7d8f
A
671
672#################################
673# Install paths
674#################################
675
2ca993e8
A
676# This may or may not be an appropriate name for the icu dylib. This naming scheme is
677# an attempt to follow the icu convention in naming the dylib and then having symbolic
678# links of easier to remember library names point it it. *UPDATE* the version and
b75a7d8f
A
679# sub-version variables as needed. The Core version should be 'A' until the core
680# version changes it's API...that is a new version isn't backwards compatible.
681# The ICU version/subversion should reflect the actual ICU version.
682
374ca955 683LIB_NAME = icucore
f3c0d7a5 684ICU_VERS = 59
729e4ab9 685ICU_SUBVERS = 1
b75a7d8f 686CORE_VERS = A
b75a7d8f 687
73c04bcf
A
688ifeq "$(WINDOWS)" "YES"
689 DYLIB_SUFF = dll
51004dcb
A
690 ifeq "$(ARCH64)" "YES"
691 winprogdir = /Program\ Files/Common\ Files/Apple/Apple\ Application\ Support/
692 winintlibdir = /AppleInternal/lib64/
693 else
694 winprogdir = /Program\ Files\ \(x86\)/Common\ Files/Apple/Apple\ Application\ Support/
695 winintlibdir = /AppleInternal/lib32/
696 endif
697 libdir =
729e4ab9
A
698else ifeq "$(LINUX)" "YES"
699 DYLIB_SUFF = so
700 ifeq "$(ARCH64)" "YES"
701 libdir = /usr/lib64/
702 else
703 libdir = /usr/lib/
704 endif
51004dcb
A
705 winprogdir =
706 winintlibdir =
73c04bcf
A
707else
708 DYLIB_SUFF = dylib
709 libdir = /usr/lib/
51004dcb
A
710 winprogdir =
711 winintlibdir =
73c04bcf
A
712endif
713
374ca955 714DYLIB = lib$(LIB_NAME).$(DYLIB_SUFF)
73c04bcf
A
715DYLIB_DEBUG = lib$(LIB_NAME)_debug.$(DYLIB_SUFF)
716DYLIB_PROFILE = lib$(LIB_NAME)_profile.$(DYLIB_SUFF)
717ifeq "$(WINDOWS)" "YES"
718 INSTALLED_DYLIB = $(LIB_NAME).$(DYLIB_SUFF)
719 INSTALLED_DYLIB_DEBUG = $(LIB_NAME)_debug.$(DYLIB_SUFF)
720 INSTALLED_DYLIB_PROFILE = $(LIB_NAME)_profile.$(DYLIB_SUFF)
729e4ab9
A
721else ifeq "$(LINUX)" "YES"
722 INSTALLED_DYLIB = lib$(LIB_NAME).$(DYLIB_SUFF)
723 INSTALLED_DYLIB_DEBUG = lib$(LIB_NAME)_debug.$(DYLIB_SUFF)
724 INSTALLED_DYLIB_PROFILE = lib$(LIB_NAME)_profile.$(DYLIB_SUFF)
73c04bcf
A
725else
726 INSTALLED_DYLIB = lib$(LIB_NAME).$(CORE_VERS).$(DYLIB_SUFF)
727 INSTALLED_DYLIB_DEBUG = lib$(LIB_NAME).$(CORE_VERS)_debug.$(DYLIB_SUFF)
728 INSTALLED_DYLIB_PROFILE = lib$(LIB_NAME).$(CORE_VERS)_profile.$(DYLIB_SUFF)
729endif
730
731INSTALLED_DYLIB_icu = INSTALLED_DYLIB
732INSTALLED_DYLIB_debug = INSTALLED_DYLIB_DEBUG
733INSTALLED_DYLIB_profile = INSTALLED_DYLIB_PROFILE
734DYLIB_icu = DYLIB
735DYLIB_debug = DYLIB_DEBUG
736DYLIB_profile = DYLIB_PROFILE
b75a7d8f
A
737
738#################################
739# Data files
740#################################
741
374ca955
A
742OPEN_SOURCE_VERSIONS_DIR=/usr/local/OpenSourceVersions/
743OPEN_SOURCE_LICENSES_DIR=/usr/local/OpenSourceLicenses/
51004dcb 744
b75a7d8f
A
745B_DATA_FILE=icudt$(ICU_VERS)b.dat
746L_DATA_FILE=icudt$(ICU_VERS)l.dat
51004dcb
A
747DATA_BUILD_SUBDIR= data/out
748DATA_INSTALL_DIR=/usr/share/icu/
2ca993e8 749
51004dcb
A
750# DATA_LOOKUP_DIR is what the target ICU_DATA_DIR gets set to in CFLAGS, CXXFLAGS;
751# DATA_LOOKUP_DIR_BUILDHOST is what any crossbuild host ICU_DATA_DIR gets set to.
2ca993e8
A
752# Formerly we had DATA_LOOKUP_DIR=/var/db/icu/ for embedded non-simulator builds
753# and DATA_LOOKUP_DIR=/usr/share/icu/ for everything else. Now all systems look
754# in the same place for the main data file:
755DATA_LOOKUP_DIR=/usr/share/icu/
51004dcb
A
756DATA_LOOKUP_DIR_BUILDHOST=/usr/share/icu/
757
2ca993e8 758# Timezone data file(s)
f3c0d7a5 759# ICU will look for /var/db/timezone/icutz/icutz44l.dat
2ca993e8
A
760# If directory or file is not present, the timesone data in
761# current data file e.g. /usr/share/icu/icudt56l.dat will be used.
762# Currently we are not conditionalizing the definition of
763# TZDATA_LOOKUP_DIR as in
764# ifeq "$(BUILD_TYPE)" "DEVICE"
f3c0d7a5 765# TZDATA_LOOKUP_DIR = /var/db/timezone/icutz
2ca993e8
A
766# else
767# ...
768# since the code stats the path for TZDATA_LOOKUP_DIR and does
769# not try to use it if it does not exist. We could define it
770# as TZDATA_LOOKUP_DIR = /usr/share/icutz when not needed...
771# TZDATA_LOOKUP_DIR is passed to compiler as U_TIMEZONE_FILES_DIR
772# TZDATA_PACKAGE is passed to compiler as U_TIMEZONE_PACKAGE
f3c0d7a5 773TZDATA_LOOKUP_DIR = /var/db/timezone/icutz
2ca993e8
A
774TZDATA_PACKAGE = icutz44l
775TZDATA_FORMAT_STRING = "44l"
776TZDATA_FORMAT_FILE = icutzformat.txt
777
778
51004dcb
A
779# Name of runtime environment variable to get the prefix path for DATA_LOOKUP_DIR
780# Currently we are only using this for LINUX, should also use for iOS simulator
781ifeq "$(LINUX)" "YES"
782 DATA_DIR_PREFIX_ENV_VAR=APPLE_FRAMEWORKS_ROOT
783else
784 DATA_DIR_PREFIX_ENV_VAR=
785endif
b75a7d8f 786
729e4ab9 787#################################
2ca993e8 788# Tools
729e4ab9
A
789#################################
790
791localtooldir=/usr/local/bin/
2ca993e8 792locallibdir=/usr/local/lib/
729e4ab9
A
793
794INFOTOOL = icuinfo
729e4ab9
A
795INFOTOOL_OBJS = ./tools/icuinfo/icuinfo.o ./tools/toolutil/udbgutil.o ./tools/toolutil/uoptions.o
796
a62d09fc
A
797ICUZDUMPTOOL = icuzdump
798ifeq "$(ICU_FOR_EMBEDDED_TRAINS)" "YES"
799 ICUZDUMPTOOL_OBJS = ./tools/tzcode/icuzdump.o $(IO_OBJ)
800else
801 ICUZDUMPTOOL_OBJS = ./tools/tzcode/icuzdump.o
802endif
803
2ca993e8
A
804TOOLSLIB_NAME = icutu
805TOOLS_DYLIB = libicutu.$(DYLIB_SUFF)
806TOOLS_DYLIB_OBJS = ./tools/toolutil/*.o
a62d09fc
A
807
808# The following modified version enables the tz toools to be used on systems with ICU 55 or later.
809# It is used with the toolchain tools below.
810TOOLSLIB_NAME_FORTOOLS = icutux
811TOOLS_DYLIB_FORTOOLS = libicutux.$(DYLIB_SUFF)
812TOOLS_DYLIB_OBJS_FORTOOLS = ./tools/toolutil/collationinfo.o ./tools/toolutil/filestrm.o \
2ca993e8
A
813./tools/toolutil/package.o ./tools/toolutil/pkg_icu.o ./tools/toolutil/pkgitems.o \
814./tools/toolutil/swapimpl.o ./tools/toolutil/toolutil.o ./tools/toolutil/ucbuf.o \
815./tools/toolutil/unewdata.o ./tools/toolutil/uoptions.o ./tools/toolutil/uparse.o \
816$(COMMON_OBJ) $(STUB_DATA_OBJ)
817
818ZICTOOL = icuzic
819ZICTOOL_OBJS = ./tools/tzcode/zic.o ./tools/tzcode/localtime.o ./tools/tzcode/asctime.o ./tools/tzcode/scheck.o ./tools/tzcode/ialloc.o
820
821RESTOOL = icugenrb
822RESTOOL_OBJS = ./tools/genrb/errmsg.o ./tools/genrb/genrb.o ./tools/genrb/parse.o ./tools/genrb/read.o ./tools/genrb/reslist.o ./tools/genrb/ustr.o \
823 ./tools/genrb/rbutil.o ./tools/genrb/wrtjava.o ./tools/genrb/rle.o ./tools/genrb/wrtxml.o ./tools/genrb/prscmnts.o
824
825# note there is also a symbol ICUPKGTOOL which refers to the one used
826# internally which is linked against the separate uc and i18n libs.
827PKGTOOL = icupkg
828PKGTOOL_OBJS = ./tools/icupkg/icupkg.o
829
830TZ2ICUTOOL = tz2icu
831TZ2ICUTOOL_OBJS = ./tools/tzcode/tz2icu.o
832
a62d09fc
A
833GENBRKTOOL = icugenbrk
834GENBRKTOOL_OBJS = ./tools/genbrk/genbrk.o
2ca993e8 835
57a6839d 836#################################
f3c0d7a5 837# Ancillary files
57a6839d
A
838# e.g. supplementalData.xml, per <rdar://problem/13426014>
839# These are like internal headers in that they are only installed for
840# (other) projects to build against, not needed at runtime.
f3c0d7a5 841# Install during installhdrs? That does not seem to work for CLDRFILESDIR
57a6839d
A
842#################################
843
844CLDRFILESDIR=/usr/local/share/cldr
845
f3c0d7a5
A
846EMOJI_DATA_DIR=/usr/local/share/emojiData
847
374ca955
A
848#################################
849# Environment variables
850#################################
851
852# $(RC_ARCHS:%=-arch %) is a substitution reference. It denotes, in this case,
853# for every value <val> in RC_ARCHS, replace it with "-arch <val>". Substitution
854# references have the form $(var:a=b). We can insert the strip and prebinding commands
855# into CFLAGS (and CXXFLAGS). This controls a lot of the external variables so we don't
856# need to directly modify the ICU files (like for CFLAGS, etc).
857
51004dcb
A
858LIBOVERRIDES=LIBICUDT="-L$(OBJROOT_CURRENT) -l$(LIB_NAME)" \
859 LIBICUUC="-L$(OBJROOT_CURRENT) -l$(LIB_NAME)" \
860 LIBICUI18N="-L$(OBJROOT_CURRENT) -l$(LIB_NAME)"
374ca955 861
46f4442e
A
862# For normal Windows builds set the ENV= options here; for debug Windows builds set the ENV_DEBUG=
863# options here and also the update the LINK.EXE lines in the TARGETS section below.
73c04bcf 864ifeq "$(WINDOWS)" "YES"
51004dcb
A
865 ifeq "$(ARCH64)" "YES"
866 ENV= CFLAGS="/O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
867 CXXFLAGS="/O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /Zc:wchar_t" \
868 LDFLAGS="/NXCOMPAT /DYNAMICBASE /DEBUG /OPT:REF"
73c04bcf 869 else
51004dcb
A
870 ENV= CFLAGS="/O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
871 CXXFLAGS="/O2 /Ob2 /MD /GF /GS /Zi /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /Zc:wchar_t" \
872 LDFLAGS="/NXCOMPAT /SAFESEH /DYNAMICBASE /DEBUG /OPT:REF"
73c04bcf 873 endif
51004dcb
A
874 ENV_CONFIGURE= CPPFLAGS="-DU_DISABLE_RENAMING=1 $(DEFINE_BUILD_LEVEL)" \
875 CFLAGS="/O2 /Ob2 /MD /GF /GS /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
876 CXXFLAGS="/O2 /Ob2 /MD /GF /GS /nologo /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc /Zc:wchar_t"
877 ENV_DEBUG= CFLAGS="/O2 /Ob2 /MDd /GF /GS /Zi /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES" \
878 CXXFLAGS="/O2 /Ob2 /MDd /GF /GS /Zi /D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES /EHsc" \
879 LDFLAGS="/DEBUG /DYNAMICBASE"
73c04bcf 880 ENV_PROFILE=
729e4ab9 881else ifeq "$(LINUX)" "YES"
729e4ab9 882 ifeq "$(ARCH64)" "YES"
51004dcb
A
883 ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
884 CPPFLAGS="-DU_DISABLE_RENAMING=1 $(DEFINE_BUILD_LEVEL)" \
729e4ab9
A
885 CC="$(CC)" \
886 CXX="$(CXX)" \
51004dcb
A
887 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden" \
888 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 889 TZDATA="$(TZDATA)" \
2ca993e8 890 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib64"
51004dcb
A
891
892 ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
893 CC="$(CC)" \
894 CXX="$(CXX)" \
51004dcb
A
895 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden" \
896 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 897 TZDATA="$(TZDATA)" \
2ca993e8 898 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib64"
51004dcb
A
899
900 ENV_DEBUG= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
901 CC="$(CC)" \
902 CXX="$(CXX)" \
51004dcb
A
903 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -O0 -gfull -fno-exceptions -fvisibility=hidden" \
904 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -O0 -gfull -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 905 TZDATA="$(TZDATA)" \
2ca993e8
A
906 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib64"
907
51004dcb 908 ENV_PROFILE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
909 CC="$(CC)" \
910 CXX="$(CXX)" \
51004dcb
A
911 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -pg -fno-exceptions -fvisibility=hidden" \
912 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m64 -g -Os -pg -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 913 TZDATA="$(TZDATA)" \
2ca993e8 914 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib64"
729e4ab9 915 else
51004dcb
A
916 ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
917 CPPFLAGS="-DU_DISABLE_RENAMING=1 $(DEFINE_BUILD_LEVEL)" \
729e4ab9
A
918 CC="$(CC)" \
919 CXX="$(CXX)" \
51004dcb
A
920 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden" \
921 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 922 TZDATA="$(TZDATA)" \
2ca993e8
A
923 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
924
51004dcb 925 ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
926 CC="$(CC)" \
927 CXX="$(CXX)" \
51004dcb
A
928 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden" \
929 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 930 TZDATA="$(TZDATA)" \
2ca993e8
A
931 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
932
51004dcb 933 ENV_DEBUG= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
934 CC="$(CC)" \
935 CXX="$(CXX)" \
51004dcb
A
936 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -O0 -gfull -fno-exceptions -fvisibility=hidden" \
937 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -O0 -gfull -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 938 TZDATA="$(TZDATA)" \
2ca993e8
A
939 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
940
51004dcb 941 ENV_PROFILE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
942 CC="$(CC)" \
943 CXX="$(CXX)" \
51004dcb
A
944 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -pg -fno-exceptions -fvisibility=hidden" \
945 CXXFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DICU_DATA_DIR_PREFIX_ENV_VAR=\"\\\"$(DATA_DIR_PREFIX_ENV_VAR)\\\"\" -m32 -g -Os -pg -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 946 TZDATA="$(TZDATA)" \
2ca993e8 947 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
729e4ab9 948 endif
73c04bcf 949else
2ca993e8 950 CPPOPTIONS =
51004dcb
A
951 ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
952 CPPFLAGS="$(DEFINE_BUILD_LEVEL) -DSTD_INSPIRED -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) $(ISYSROOT) $(ENV_CONFIGURE_ARCHS)" \
729e4ab9
A
953 CC="$(CC)" \
954 CXX="$(CXX)" \
2ca993e8 955 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(ENV_CONFIGURE_ARCHS) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG)" \
f3c0d7a5 956 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(ENV_CONFIGURE_ARCHS) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG)" \
729e4ab9
A
957 RC_ARCHS="$(RC_ARCHS)" $(FORCEENDIAN)\
958 TZDATA="$(TZDATA)" \
2ca993e8
A
959 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
960
51004dcb 961 ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
962 CC="$(CC)" \
963 CXX="$(CXX)" \
2ca993e8 964 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG)" \
f3c0d7a5 965 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG)" \
73c04bcf
A
966 RC_ARCHS="$(RC_ARCHS)" \
967 TZDATA="$(TZDATA)" \
2ca993e8
A
968 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
969
51004dcb 970 ENV_DEBUG= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
971 CC="$(CC)" \
972 CXX="$(CXX)" \
2ca993e8 973 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -O0 -gfull -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG)" \
f3c0d7a5 974 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -O0 -gfull -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG)" \
73c04bcf
A
975 RC_ARCHS="$(RC_ARCHS)" \
976 TZDATA="$(TZDATA)" \
2ca993e8
A
977 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
978
51004dcb 979 ENV_PROFILE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
729e4ab9
A
980 CC="$(CC)" \
981 CXX="$(CXX)" \
2ca993e8 982 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -pg -Wglobal-constructors -fno-exceptions -fvisibility=hidden $(ISYSROOT) $(THUMB_FLAG)" \
f3c0d7a5 983 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_FILES_DIR=\"\\\"$(TZDATA_LOOKUP_DIR)\\\"\" -DU_TIMEZONE_PACKAGE=\"\\\"$(TZDATA_PACKAGE)\\\"\" $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -pg -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG)" \
73c04bcf
A
984 RC_ARCHS="$(RC_ARCHS)" \
985 TZDATA="$(TZDATA)" \
2ca993e8 986 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
51004dcb
A
987
988 ENV_CONFIGURE_BUILDHOST= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
989 CPPFLAGS="$(DEFINE_BUILD_LEVEL) -DSTD_INSPIRED -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) $(HOSTISYSROOT)" \
990 CC="$(HOSTCC)" \
991 CXX="$(HOSTCXX)" \
57a6839d 992 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden" \
f3c0d7a5 993 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
729e4ab9 994 TZDATA="$(TZDATA)" \
2ca993e8
A
995 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
996
51004dcb
A
997 ENV_BUILDHOST= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \
998 CC="$(HOSTCC)" \
999 CXX="$(HOSTCXX)" \
57a6839d 1000 CFLAGS="-DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden" \
f3c0d7a5 1001 CXXFLAGS="--std=c++11 -DU_SHOW_CPLUSPLUS_API=1 -DU_SHOW_INTERNAL_API=1 -DU_TIMEZONE=timezone -DICU_DATA_DIR=\"\\\"$(DATA_LOOKUP_DIR_BUILDHOST)\\\"\" -DMAC_OS_X_VERSION_MIN_REQUIRED=$(MAC_OS_X_VERSION_MIN_REQUIRED) -mmacosx-version-min=$(OSX_HOST_VERSION_MIN_STRING) $(HOSTISYSROOT) -g -Os -Wglobal-constructors -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden" \
73c04bcf 1002 TZDATA="$(TZDATA)" \
2ca993e8 1003 DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib"
729e4ab9 1004
73c04bcf 1005endif
2ca993e8 1006
374ca955
A
1007ENV_icu = ENV
1008ENV_debug = ENV_DEBUG
73c04bcf 1009ENV_profile = ENV_PROFILE
374ca955 1010
57a6839d
A
1011ifeq "$(BUILD_TYPE)" "DEVICE"
1012 ORDERFILE=$(SDKPATH)/AppleInternal/OrderFiles/libicucore.order
2ca993e8 1013else ifeq "$(BUILD_TYPE)" "SIMULATOR"
46f4442e
A
1014 ORDERFILE=$(SRCROOT)/ICU_embedded.order
1015else
1016 ORDERFILE=/usr/local/lib/OrderFiles/libicucore.order
1017endif
374ca955
A
1018ifeq "$(shell test -f $(ORDERFILE) && echo YES )" "YES"
1019 SECTORDER_FLAGS=-sectorder __TEXT __text $(ORDERFILE)
1020else
1021 SECTORDER_FLAGS=
1022endif
1023
1024
b75a7d8f
A
1025#################################
1026#################################
1027# TARGETS
1028#################################
1029#################################
374ca955 1030
2ca993e8
A
1031.PHONY : icu check installsrc installhdrs installhdrsint clean install debug debug-install \
1032crossbuildhost icutztoolsforsdk
374ca955
A
1033.DELETE_ON_ERROR :
1034
2ca993e8
A
1035# Rule for adjusting sources for different train types.
1036# Assumes current directory is icuSources to be patched.
1037# This may be:
1038# $(SRCROOT)/icuSources for installsrc, or
1039# $(OBJROOT_CURRENT) if sources are copied for e.g. a local make.
1040#
1041# The various patchconfig files should assume the current directory is icuSources.
1042#
1043# Note that if sources have been installed by installsrc (only run as part of buildit
1044# or B&I builds), then
1045# $(SRCROOT)/.git is not present, and
1046# ADJUST_SOURCES has already have been run.
1047# Otherwise, if we are doing a local build (e.g. make check, make install), then
1048# $(SRCROOT)/.git is present, and
1049# ADJUST_SOURCES has not been run (run it after copying sources to OBJROOT_CURRENT)
1050#
1051
1052ADJUST_SOURCES = \
1053 if test "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1054 patch -p1 <$(SRCROOT)/minimalpatchconfig.txt; \
1055 elif test "$(WINDOWS)" = "YES"; then \
1056 patch -p1 <$(SRCROOT)/windowspatchconfig.txt; \
1057 else \
1058 patch -p1 <$(SRCROOT)/patchconfig.txt; \
1059 fi; \
1060 if test "$(WINDOWS)" = "YES"; then \
1061 mv data/unidata/base_unidata/*.txt data/unidata/; \
1062 mv data/unidata/norm2/base_norm2/*.txt data/unidata/norm2/; \
1063 mv data/in/base_in/*.nrm data/in/; \
1064 mv data/in/base_in/*.icu data/in/; \
1065 elif test "$(LINUX)" = "YES"; then \
1066 mv data/unidata/base_unidata/*.txt data/unidata/; \
1067 mv data/unidata/norm2/base_norm2/*.txt data/unidata/norm2/; \
1068 mv data/in/base_in/*.nrm data/in/; \
1069 mv data/in/base_in/*.icu data/in/; \
1070 fi
1071
1072
51004dcb
A
1073icu debug profile : $(OBJROOT_CURRENT)/Makefile
1074 echo "# make for target";
1075 (cd $(OBJROOT_CURRENT); \
374ca955 1076 $(MAKE) $($(ENV_$@)); \
73c04bcf 1077 if test "$(WINDOWS)" = "YES"; then \
729e4ab9
A
1078 (cd common; \
1079 rc.exe /folibicuuc.res $(CPPFLAGS) -DU_RELEASE=1 -D_CRT_SECURE_NO_DEPRECATE -I. -I../i18n \
1080 "-DDEFAULT_ICU_PLUGINS=\"/AppleInternal/lib/icu\" " -DU_LOCAL_SERVICE_HOOK=1 libicuuc.rc; \
1081 ); \
1082 (cd i18n; \
1083 rc.exe /folibicuin.res $(CPPFLAGS) -DU_RELEASE=1 -D_CRT_SECURE_NO_DEPRECATE -I. -I../common libicuin.rc; \
1084 ); \
73c04bcf
A
1085 if test "$@" = "debug"; then \
1086 (cd common; \
729e4ab9
A
1087 LINK.EXE /subsystem:console /DLL /nologo /base:"0x4a800000" /DYNAMICBASE /DEBUG \
1088 /IMPLIB:../lib/libicuuc_$@.lib /out:../lib/libicuuc_$@.dll \
1089 *.o libicuuc.res ../stubdata/icudt.lib advapi32.lib; \
1090 ); \
73c04bcf 1091 (cd i18n; \
729e4ab9
A
1092 LINK.EXE /subsystem:console /DLL /nologo /base:"0x4a900000" /DYNAMICBASE /DEBUG \
1093 /IMPLIB:../lib/libicuin_$@.lib /out:../lib/libicuin_$@.dll \
1094 *.o libicuin.res ../lib/libicuuc_$@.lib ../stubdata/icudt.lib advapi32.lib; \
1095 ); \
1096 else \
729e4ab9 1097 (cd common; \
729e4ab9 1098 rm -f ../lib/libicuuc.dll.manifest; \
51004dcb
A
1099 if test "$(ARCH64)" = "YES"; then \
1100 LINK.EXE /DLL /NXCOMPAT /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1101 /IMPLIB:../lib/libicuuc.lib /out:../lib/libicuuc.dll \
1102 *.o libicuuc.res ../stubdata/icudt.lib advapi32.lib; \
1103 else \
1104 LINK.EXE /DLL /NXCOMPAT /SAFESEH /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1105 /IMPLIB:../lib/libicuuc.lib /out:../lib/libicuuc.dll \
1106 *.o libicuuc.res ../stubdata/icudt.lib advapi32.lib; \
1107 fi; \
729e4ab9 1108 mt.exe -nologo -manifest ../lib/libicuuc.dll.manifest -outputresource:"../lib/libicuuc.dll;2"; \
729e4ab9
A
1109 ); \
1110 (cd i18n; \
729e4ab9 1111 rm -f ../lib/libicuin.dll.manifest; \
51004dcb
A
1112 if test "$(ARCH64)" = "YES"; then \
1113 LINK.EXE /DLL /NXCOMPAT /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1114 /IMPLIB:../lib/libicuin.lib /out:../lib/libicuin.dll \
1115 *.o libicuin.res ../lib/libicuuc.lib ../stubdata/icudt.lib advapi32.lib; \
1116 else \
1117 LINK.EXE /DLL /NXCOMPAT /SAFESEH /DYNAMICBASE /DEBUG /OPT:REF /MANIFEST \
1118 /IMPLIB:../lib/libicuin.lib /out:../lib/libicuin.dll \
1119 *.o libicuin.res ../lib/libicuuc.lib ../stubdata/icudt.lib advapi32.lib; \
1120 fi; \
729e4ab9 1121 mt.exe -nologo -manifest ../lib/libicuin.dll.manifest -outputresource:"../lib/libicuin.dll;2"; \
729e4ab9 1122 ); \
73c04bcf 1123 fi; \
374ca955 1124 else \
729e4ab9
A
1125 if test "$(LINUX)" = "YES"; then \
1126 if test "$(ARCH64)" = "YES"; then \
1127 $($(ENV_$@)) $(CXX) \
1128 -m64 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden \
1129 $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname,$($(INSTALLED_DYLIB_$@)) -Wl,-L/usr/lib64/ -ldl \
1130 -o ./$($(INSTALLED_DYLIB_$@)) $(DYLIB_OBJS); \
1131 else \
1132 $($(ENV_$@)) $(CXX) \
1133 -m32 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden \
1134 $(CXXFLAGS) $(LDFLAGS) -shared -Wl,-Bsymbolic -Wl,-soname,$($(INSTALLED_DYLIB_$@)) -ldl \
1135 -o ./$($(INSTALLED_DYLIB_$@)) $(DYLIB_OBJS); \
1136 fi; \
1137 else \
1138 tmpfile=`mktemp -t weakexternal.XXXXXX` || exit 1; \
4388f060 1139 $(NM) -m $(RC_ARCHS:%=-arch %) $(DYLIB_OBJS) | fgrep "weak external" | fgrep -v "undefined" | sed -e 's/.*weak external[^_]*//' | sort | uniq | cat >$$tmpfile; \
729e4ab9 1140 $($(ENV_$@)) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic \
4388f060 1141 $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) \
729e4ab9
A
1142 $(CXXFLAGS) $(LDFLAGS) -single_module $(SECTORDER_FLAGS) -unexported_symbols_list $$tmpfile -dead_strip \
1143 -install_name $(libdir)$($(INSTALLED_DYLIB_$@)) -o ./$($(INSTALLED_DYLIB_$@)) $(DYLIB_OBJS); \
1144 if test "$@" = "icu"; then \
1145 ln -fs $(INSTALLED_DYLIB) $(DYLIB); \
2ca993e8 1146 echo '# build' $(INFOTOOL) 'linked against' $(LIB_NAME) ; \
f3c0d7a5 1147 $($(ENV_$@)) $(CXX) --std=c++11 $(RC_ARCHS:%=-arch %) -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) \
57a6839d 1148 $(LDFLAGS) -dead_strip -o ./$(INFOTOOL) $(INFOTOOL_OBJS) -L./ -l$(LIB_NAME) ; \
2ca993e8
A
1149 echo '# build' $(TOOLS_DYLIB) 'linked against' $(LIB_NAME) ; \
1150 $($(ENV_$@)) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic \
1151 $(RC_ARCHS:%=-arch %) $(ICU_TARGET_VERSION) -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) $(THUMB_FLAG) \
1152 $(CXXFLAGS) $(LDFLAGS) -single_module \
1153 -install_name $(locallibdir)$(TOOLS_DYLIB) -o ./$(TOOLS_DYLIB) $(TOOLS_DYLIB_OBJS) -L./ -l$(LIB_NAME) ; \
1154 echo '# build' $(ICUZDUMPTOOL) 'linked against' $(TOOLSLIB_NAME) $(LIB_NAME) ; \
f3c0d7a5 1155 $($(ENV_$@)) $(LINK.cc) $(RC_ARCHS:%=-arch %) -g -Os $(ISYSROOT) $(THUMB_FLAG) --std=c++11 \
2ca993e8 1156 -dead_strip -o ./$(ICUZDUMPTOOL) $(ICUZDUMPTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME) -l$(LIB_NAME); \
729e4ab9
A
1157 fi; \
1158 fi; \
51004dcb
A
1159 if test -f ./$(DATA_BUILD_SUBDIR)/$(B_DATA_FILE); then \
1160 ln -fs ./$(DATA_BUILD_SUBDIR)/$(B_DATA_FILE); \
73c04bcf 1161 fi; \
51004dcb
A
1162 if test -f ./$(DATA_BUILD_SUBDIR)/$(L_DATA_FILE); then \
1163 ln -fs ./$(DATA_BUILD_SUBDIR)/$(L_DATA_FILE); \
73c04bcf 1164 else \
729e4ab9 1165 DYLD_LIBRARY_PATH=$(ICUPKGTOOLIBS) \
51004dcb 1166 $(ICUPKGTOOL) -tl ./$(DATA_BUILD_SUBDIR)/$(B_DATA_FILE) $(L_DATA_FILE); \
73c04bcf 1167 fi; \
2ca993e8 1168 printf $(TZDATA_FORMAT_STRING) > $(TZDATA_FORMAT_FILE); \
374ca955
A
1169 fi; \
1170 );
1171
729e4ab9 1172crossbuildhost : $(CROSSHOST_OBJROOT)/Makefile
51004dcb 1173 echo "# make for crossbuild host";
729e4ab9
A
1174 (cd $(CROSSHOST_OBJROOT); \
1175 $(MAKE) $($(ENV_BUILDHOST)); \
1176 );
1177
2ca993e8 1178# For the install-icutztoolsforsdk target, SDKROOT will always be an OSX SDK root.
a62d09fc 1179# If the sources were installed using the minimalpatchconfig.txt patch, then
2ca993e8 1180# we need to patch using crosshostpatchconfig.txt as for $(CROSSHOST_OBJROOT)/Makefile
a62d09fc 1181# (otherwise we ignore the patch in crosshostpatchconfig.txt, using -N)
2ca993e8
A
1182icutztoolsforsdk : $(OBJROOT_CURRENT)/Makefile
1183 echo "# make icutztoolsforsdk";
1184 (cd $(OBJROOT_CURRENT); \
a62d09fc 1185 if test ! -d $(SRCROOT)/.git ; then patch -N -p1 <$(SRCROOT)/crosshostpatchconfig.txt; fi; \
2ca993e8 1186 $(MAKE) $($(ENV)); \
a62d09fc 1187 echo '# build' $(TOOLS_DYLIB_FORTOOLS) 'linked against' $(LIB_NAME) ; \
2ca993e8
A
1188 $($(ENV)) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic \
1189 -g -Os -fno-exceptions -fvisibility=hidden -fvisibility-inlines-hidden $(ISYSROOT) \
1190 $(CXXFLAGS) $(LDFLAGS) -single_module \
a62d09fc
A
1191 -install_name $(locallibdir)$(TOOLS_DYLIB_FORTOOLS) -o ./$(TOOLS_DYLIB_FORTOOLS) $(TOOLS_DYLIB_OBJS_FORTOOLS) -L./ -l$(LIB_NAME) ; \
1192 echo '# build' $(ZICTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
f3c0d7a5 1193 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
a62d09fc
A
1194 $(LDFLAGS) -dead_strip -o ./$(ZICTOOL) $(ZICTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1195 echo '# build' $(RESTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) $(LIB_NAME) ; \
f3c0d7a5 1196 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
a62d09fc
A
1197 $(LDFLAGS) -dead_strip -o ./$(RESTOOL) $(RESTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) -l$(LIB_NAME) ; \
1198 echo '# build' $(PKGTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
f3c0d7a5 1199 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
a62d09fc
A
1200 $(LDFLAGS) -dead_strip -o ./$(PKGTOOL) $(PKGTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1201 echo '# build' $(TZ2ICUTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
f3c0d7a5 1202 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
a62d09fc
A
1203 $(LDFLAGS) -dead_strip -o ./$(TZ2ICUTOOL) $(TZ2ICUTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
1204 echo '# build' $(GENBRKTOOL) 'linked against' $(TOOLSLIB_NAME_FORTOOLS) ; \
f3c0d7a5 1205 $($(ENV_BUILDHOST)) $(CXX) --std=c++11 -g -Os -isysroot $(HOSTSDKPATH) \
a62d09fc 1206 $(LDFLAGS) -dead_strip -o ./$(GENBRKTOOL) $(GENBRKTOOL_OBJS) -L./ -l$(TOOLSLIB_NAME_FORTOOLS) ; \
2ca993e8
A
1207 );
1208
374ca955 1209check : icu
729e4ab9 1210ifneq "$(CROSS_BUILD)" "YES"
51004dcb
A
1211 (cd $(OBJROOT_CURRENT); \
1212 ICU_DATA=$(OBJROOT_CURRENT) $(MAKE) $(ENV) check; \
73c04bcf 1213 );
729e4ab9
A
1214else
1215 $(warning check not supported for cross-build)
1216endif
73c04bcf
A
1217
1218check-debug: debug
729e4ab9 1219ifneq "$(CROSS_BUILD)" "YES"
51004dcb
A
1220 (cd $(OBJROOT_CURRENT); \
1221 ICU_DATA=$(OBJROOT_CURRENT) $(MAKE) $(ENV_DEBUG) check; \
374ca955 1222 );
729e4ab9
A
1223else
1224 $(warning check not supported for cross-build)
1225endif
374ca955
A
1226
1227samples: icu
51004dcb 1228 (cd $(OBJROOT_CURRENT)/samples; \
374ca955
A
1229 $(MAKE) $(ENV_DEBUG) $(LIBOVERRIDES); \
1230 );
1231
1232extra: icu
51004dcb 1233 (cd $(OBJROOT_CURRENT)/extra; \
374ca955
A
1234 $(MAKE) $(ENV_DEBUG) $(LIBOVERRIDES); \
1235 );
1236
729e4ab9 1237ifneq "$(CROSS_BUILD)" "YES"
2ca993e8 1238$(OBJROOT_CURRENT)/Makefile :
729e4ab9 1239else
51004dcb 1240$(OBJROOT_CURRENT)/Makefile : crossbuildhost
729e4ab9 1241endif
51004dcb
A
1242 if test ! -d $(OBJROOT_CURRENT); then \
1243 mkdir -p $(OBJROOT_CURRENT); \
374ca955 1244 fi;
51004dcb 1245 cp -Rpf $(SRCROOT)/icuSources/* $(OBJROOT_CURRENT)/;
2ca993e8
A
1246 (cd $(OBJROOT_CURRENT); \
1247 if test -d $(SRCROOT)/.git ; then $(ADJUST_SOURCES); fi; \
f3c0d7a5
A
1248 if test -f $(TZAUXFILESDIR)/metaZones.txt ; then cp -p $(TZAUXFILESDIR)/metaZones.txt data/misc/; fi; \
1249 if test -f $(TZAUXFILESDIR)/timezoneTypes.txt ; then cp -p $(TZAUXFILESDIR)/timezoneTypes.txt data/misc/; fi; \
1250 if test -f $(TZAUXFILESDIR)/windowsZones.txt ; then cp -p $(TZAUXFILESDIR)/windowsZones.txt data/misc/; fi; \
1251 if test -f $(TZAUXFILESDIR)/icuregions ; then cp -p $(TZAUXFILESDIR)/icuregions tools/tzcode/; fi; \
1252 if test -f $(TZAUXFILESDIR)/icuzones ; then cp -p $(TZAUXFILESDIR)/icuzones tools/tzcode/; fi; \
2ca993e8
A
1253 if test "$(WINDOWS)" = "YES"; then \
1254 echo "# configure for target"; \
1255 $(ENV_CONFIGURE) ./runConfigureICU Cygwin/MSVC $(CONFIG_FLAGS); \
1256 elif test "$(LINUX)" = "YES"; then \
1257 echo "# configure for target"; \
1258 $(ENV_CONFIGURE) ./runConfigureICU Linux $(CONFIG_FLAGS); \
1259 elif test "$(CROSS_BUILD)" = "YES"; then \
1260 echo "# configure for crossbuild target"; \
1261 $(ENV_CONFIGURE) ./configure --host=$(TARGET_SPEC) --with-cross-build=$(CROSSHOST_OBJROOT) $(CONFIG_FLAGS); \
1262 else \
1263 echo "# configure for non-crossbuild target"; \
1264 $(ENV_CONFIGURE) ./runConfigureICU MacOSX $(CONFIG_FLAGS); \
1265 fi; \
1266 );
729e4ab9
A
1267
1268# for the tools that build the data file, cannot set UDATA_DEFAULT_ACCESS = UDATA_ONLY_PACKAGES
2ca993e8
A
1269# as minimalpatchconfig.txt does; need different patches for the host build. Thus
1270# we have to use crosshostpatchconfig.txt to undo the udata.h changes that would have
1271# been made for ICU_FOR_EMBEDDED_TRAINS builds.
1272$(CROSSHOST_OBJROOT)/Makefile :
729e4ab9
A
1273 if test ! -d $(CROSSHOST_OBJROOT); then \
1274 mkdir -p $(CROSSHOST_OBJROOT); \
1275 fi;
4388f060 1276 cp -Rpf $(SRCROOT)/icuSources/* $(CROSSHOST_OBJROOT);
2ca993e8
A
1277 (cd $(CROSSHOST_OBJROOT); \
1278 if test -d $(SRCROOT)/.git; then $(ADJUST_SOURCES); fi; \
f3c0d7a5
A
1279 if test -f $(TZAUXFILESDIR)/metaZones.txt ; then cp -p $(TZAUXFILESDIR)/metaZones.txt data/misc/; fi; \
1280 if test -f $(TZAUXFILESDIR)/timezoneTypes.txt ; then cp -p $(TZAUXFILESDIR)/timezoneTypes.txt data/misc/; fi; \
1281 if test -f $(TZAUXFILESDIR)/windowsZones.txt ; then cp -p $(TZAUXFILESDIR)/windowsZones.txt data/misc/; fi; \
1282 if test -f $(TZAUXFILESDIR)/icuregions ; then cp -p $(TZAUXFILESDIR)/icuregions tools/tzcode/; fi; \
1283 if test -f $(TZAUXFILESDIR)/icuzones ; then cp -p $(TZAUXFILESDIR)/icuzones tools/tzcode/; fi; \
2ca993e8
A
1284 if test "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1285 patch -p1 <$(SRCROOT)/crosshostpatchconfig.txt; \
1286 fi; \
1287 echo "# configure for crossbuild host"; \
1288 $(ENV_CONFIGURE_BUILDHOST) ./runConfigureICU MacOSX $(CONFIG_FLAGS); \
1289 );
374ca955
A
1290
1291#################################
1292# B&I TARGETS
1293#################################
1294
2ca993e8 1295# Since our sources are in icuSources (ignore the ICU subdirectory for now), we wish to
b75a7d8f 1296# copy them to somewhere else. We tar it to stdout, cd to the appropriate directory, and
2ca993e8 1297# untar from stdin. We then look for all the CVS directories and remove them. We may have
b75a7d8f
A
1298# to remove the .cvsignore files also.
1299
1300installsrc :
1301 if test ! -d $(SRCROOT); then mkdir $(SRCROOT); fi;
1302 if test -d $(SRCROOT)/icuSources ; then rm -rf $(SRCROOT)/icuSources; fi;
f3c0d7a5 1303 tar cf - ./makefile ./ICU.plist ./LICENSE ./icuSources ./cldrFiles ./emojiData $(INSTALLSRC_VARFILES) | (cd $(SRCROOT) ; tar xfp -); \
2ca993e8 1304 (cd $(SRCROOT)/icuSources; $(ADJUST_SOURCES) );
b75a7d8f 1305
2ca993e8
A
1306# This works. Just not for ~ in the DSTROOT. We run configure first (in case it hasn't
1307# been already). Then we make the install-headers target on specific makefiles (since
b75a7d8f
A
1308# not every subdirectory/sub-component has a install-headers target).
1309
2ca993e8
A
1310# installhdrs should be no-op for BUILD_TYPE=TOOL
1311ifeq "$(BUILD_TYPE)" "TOOL"
46f4442e
A
1312installhdrs :
1313else
1314installhdrs : installhdrsint
1315endif
2ca993e8
A
1316
1317MKINSTALLDIRS=$(SHELL) $(SRCROOT)/icuSources/mkinstalldirs
1318INSTALL_DATA=${INSTALL} -m 644
1319
1320ifeq "$(RC_XBS)" "YES"
1321installhdrsint :
1322else
51004dcb 1323installhdrsint : $(OBJROOT_CURRENT)/Makefile
2ca993e8
A
1324endif
1325 (if test -d $(SRCROOT)/.git; then cd $(OBJROOT_CURRENT); else cd $(SRCROOT)/icuSources/; fi; \
1326 $(MKINSTALLDIRS) $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/; \
73c04bcf 1327 for subdir in $(HDR_MAKE_SUBDIR); do \
2ca993e8
A
1328 echo "# Subdir $$subdir"; \
1329 (cd $$subdir/unicode; \
1330 for i in *.h; do \
1331 echo "$(INSTALL_DATA) $$i $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/"; \
1332 $(INSTALL_DATA) $$i $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/ || exit; \
1333 done; \
1334 ); \
73c04bcf 1335 done; \
2ca993e8
A
1336 if test "$(ICU_FOR_EMBEDDED_TRAINS)" = "YES"; then \
1337 if test ! -d $(DSTROOT)/$(HDR_PREFIX)/include/unicode/; then \
1338 $(INSTALL) -d -m 0755 $(DSTROOT)/$(HDR_PREFIX)/include/unicode/; \
729e4ab9 1339 fi; \
2ca993e8
A
1340 if test -d $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode/; then \
1341 (cd $(DSTROOT)/$(PRIVATE_HDR_PREFIX)/include/unicode; \
729e4ab9
A
1342 for i in *.h; do \
1343 if fgrep -q -x $$i $(SRCROOT)/minimalapis.txt ; then \
2ca993e8 1344 mv $$i $(DSTROOT)/$(HDR_PREFIX)/include/unicode ; \
729e4ab9
A
1345 fi ; \
1346 done ); \
2ca993e8
A
1347 if test ! "$(RC_XBS)" = "YES"; then \
1348 echo "# Not building for XBS, so running minimal test"; \
1349 $(CC) $(SRCROOT)/minimalapisTest.c $(INSTALLHDRS_ARCH) $(ISYSROOT) -nostdinc \
1350 -I $(DSTROOT)/$(HDR_PREFIX)/include/ -I $(SDKPATH)/usr/include/ -E > /dev/null ; \
1351 fi; \
57a6839d 1352 fi; \
729e4ab9 1353 fi; \
73c04bcf 1354 );
374ca955 1355
2ca993e8
A
1356# We run configure and run make first. This generates the .o files. We then link them
1357# all up together into libicucore. Then we put it into its install location, create
1358# symbolic links, and then strip the main dylib. Then install the remaining libraries.
b75a7d8f 1359# We cleanup the sources folder.
73c04bcf 1360
46f4442e 1361install : installhdrsint icu
73c04bcf 1362 if test "$(WINDOWS)" = "YES"; then \
2ca993e8
A
1363 if test ! -d $(DSTROOT)/$(winprogdir)/; then \
1364 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winprogdir)/; \
51004dcb 1365 fi; \
2ca993e8
A
1366 if test ! -d $(DSTROOT)/$(winintlibdir)/; then \
1367 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winintlibdir)/; \
51004dcb 1368 fi; \
2ca993e8
A
1369 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc.lib $(DSTROOT)/$(winintlibdir)libicuuc.lib; \
1370 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc.pdb $(DSTROOT)/$(winprogdir)libicuuc.pdb; \
1371 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuuc.dll $(DSTROOT)/$(winprogdir)libicuuc.dll; \
1372 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin.lib $(DSTROOT)/$(winintlibdir)libicuin.lib; \
1373 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin.pdb $(DSTROOT)/$(winprogdir)libicuin.pdb; \
1374 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuin.dll $(DSTROOT)/$(winprogdir)libicuin.dll; \
1375 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/icudt$(ICU_VERS).dll $(DSTROOT)/$(winprogdir)icudt$(ICU_VERS).dll; \
73c04bcf 1376 else \
2ca993e8
A
1377 if test ! -d $(DSTROOT)/$(libdir)/; then \
1378 $(INSTALL) -d -m 0755 $(DSTROOT)/$(libdir)/; \
51004dcb 1379 fi; \
2ca993e8 1380 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(INSTALLED_DYLIB) $(DSTROOT)/$(libdir)$(INSTALLED_DYLIB); \
729e4ab9 1381 if test "$(LINUX)" = "YES"; then \
51004dcb 1382 cp $(OBJROOT_CURRENT)/$(INSTALLED_DYLIB) $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB); \
2ca993e8 1383 strip -x -S $(DSTROOT)/$(libdir)$(INSTALLED_DYLIB); \
729e4ab9 1384 else \
2ca993e8 1385 (cd $(DSTROOT)/$(libdir); \
729e4ab9 1386 ln -fs $(INSTALLED_DYLIB) $(DYLIB)); \
51004dcb 1387 cp $(OBJROOT_CURRENT)/$(INSTALLED_DYLIB) $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB); \
2ca993e8
A
1388 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(INSTALLED_DYLIB); \
1389 $(STRIPCMD) -x -u -r -S $(DSTROOT)/$(libdir)$(INSTALLED_DYLIB); \
51004dcb 1390 fi; \
73c04bcf 1391 for subdir in $(EXTRA_LIBS); do \
2ca993e8 1392 (cd $(OBJROOT_CURRENT)/$$subdir; $(MAKE) -e DESTDIR=$(DSTROOT)/ $(ENV) install-library;) \
73c04bcf 1393 done; \
2ca993e8
A
1394 if test ! -d $(DSTROOT)/$(DATA_INSTALL_DIR)/; then \
1395 $(INSTALL) -d -m 0755 $(DSTROOT)/$(DATA_INSTALL_DIR)/; \
51004dcb
A
1396 fi; \
1397 if test -f $(OBJROOT_CURRENT)/$(L_DATA_FILE); then \
2ca993e8
A
1398 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/$(L_DATA_FILE) $(DSTROOT)/$(DATA_INSTALL_DIR)$(L_DATA_FILE); \
1399 fi; \
1400 if test -f $(OBJROOT_CURRENT)/$(TZDATA_FORMAT_FILE); then \
1401 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/$(TZDATA_FORMAT_FILE) $(DSTROOT)/$(DATA_INSTALL_DIR)$(TZDATA_FORMAT_FILE); \
73c04bcf 1402 fi; \
2ca993e8
A
1403 if test ! -d $(DSTROOT)/$(OPEN_SOURCE_VERSIONS_DIR)/; then \
1404 $(INSTALL) -d -m 0755 $(DSTROOT)/$(OPEN_SOURCE_VERSIONS_DIR)/; \
73c04bcf 1405 fi; \
2ca993e8
A
1406 $(INSTALL) -b -m 0644 $(SRCROOT)/ICU.plist $(DSTROOT)/$(OPEN_SOURCE_VERSIONS_DIR)ICU.plist; \
1407 if test ! -d $(DSTROOT)/$(OPEN_SOURCE_LICENSES_DIR)/; then \
1408 $(INSTALL) -d -m 0755 $(DSTROOT)/$(OPEN_SOURCE_LICENSES_DIR)/; \
73c04bcf 1409 fi; \
2ca993e8 1410 $(INSTALL) -b -m 0644 $(SRCROOT)/LICENSE $(DSTROOT)/$(OPEN_SOURCE_LICENSES_DIR)ICU.txt; \
f3c0d7a5
A
1411 if test ! -d $(DSTROOT)/$(CLDRFILESDIR)/; then \
1412 $(INSTALL) -d -m 0755 $(DSTROOT)/$(CLDRFILESDIR)/; \
1413 fi; \
1414 $(INSTALL) -b -m 0644 $(SRCROOT)/cldrFiles/supplementalData.xml $(DSTROOT)/$(CLDRFILESDIR)/supplementalData.xml; \
1415 $(INSTALL) -b -m 0644 $(SRCROOT)/cldrFiles/plurals.xml $(DSTROOT)/$(CLDRFILESDIR)/plurals.xml; \
1416 if test ! -d $(DSTROOT)/$(EMOJI_DATA_DIR)/; then \
1417 $(INSTALL) -d -m 0755 $(DSTROOT)/$(EMOJI_DATA_DIR)/; \
1418 fi; \
1419 $(INSTALL) -b -m 0644 $(SRCROOT)/emojiData/charClasses.txt $(DSTROOT)/$(EMOJI_DATA_DIR)/charClasses.txt; \
1420 $(INSTALL) -b -m 0644 $(SRCROOT)/emojiData/lineClasses.txt $(DSTROOT)/$(EMOJI_DATA_DIR)/lineClasses.txt; \
2ca993e8
A
1421 if test "$(LINUX)" != "YES"; then \
1422 if test ! -d $(DSTROOT)/$(localtooldir)/; then \
1423 $(INSTALL) -d -m 0755 $(DSTROOT)/$(localtooldir)/; \
51004dcb 1424 fi; \
2ca993e8
A
1425 if test -f $(OBJROOT_CURRENT)/$(INFOTOOL); then \
1426 echo '# install' $(INFOTOOL) 'to' $(DSTROOT)/$(localtooldir)$(INFOTOOL) ; \
1427 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(INFOTOOL) $(DSTROOT)/$(localtooldir)$(INFOTOOL); \
57a6839d 1428 cp $(OBJROOT_CURRENT)/$(INFOTOOL) $(SYMROOT_CURRENT)/$(INFOTOOL); \
2ca993e8
A
1429 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(INFOTOOL)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(INFOTOOL); \
1430 fi; \
1431 if test ! -d $(DSTROOT)/$(locallibdir)/; then \
1432 $(INSTALL) -d -m 0755 $(DSTROOT)/$(locallibdir)/; \
1433 fi; \
1434 if test -f $(OBJROOT_CURRENT)/$(TOOLS_DYLIB); then \
1435 echo '# install' $(TOOLS_DYLIB) 'to' $(DSTROOT)/$(locallibdir)$(TOOLS_DYLIB) ; \
1436 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(TOOLS_DYLIB) $(DSTROOT)/$(locallibdir)$(TOOLS_DYLIB); \
1437 cp $(OBJROOT_CURRENT)/$(TOOLS_DYLIB) $(SYMROOT_CURRENT)/$(TOOLS_DYLIB); \
1438 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(TOOLS_DYLIB)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(TOOLS_DYLIB); \
1439 fi; \
1440 if test -f $(OBJROOT_CURRENT)/$(ICUZDUMPTOOL); then \
1441 echo '# install' $(ICUZDUMPTOOL) 'to' $(DSTROOT)/$(localtooldir)$(ICUZDUMPTOOL) ; \
1442 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(ICUZDUMPTOOL) $(DSTROOT)/$(localtooldir)$(ICUZDUMPTOOL); \
1443 cp $(OBJROOT_CURRENT)/$(ICUZDUMPTOOL) $(SYMROOT_CURRENT)/$(ICUZDUMPTOOL); \
1444 $(DSYMTOOL) -o $(SYMROOT_CURRENT)/$(ICUZDUMPTOOL)$(DSYMSUFFIX) $(SYMROOT_CURRENT)/$(ICUZDUMPTOOL); \
57a6839d 1445 fi; \
729e4ab9 1446 fi; \
b75a7d8f 1447 fi;
73c04bcf
A
1448
1449DEPEND_install_debug = debug
1450DEPEND_install_profile = profile
2ca993e8 1451
73c04bcf
A
1452.SECONDEXPANSION:
1453install_debug install_profile : $$(DEPEND_$$@)
73c04bcf 1454 if test "$(WINDOWS)" = "YES"; then \
2ca993e8
A
1455 if test ! -d $(DSTROOT)/$(winprogdir)/; then \
1456 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winprogdir)/; \
73c04bcf 1457 fi; \
2ca993e8
A
1458 if test ! -d $(DSTROOT)/$(winintlibdir)/; then \
1459 $(INSTALL) -d -m 0755 $(DSTROOT)/$(winintlibdir)/; \
51004dcb 1460 fi; \
2ca993e8
A
1461 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc_$(DEPEND_$@).lib $(DSTROOT)/$(winintlibdir)libicuuc_$(DEPEND_$@).lib; \
1462 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuuc_$(DEPEND_$@).pdb $(DSTROOT)/$(winprogdir)libicuuc_$(DEPEND_$@).pdb; \
1463 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuuc_$(DEPEND_$@).dll $(DSTROOT)/$(winprogdir)libicuuc_$(DEPEND_$@).dll; \
1464 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin_$(DEPEND_$@).lib $(DSTROOT)/$(winintlibdir)libicuin_$(DEPEND_$@).lib; \
1465 $(INSTALL) -b -m 0644 $(OBJROOT_CURRENT)/lib/libicuin_$(DEPEND_$@).pdb $(DSTROOT)/$(winprogdir)libicuin_$(DEPEND_$@).pdb; \
1466 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/lib/libicuin_$(DEPEND_$@).dll $(DSTROOT)/$(winprogdir)libicuin_$(DEPEND_$@).dll; \
73c04bcf 1467 else \
2ca993e8
A
1468 if test ! -d $(DSTROOT)/$(libdir)/; then \
1469 $(INSTALL) -d -m 0755 $(DSTROOT)/$(libdir)/; \
51004dcb 1470 fi; \
2ca993e8 1471 $(INSTALL) -b -m 0664 $(OBJROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))) $(DSTROOT)/$(libdir)$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
729e4ab9 1472 if test "$(LINUX)" = "YES"; then \
51004dcb 1473 cp $(OBJROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))) $(SYMROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
2ca993e8 1474 strip -x -S $(DSTROOT)/$(libdir)$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
729e4ab9 1475 else \
2ca993e8 1476 (cd $(DSTROOT)/$(libdir); \
729e4ab9 1477 ln -fs $($(INSTALLED_DYLIB_$(DEPEND_$@))) $($(DYLIB_$(DEPEND_$@)))); \
51004dcb 1478 cp $(OBJROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))) $(SYMROOT_CURRENT)/$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
2ca993e8 1479 $(STRIPCMD) -x -u -r -S $(DSTROOT)/$(libdir)$($(INSTALLED_DYLIB_$(DEPEND_$@))); \
51004dcb 1480 fi; \
73c04bcf 1481 for subdir in $(EXTRA_LIBS); do \
2ca993e8 1482 (cd $(OBJROOT_CURRENT)/$$subdir; $(MAKE) -e DESTDIR=$(DSTROOT)/ $(ENV) install-library;) \
73c04bcf 1483 done; \
b75a7d8f 1484 fi;
b75a7d8f 1485
374ca955
A
1486clean :
1487 -rm -rf $(OBJROOT)
73c04bcf 1488
2ca993e8
A
1489# For the install-icutztoolsforsdk target, SDKROOT will always be an OSX SDK root
1490install-icutztoolsforsdk : icutztoolsforsdk
1491 if test ! -d $(DSTROOT)$(localtooldir)/; then \
1492 $(INSTALL) -d -m 0755 $(DSTROOT)$(localtooldir)/; \
1493 fi;
1494 if test ! -d $(DSTROOT)$(locallibdir)/; then \
1495 $(INSTALL) -d -m 0755 $(DSTROOT)$(locallibdir)/; \
1496 fi;
a62d09fc
A
1497 if test -f $(OBJROOT_CURRENT)/$(TOOLS_DYLIB_FORTOOLS); then \
1498 echo '# install' $(TOOLS_DYLIB_FORTOOLS) 'to' $(DSTROOT)$(locallibdir)$(TOOLS_DYLIB_FORTOOLS) ; \
1499 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(TOOLS_DYLIB_FORTOOLS) $(DSTROOT)$(locallibdir)$(TOOLS_DYLIB_FORTOOLS); \
2ca993e8
A
1500 fi;
1501 if test -f $(OBJROOT_CURRENT)/$(ZICTOOL); then \
1502 echo '# install' $(ZICTOOL) 'to' $(DSTROOT)$(localtooldir)$(ZICTOOL) ; \
1503 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(ZICTOOL) $(DSTROOT)$(localtooldir)$(ZICTOOL); \
1504 fi;
1505 if test -f $(OBJROOT_CURRENT)/$(RESTOOL); then \
1506 echo '# install' $(RESTOOL) 'to' $(DSTROOT)$(localtooldir)$(RESTOOL) ; \
1507 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(RESTOOL) $(DSTROOT)$(localtooldir)$(RESTOOL); \
1508 fi;
1509 if test -f $(OBJROOT_CURRENT)/$(PKGTOOL); then \
1510 echo '# install' $(PKGTOOL) 'to' $(DSTROOT)$(localtooldir)$(PKGTOOL) ; \
1511 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(PKGTOOL) $(DSTROOT)$(localtooldir)$(PKGTOOL); \
1512 fi;
1513 if test -f $(OBJROOT_CURRENT)/$(TZ2ICUTOOL); then \
1514 echo '# install' $(TZ2ICUTOOL) 'to' $(DSTROOT)$(localtooldir)$(TZ2ICUTOOL) ; \
1515 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(TZ2ICUTOOL) $(DSTROOT)$(localtooldir)$(TZ2ICUTOOL); \
1516 fi;
a62d09fc
A
1517 if test -f $(OBJROOT_CURRENT)/$(GENBRKTOOL); then \
1518 echo '# install' $(GENBRKTOOL) 'to' $(DSTROOT)$(localtooldir)$(GENBRKTOOL) ; \
1519 $(INSTALL) -b -m 0755 $(OBJROOT_CURRENT)/$(GENBRKTOOL) $(DSTROOT)$(localtooldir)$(GENBRKTOOL); \
1520 fi;