Home | History | Annotate | Download | only in icu4c
      1 # Make definitions that are shared by the different subprojects of ICU.
      2 #
      3 # Yves Arrouye.
      4 #
      5 # Copyright (C) 2000-2012, International Business Machines Corporation and others.
      6 # All Rights Reserved.
      7 
      8 #
      9 # Some of these variables are overridden in the config/mh-* files.
     10 # 
     11 # Please be sure to update config/Makefile.inc.in  if you add something here.
     12 #
     13 
     14 # Shell to use
     15 
     16 SHELL = /bin/sh
     17 
     18 # Standard directories
     19 
     20 prefix = /usr/local
     21 exec_prefix = ${prefix}
     22 
     23 bindir = ${exec_prefix}/bin
     24 sbindir = ${exec_prefix}/sbin
     25 datarootdir = ${prefix}/share
     26 datadir = ${datarootdir}
     27 libdir = ${exec_prefix}/lib
     28 includedir = ${prefix}/include
     29 mandir = ${datarootdir}/man
     30 sysconfdir = ${prefix}/etc
     31 # controls the include of $(top_builddir)/icucross.mk at bottom of file
     32 cross_compiling = no
     33 cross_buildroot = 
     34 
     35 # Package information
     36 
     37 PACKAGE_ICU_DESCRIPTION = "International Components for Unicode"
     38 PACKAGE_ICU_URL = "http://icu-project.org"
     39 PACKAGE = icu
     40 VERSION = 50.1.1
     41 UNICODE_VERSION = 6.2
     42 SO_TARGET_VERSION = 50.1.1
     43 SO_TARGET_VERSION_MAJOR = 50
     44 
     45 # The ICU data external name is usually icudata; the entry point name is
     46 # the version-dependent name (for no particular reason except it was easier
     47 # to change the build this way). When building in common mode, the data
     48 # name is the versioned platform-dependent one. 
     49 
     50 ICUDATA_DIR = ${datarootdir}/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION)
     51 
     52 ICUDATA_BASENAME_VERSION = $(ICUPREFIX)dt50
     53 # the entry point is almost like the basename, but has the lib suffix.  
     54 ICUDATA_ENTRY_POINT = $(ICUPREFIX)dt50 
     55 ICUDATA_CHAR = l
     56 ICUDATA_PLATFORM_NAME = $(ICUDATA_BASENAME_VERSION)$(ICUDATA_CHAR)
     57 PKGDATA_LIBSTATICNAME = -L $(STATIC_PREFIX)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
     58 ifeq ($(strip $(PKGDATA_MODE)),)
     59 PKGDATA_MODE=static
     60 endif
     61 ifeq ($(PKGDATA_MODE),common)
     62 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
     63 ICUPKGDATA_DIR = $(ICUDATA_DIR)
     64 else
     65 ifeq ($(PKGDATA_MODE),dll)
     66 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
     67 PKGDATA_LIBNAME = -L $(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
     68 ICUPKGDATA_DIR = $(libdir)
     69 else
     70 ifeq ($(PKGDATA_MODE),static)
     71 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
     72 PKGDATA_LIBNAME = -L $(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)
     73 ICUPKGDATA_DIR = $(libdir)
     74 else
     75 ICUDATA_NAME = $(ICUDATA_PLATFORM_NAME)
     76 ICUPKGDATA_DIR = $(ICUDATA_DIR)
     77 endif
     78 endif
     79 endif
     80 
     81 # These are defined here because mh-cygwin-msvc needs to override these values.
     82 ICUPKGDATA_INSTALL_DIR = $(DESTDIR)$(ICUPKGDATA_DIR)
     83 ICUPKGDATA_INSTALL_LIBDIR = $(DESTDIR)$(libdir)
     84 
     85 # If defined to a valid value, pkgdata will generate a data library more quickly
     86 GENCCODE_ASSEMBLY = -a gcc
     87 
     88 # ICU specific directories
     89 
     90 pkgdatadir = $(datadir)/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION)
     91 pkglibdir = $(libdir)/$(PACKAGE)$(ICULIBSUFFIX)/$(VERSION)
     92 pkgsysconfdir = $(sysconfdir)/$(PACKAGE)$(ICULIBSUFFIX)
     93 
     94 # Installation programs
     95 
     96 MKINSTALLDIRS = $(SHELL) $(top_srcdir)/mkinstalldirs
     97 
     98 INSTALL = /usr/bin/install -c
     99 INSTALL_PROGRAM = ${INSTALL}
    100 INSTALL_DATA = ${INSTALL} -m 644
    101 INSTALL_SCRIPT = ${INSTALL}
    102 
    103 # Library suffix (to support different C++ compilers)
    104 
    105 ICULIBSUFFIX=
    106 
    107 # Compiler and tools
    108 
    109 ENABLE_DEBUG = 0
    110 ENABLE_RELEASE = 1
    111 EXEEXT = 
    112 CC = gcc
    113 CXX = g++
    114 AR = ar
    115 ARFLAGS =  r
    116 RANLIB = ranlib
    117 COMPILE_LINK_ENVVAR = 
    118 UCLN_NO_AUTO_CLEANUP = 1
    119 
    120 # Various flags for the tools
    121 
    122 # DEFS is for common macro definitions.
    123 # configure prevents user defined DEFS, and configure's DEFS is not needed
    124 # So we ignore the DEFS that comes from configure
    125 # U_ATTRIBUTE_DEPRECATED is defined to hide warnings about deprecated API warnings.
    126 DEFS = -DU_ATTRIBUTE_DEPRECATED=
    127 # CFLAGS is for C only flags
    128 CFLAGS =  -O2 -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings $(THREADSCFLAGS)
    129 # CXXFLAGS is for C++ only flags
    130 CXXFLAGS =  -O2 -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long $(THREADSCXXFLAGS)
    131 # CPPFLAGS is for C Pre-Processor flags
    132 CPPFLAGS =  -ffunction-sections -fdata-sections $(THREADSCPPFLAGS)  
    133 # LIBCFLAGS are the flags for static and shared libraries.
    134 LIBCFLAGS = 
    135 # LIBCXXFLAGS are the flags for static and shared libraries.
    136 LIBCXXFLAGS = 
    137 # DEFAULT_LIBS are the default libraries to link against
    138 DEFAULT_LIBS = -lpthread -ldl -lm 
    139 # LIB_M is for linking against the math library
    140 LIB_M = 
    141 # LIB_THREAD is for linking against the threading library
    142 LIB_THREAD = 
    143 # OUTOPT is for creating a specific output name
    144 OUTOPT = -o # The extra space after the argument is needed.
    145 # AR_OUTOPT is for creating a specific output name for static libraries.
    146 AR_OUTOPT =
    147 
    148 ENABLE_RPATH = NO
    149 ifeq ($(ENABLE_RPATH),YES)
    150 RPATHLDFLAGS = $(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
    151 endif
    152 LDFLAGS =  -Wl,--gc-sections $(RPATHLDFLAGS)
    153 
    154 # What kind of libraries are we building and linking against?
    155 ENABLE_STATIC = YES
    156 ENABLE_SHARED = 
    157 
    158 # Echo w/o newline
    159 
    160 #ECHO_N = -n
    161 #ECHO_C = 
    162 
    163 # Commands to compile
    164 COMPILE.c=    $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c
    165 COMPILE.cc=   $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c
    166 
    167 # Commands to link
    168 LINK.c=       $(CC) $(CFLAGS) $(LDFLAGS)
    169 LINK.cc=      $(CXX) $(CXXFLAGS) $(LDFLAGS)
    170 
    171 # Commands to make a shared library
    172 SHLIB.c=      $(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS)
    173 SHLIB.cc=     $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS)
    174 
    175 # ICU_MSG
    176 ICU_MSG=@echo "   $(1)	"
    177 
    178 # Do not show the large compiling arguments by default.
    179 # To use:
    180 # change
    181 #    $(CC) -o foo
    182 # to
    183 #    $(call SILENT_COMPILE,$(CC) -o foo)
    184 ifndef VERBOSE
    185     SILENT_COMPILE=$(call ICU_MSG,$(notdir $(firstword $(1)))) "... " $< && $(1) || \
    186 			( echo "*** Failed compilation command follows: ----------------------------------------------------------" ; \
    187 			  echo "$(1)" ; \
    188 		          echo "--- ( rebuild with \"$(MAKE) VERBOSE=1 $(MAKECMDGOALS)\" to show all parameters ) --------" ; \
    189 			false )
    190 else
    191     SILENT_COMPILE=$(1)
    192 endif
    193 
    194 # Environment variable to set a runtime search path
    195 LDLIBRARYPATH_ENVVAR = LD_LIBRARY_PATH
    196 
    197 # Versioned target for a shared library.
    198 FINAL_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION)
    199 MIDDLE_SO_TARGET = $(SO_TARGET).$(SO_TARGET_VERSION_MAJOR)
    200 SHARED_OBJECT = $(FINAL_SO_TARGET)
    201 
    202 ##  How ICU libraries are named...  ex. $(LIBICU)uc$(SO)
    203 # Prefix for the ICU library names
    204 ICUPREFIX = icu
    205 LIBPREFIX = lib
    206 LIBICU = $(LIBPREFIX)$(ICUPREFIX)
    207 
    208 ## If we can't use the shared libraries, use the static libraries
    209 ifneq ($(ENABLE_SHARED),YES)
    210 STATIC_PREFIX_WHEN_USED = s
    211 else
    212 STATIC_PREFIX_WHEN_USED = 
    213 endif
    214 
    215 # Static library prefix and file extension
    216 STATIC_PREFIX = s
    217 LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
    218 A = a
    219 SOBJ = $(SO)
    220 
    221 # Force removal [for make clean]
    222 RMV = rm -rf
    223 
    224 # Platform commands to remove or move executable and library targets
    225 # INSTALL-L installs libraries. Override in mh-* file to INSTALL_PROGRAM
    226 #           when the library needs to have executable permissions
    227 INSTALL-S = $(INSTALL_PROGRAM)
    228 INSTALL-L = $(INSTALL_PROGRAM)
    229 #INSTALL-L = $(INSTALL_DATA)
    230 
    231 # Location of the libraries before "make install" is used
    232 LIBDIR=$(top_builddir)/lib
    233 
    234 # Location of the executables before "make install" is used
    235 BINDIR=$(top_builddir)/bin
    236 
    237 # overridden by icucross.mk
    238 TOOLBINDIR=$(BINDIR)
    239 TOOLLIBDIR=$(LIBDIR)
    240 
    241 # Name flexibility for the library naming scheme.  Any modifications should
    242 # be made in the mh- file for the specific platform.
    243 DATA_STUBNAME = data
    244 COMMON_STUBNAME = uc
    245 I18N_STUBNAME = i18n
    246 LAYOUT_STUBNAME = le
    247 LAYOUTEX_STUBNAME = lx
    248 IO_STUBNAME = io
    249 TOOLUTIL_STUBNAME = tu
    250 CTESTFW_STUBNAME = test
    251 
    252 # Just the libs.
    253 ICULIBS_DT	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    254 ICULIBS_UC	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(COMMON_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    255 ICULIBS_I18N	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    256 ICULIBS_LE	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    257 ICULIBS_LX	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    258 ICULIBS_IO	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(IO_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    259 ICULIBS_CTESTFW	= -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    260 ICULIBS_TOOLUTIL = -l$(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX)$(SO_TARGET_VERSION_SUFFIX)
    261 # Link commands to link to ICU libs
    262 LLIBDIR		= -L$(LIBDIR)
    263 LSTUBDIR	= -L$(top_builddir)/stubdata
    264 LCTESTFW	= -L$(top_builddir)/tools/ctestfw
    265 
    266 LIBICUDT	= $(LLIBDIR) $(LSTUBDIR) $(ICULIBS_DT)
    267 LIBICUUC	= $(LLIBDIR) $(ICULIBS_UC) $(LSTUBDIR) $(ICULIBS_DT)
    268 LIBICUI18N	= $(LLIBDIR) $(ICULIBS_I18N)
    269 LIBICULE	= $(LLIBDIR) $(ICULIBS_LE)
    270 LIBICULX	= $(LLIBDIR) $(ICULIBS_LX)
    271 LIBCTESTFW	= $(LCTESTFW) $(ICULIBS_CTESTFW)
    272 LIBICUTOOLUTIL	= $(LLIBDIR) $(ICULIBS_TOOLUTIL)
    273 LIBICUIO	= $(LLIBDIR) $(ICULIBS_IO)
    274 
    275 # Invoke, set library path for all ICU libraries.
    276 # overridden by icucross.mk
    277 INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)$(LIBDIR):$(top_builddir)/stubdata:$(top_builddir)/tools/ctestfw:$$$(LDLIBRARYPATH_ENVVAR) $(LEAK_CHECKER)
    278 # prefer stubdata
    279 PKGDATA_INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(top_builddir)/stubdata:$(top_builddir)/tools/ctestfw:$(LIBRARY_PATH_PREFIX)$(LIBDIR):$$$(LDLIBRARYPATH_ENVVAR) $(LEAK_CHECKER)
    280 INSTALLED_INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(libdir):$$$(LDLIBRARYPATH_ENVVAR)
    281 
    282 # Platform-specific setup
    283 include $(top_srcdir)/config/mh-linux
    284 
    285 # Current full path directory.
    286 CURR_FULL_DIR?=$(shell pwd | sed 's/ /\\ /g')
    287 # Current full path directory for use in source code in a -D compiler option.
    288 CURR_SRCCODE_FULL_DIR?=$(shell pwd | sed 's/ /\\ /')
    289 
    290 # When shared libraries are disabled and static libraries are enabled,
    291 # the C++ compiler must be used to link in the libraries for the tools.
    292 ifneq ($(ENABLE_SHARED),YES)
    293 LINK.c = $(LINK.cc)
    294 endif
    295 
    296 # some imported things from the cross env
    297 TOOLEXEEXT = $(EXEEXT)
    298 ifneq ($(strip $(cross_buildroot)),)
    299 include $(cross_buildroot)/config/icucross.mk
    300 else
    301 cross_buildroot = $(top_builddir)
    302 endif
    303 
    304 # optional include at top
    305 -include $(top_builddir)/icudefs.local
    306