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