1 # Make definitions that are shared by the different subprojects of ICU.
5 # Copyright (C) 2016 and later: Unicode, Inc. and others.
6 # License & terms of use: http://www.unicode.org/copyright.html
7 # Copyright (C) 2000-2016, International Business Machines Corporation and others.
11 # Some of these variables are overridden in the config/mh-* files.
13 # Please be sure to update config/Makefile.inc.in if you add something here.
20 # Instruct Python to never write any byte code to the ICU source tree.
21 export PYTHONDONTWRITEBYTECODE = 1
23 # Standard directories
26 exec_prefix = @exec_prefix@
30 datarootdir = @datarootdir@
33 includedir = @includedir@
35 sysconfdir = @sysconfdir@
36 # controls the include of $(top_builddir)/icucross.mk at bottom of file
37 cross_compiling = @cross_compiling@
38 cross_buildroot = @cross_buildroot@
42 PACKAGE_ICU_DESCRIPTION = "International Components for Unicode"
43 PACKAGE_ICU_URL = "http://icu-project.org"
46 UNICODE_VERSION = @UNICODE_VERSION@
47 SO_TARGET_VERSION = @LIB_VERSION@
48 SO_TARGET_VERSION_MAJOR = @LIB_VERSION_MAJOR@
50 # The ICU data external name is usually icudata; the entry point name is
51 # the version-dependent name (for no particular reason except it was easier
52 # to change the build this way). When building in common mode, the data
53 # name is the versioned platform-dependent one.
55 ICUDATA_DIR = @pkgicudatadir@/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION)
57 ICUDATA_BASENAME_VERSION = $(ICUPREFIX)dt@LIB_VERSION_MAJOR@
58 # the entry point is almost like the basename, but has the lib suffix.
59 ICUDATA_ENTRY_POINT = $(ICUPREFIX)dt@ICULIBSUFFIXCNAME@@LIB_VERSION_MAJOR@
60 ICUDATA_CHAR = @ICUDATA_CHAR@
61 ICUDATA_PLATFORM_NAME = $(ICUDATA_BASENAME_VERSION)$(ICUDATA_CHAR)
62 PKGDATA_LIBSTATICNAME = -L $(STATIC_PREFIX)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
63 ifeq ($(strip $(PKGDATA_MODE)),)
64 PKGDATA_MODE=@DATA_PACKAGING_MODE@
66 ifeq ($(PKGDATA_MODE),common)
67 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
68 ICUPKGDATA_DIR = $(ICUDATA_DIR)
70 ifeq ($(PKGDATA_MODE),dll)
71 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
72 PKGDATA_LIBNAME = -L $(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
73 ICUPKGDATA_DIR = $(libdir)
75 ifeq ($(PKGDATA_MODE),static)
76 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
77 PKGDATA_LIBNAME = -L $(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
78 ICUPKGDATA_DIR = $(libdir)
80 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
81 ICUPKGDATA_DIR = $(ICUDATA_DIR)
86 # These are defined here because mh-cygwin-msvc needs to override these values.
87 ICUPKGDATA_INSTALL_DIR = $(DESTDIR)$(ICUPKGDATA_DIR)
88 ICUPKGDATA_INSTALL_LIBDIR = $(DESTDIR)$(libdir)
90 # If defined to a valid value, pkgdata will generate a data library more quickly
91 GENCCODE_ASSEMBLY = @GENCCODE_ASSEMBLY@
93 # ICU specific directories
95 pkgdatadir = $(datadir)/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION)
96 pkglibdir = $(libdir)/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION)
97 pkgsysconfdir = $(sysconfdir)/$(PACKAGE)$(ICULIBSUFFIX)
99 # Installation programs
101 MKINSTALLDIRS = $(SHELL) $(top_srcdir)/mkinstalldirs
104 INSTALL_PROGRAM = @INSTALL_PROGRAM@
105 INSTALL_DATA = @INSTALL_DATA@
106 INSTALL_SCRIPT = @INSTALL_SCRIPT@
108 # Library suffix (to support different C++ compilers)
110 ICULIBSUFFIX=@ICULIBSUFFIX@
114 ENABLE_DEBUG = @ENABLE_DEBUG@
115 ENABLE_RELEASE = @ENABLE_RELEASE@
120 ARFLAGS = @ARFLAGS@ r
122 COMPILE_LINK_ENVVAR = @COMPILE_LINK_ENVVAR@
123 UCLN_NO_AUTO_CLEANUP = @UCLN_NO_AUTO_CLEANUP@
126 # Various flags for the tools
128 # DEFS is for common macro definitions.
129 # configure prevents user defined DEFS, and configure's DEFS is not needed
130 # So we ignore the DEFS that comes from configure
131 # U_ATTRIBUTE_DEPRECATED is defined to hide warnings about deprecated API warnings.
132 DEFS = -DU_ATTRIBUTE_DEPRECATED=
133 # CFLAGS is for C only flags
135 # CXXFLAGS is for C++ only flags
136 CXXFLAGS = @CXXFLAGS@
137 # CPPFLAGS is for C Pre-Processor flags
138 CPPFLAGS = @CPPFLAGS@
139 # LIBCFLAGS are the flags for static and shared libraries.
140 LIBCFLAGS = @LIBCFLAGS@
141 # LIBCXXFLAGS are the flags for static and shared libraries.
142 LIBCXXFLAGS = @LIBCXXFLAGS@
143 # DEFAULT_LIBS are the default libraries to link against
144 DEFAULT_LIBS = @LIBS@
145 # LIB_M is for linking against the math library
147 # LIB_THREAD is for linking against the threading library
148 LIB_THREAD = @LIB_THREAD@
149 # OUTOPT is for creating a specific output name
150 OUTOPT = -o # The extra space after the argument is needed.
151 # AR_OUTOPT is for creating a specific output name for static libraries.
154 ENABLE_RPATH = @ENABLE_RPATH@
155 ifeq ($(ENABLE_RPATH),YES)
156 RPATHLDFLAGS = $(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
158 LDFLAGS = @LDFLAGS@ $(RPATHLDFLAGS)
160 # What kind of libraries are we building and linking against?
161 ENABLE_STATIC = @ENABLE_STATIC@
162 ENABLE_SHARED = @ENABLE_SHARED@
166 #ECHO_N = @ICU_ECHO_N@
167 #ECHO_C = @ICU_ECHO_C@
169 # Commands to compile
170 COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c
171 COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c
174 LINK.c= $(CC) $(CFLAGS) $(LDFLAGS) $(LINKFLAGS)
175 LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) $(LINKFLAGS)
177 # Commands to make a shared library
178 SHLIB.c= $(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS)
179 SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS)
182 ICU_MSG=@echo " $(1) "
184 # Do not show the large compiling arguments by default.
189 # $(call SILENT_COMPILE,$(CC) -o foo)
191 SILENT_COMPILE=$(call ICU_MSG,$(notdir $(firstword $(1)))) "... " $< && $(1) || \
192 ( echo "*** Failed compilation command follows: ----------------------------------------------------------" ; \
194 echo "--- ( rebuild with \"$(MAKE) VERBOSE=1 $(MAKECMDGOALS)\" to show all parameters ) --------" ; \
200 # Environment variable to set a runtime search path
201 LDLIBRARYPATH_ENVVAR = LD_LIBRARY_PATH
203 # Versioned target for a shared library.
204 FINAL_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION)
205 MIDDLE_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION_MAJOR)
206 SHARED_OBJECT = $(FINAL_SO_TARGET)
208 ## How ICU libraries are named... ex. $(LIBICU)uc$(SO)
209 # Prefix for the ICU library names
212 LIBICU = $(LIBPREFIX)$(ICUPREFIX)
214 ## If we can't use the shared libraries, use the static libraries
215 ifneq ($(ENABLE_SHARED),YES)
216 STATIC_PREFIX_WHEN_USED = s
218 STATIC_PREFIX_WHEN_USED =
221 # Static library prefix and file extension
223 LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
227 # Force removal [for make clean]
230 # Platform commands to remove or move executable and library targets
231 # INSTALL-L installs libraries. Override in mh-* file to INSTALL_PROGRAM
232 # when the library needs to have executable permissions
233 INSTALL-S = $(INSTALL_PROGRAM)
234 INSTALL-L = $(INSTALL_PROGRAM)
235 #INSTALL-L = $(INSTALL_DATA)
237 # Location of the libraries before "make install" is used
238 LIBDIR=$(top_builddir)/lib
240 # Location of the executables before "make install" is used
241 BINDIR=$(top_builddir)/bin
243 # overridden by icucross.mk
247 # Name flexibility for the library naming scheme. Any modifications should
248 # be made in the mh- file for the specific platform.
252 LAYOUTEX_STUBNAME = lx
254 TOOLUTIL_STUBNAME = tu
255 CTESTFW_STUBNAME = test
257 # get these from pkg-config, if available
258 ICULEHB_CFLAGS=@ICULEHB_CFLAGS@
259 ICULEHB_LIBS=@ICULEHB_LIBS@
260 ifneq ($(ICULEHB_CFLAGS),)
264 ICULIBS_LE=$(ICULEHB_LIBS)
265 ICULE_CFLAGS=$(ICULEHB_CFLAGS) -DUSING_ICULEHB
273 ICULIBS_DT = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
274 ICULIBS_UC = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
275 ICULIBS_I18N = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
276 ICULIBS_LX = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
277 ICULIBS_IO = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
278 ICULIBS_CTESTFW = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
279 ICULIBS_TOOLUTIL = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
280 # Link commands to link to ICU libs
281 LLIBDIR = -L$(LIBDIR)
282 LSTUBDIR = -L$(top_builddir)/stubdata
283 LCTESTFW = -L$(top_builddir)/tools/ctestfw
285 LIBICUDT = $(LLIBDIR) $(LSTUBDIR) $(ICULIBS_DT)
286 LIBICUUC = $(LLIBDIR) $(ICULIBS_UC) $(LSTUBDIR) $(ICULIBS_DT)
287 LIBICUI18N = $(LLIBDIR) $(ICULIBS_I18N)
288 LIBICULE = $(ICULEHB_CFLAGS) $(LLIBDIR) $(ICULIBS_LE)
289 LIBICULX = $(LLIBDIR) $(ICULIBS_LX)
290 LIBCTESTFW = $(LCTESTFW) $(ICULIBS_CTESTFW)
291 LIBICUTOOLUTIL = $(LLIBDIR) $(ICULIBS_TOOLUTIL)
292 LIBICUIO = $(LLIBDIR) $(ICULIBS_IO)
294 # Invoke, set library path for all ICU libraries.
295 # overridden by icucross.mk
296 INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)$(LIBDIR):$(top_builddir)/stubdata:$(top_builddir)/tools/ctestfw:$$$(LDLIBRARYPATH_ENVVAR) $(LEAK_CHECKER)
298 PKGDATA_INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(top_builddir)/stubdata:$(top_builddir)/tools/ctestfw:$(LIBRARY_PATH_PREFIX)$(LIBDIR):$$$(LDLIBRARYPATH_ENVVAR) $(LEAK_CHECKER)
299 INSTALLED_INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(libdir):$$$(LDLIBRARYPATH_ENVVAR)
301 # Current full path directory for cross compilation
302 ifneq ($(strip $(cross_buildroot)),)
303 include $(cross_buildroot)/config/icucross.inc
306 # Platform-specific setup
307 include @platform_make_fragment@
309 # Current full path directory.
310 CURR_FULL_DIR?=$(shell pwd | sed 's/ /\\ /g')
311 # Current full path directory for use in source code in a -D compiler option.
312 CURR_SRCCODE_FULL_DIR?=$(shell pwd | sed 's/ /\\ /')
314 # When shared libraries are disabled and static libraries are enabled,
315 # the C++ compiler must be used to link in the libraries for the tools.
316 ifneq ($(ENABLE_SHARED),YES)
320 # some imported things from the cross env
321 TOOLEXEEXT = $(EXEEXT)
322 ifneq ($(strip $(cross_buildroot)),)
323 include $(cross_buildroot)/config/icucross.mk
325 cross_buildroot = $(top_builddir)
329 ifneq ($(TEST_STATUS_FILE),)
330 TEST_OUTPUT_OPTS="-E$(TEST_STATUS_FILE)"
333 # optional include at top
334 -include $(top_builddir)/icudefs.local