xref: /aoo41x/main/icu/makefile.mk (revision b64d3271)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23PRJ=.
24
25PRJNAME=icu
26TARGET=so_icu
27
28# --- Settings -----------------------------------------------------
29
30.INCLUDE :	settings.mk
31
32# --- Files --------------------------------------------------------
33
34.INCLUDE :	icuversion.mk
35
36.IF "$(ICU_MICRO)"!="0"
37TARFILE_NAME=icu4c-$(ICU_MAJOR)_$(ICU_MINOR)_$(ICU_MICRO)-src
38TARFILE_MD5=2f6ecca935948f7db92d925d88d0d078
39.ELSE
40TARFILE_NAME=icu4c-$(ICU_MAJOR)_$(ICU_MINOR)-src
41TARFILE_MD5=
42.ENDIF
43TARFILE_ROOTDIR=icu
44
45PATCH_FILES=${TARFILE_NAME}.patch icu-mp.patch icu-win-layoutex.patch
46
47.IF "$(OS)"=="MACOSX"
48PATCH_FILES+=icu-darwin.patch
49.ENDIF
50
51# ADDITIONAL_FILES=
52
53.IF "$(GUI)"=="UNX"
54.IF "$(COMNAME)"=="sunpro5"
55#.IF "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
56#CC:=$(COMPATH)$/bin$/cc
57#CXX:=$(COMPATH)$/bin$/CC
58#.ENDIF          # "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
59.ENDIF          # "$(COMNAME)"=="sunpro5"
60
61.IF "$(SYSBASE)"!=""
62icu_CFLAGS+=-I$(SYSBASE)$/usr$/include
63.IF "$(COMNAME)"=="sunpro5"
64icu_CFLAGS+=$(C_RESTRICTIONFLAGS)
65.ENDIF			# "$(COMNAME)"=="sunpro5"
66# add SYSBASE libraries and make certain that they are found *after* the
67# icu build internal libraries - in case that icu is available in SYSBASE
68# as well
69icu_LDFLAGS+= -L../lib  -L../../lib -L../stubdata -L../../stubdata  -L$(SYSBASE)$/usr$/lib
70.ENDIF			# "$(SYSBASE)"!=""
71
72icu_CFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
73icu_LDFLAGS+=$(EXTRA_LINKFLAGS)
74icu_CXXFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
75
76# remove conversion and transliteration data to reduce binary size.
77CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
78
79# until someone introduces SOLARIS 64-bit builds
80.IF "$(OS)"=="SOLARIS"
81DISABLE_64BIT=--enable-64bit-libs=no
82.ENDIF			# "$(OS)"=="SOLARIS"
83
84.IF "$(HAVE_LD_HASH_STYLE)"  == "TRUE"
85LDFLAGSADD += -Wl,--hash-style=both
86.ENDIF
87
88.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)"  == "TRUE"
89LDFLAGSADD += -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
90.ENDIF
91
92# FreeBSD with gcc from ports needs -Wl,-rpath= to find the matching libstdc++
93.IF "$(OS)"=="FREEBSD"
94LDFLAGSADD+=$(FBSD_GCC_RPATH)
95.ENDIF
96
97CONFIGURE_DIR=source
98
99CONFIGURE_ACTION+=sh -c 'CFLAGS="$(icu_CFLAGS)" CXXFLAGS="$(icu_CXXFLAGS)" LDFLAGS="$(icu_LDFLAGS) $(LDFLAGSADD)" ./configure --enable-layout --enable-static --enable-shared=yes $(DISABLE_64BIT)'
100
101#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
102CONFIGURE_FLAGS=
103
104# Use of
105# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
106# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
107# doesn't work as it would result in
108# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
109# note the position of the single quotes.
110
111BUILD_DIR=$(CONFIGURE_DIR)
112BUILD_ACTION=$(AUGMENT_LIBRARY_PATH) $(GNUMAKE) -j$(EXTMAXPROCESS)
113OUT2LIB= \
114	$(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
115	$(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
116	$(BUILD_DIR)$/lib$/libicudata$(DLLPOST) \
117	$(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
118	$(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
119	$(BUILD_DIR)$/lib$/libicuuc$(DLLPOST) \
120	$(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
121	$(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
122	$(BUILD_DIR)$/lib$/libicui18n$(DLLPOST) \
123	$(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
124	$(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
125	$(BUILD_DIR)$/lib$/libicule$(DLLPOST) \
126	$(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
127	$(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
128	$(BUILD_DIR)$/lib$/libicutu$(DLLPOST)
129
130OUT2BIN= \
131	$(BUILD_DIR)$/bin$/genccode \
132	$(BUILD_DIR)$/bin$/genbrk \
133	$(BUILD_DIR)$/bin$/gencmn
134
135.ENDIF
136
137.IF "$(GUI)"=="WNT"
138CONFIGURE_DIR=source
139.IF "$(COM)"=="GCC"
140CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
141.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
142icu_LDFLAGS+=-shared-libgcc
143.ENDIF
144.IF "$(USE_MINGW)"=="cygwin"
145icu_LDFLAGS+=-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api
146.ENDIF
147icu_LDFLAGS+=-L$(COMPATH)$/lib
148icu_LIBS=
149.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
150icu_LIBS+=$(MINGW_SHARED_LIBSTDCPP)
151.ENDIF
152icu_LDFLAGS+=-Wl,--enable-runtime-pseudo-reloc-v2
153CONFIGURE_ACTION+=sh -c 'CFLAGS="-O -D_MT" CXXFLAGS="-O -D_MT" LDFLAGS="$(icu_LDFLAGS)" LIBS="$(icu_LIBS)" ./configure --build=i586-pc-mingw32 --enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no'
154
155#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
156CONFIGURE_FLAGS=
157
158# Use of
159# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
160# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
161# doesn't work as it would result in
162# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
163# note the position of the single quotes.
164
165BUILD_DIR=$(CONFIGURE_DIR)
166BUILD_ACTION=$(GNUMAKE)
167OUT2LIB=
168
169OUT2BIN= \
170	$(BUILD_DIR)$/lib$/icudt$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
171	$(BUILD_DIR)$/lib$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
172	$(BUILD_DIR)$/lib$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
173	$(BUILD_DIR)$/lib$/icule$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
174	$(BUILD_DIR)$/lib$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
175	$(BUILD_DIR)$/bin$/genccode.exe \
176	$(BUILD_DIR)$/bin$/genbrk.exe \
177	$(BUILD_DIR)$/bin$/gencmn.exe
178
179.ELSE
180BUILD_DIR=source
181.IF "full_debug" == ""
182
183# Activating the debug mechanism produces incompatible libraries, you'd have
184# at least to relink all modules that are directly using ICU. Note that library
185# names get a 'd' appended and you'd have to edit the solenv/inc/libs.mk
186# ICU*LIB macros as well. Normally you don't want all this.
187#
188# Instead, use the normal already existing Release build and edit the
189# corresponding *.vcproj file of the section you're interested in. Make sure
190# that
191# - for the VCCLCompilerTool section the following line exists:
192#   DebugInformationFormat="3"
193# - and for the VCLinkerTool the line
194#   GenerateDebugInformation="TRUE"
195# Then delete the corresponding Release output directory, and delete the target
196# flag files
197# $(OUTPATH)/misc/build/so_built_so_icu
198# $(OUTPATH)/misc/build/so_predeliver_so_icu
199# and run dmake again, after which you may copy the resulting libraries to your
200# OOo/SO installation.
201ICU_BUILD_VERSION=Debug
202ICU_BUILD_LIBPOST=d
203.ELSE
204ICU_BUILD_VERSION=Release
205ICU_BUILD_LIBPOST=
206.ENDIF
207
208CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmak.cfg .
209
210.IF "$(CCNUMVER)"<="001400000000"
211BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHsc" && cd ..$/..
212.ELSE
213BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHa -Zc:wchar_t-" && cd ..$/..
214.ENDIF
215
216OUT2LIB= \
217	$(BUILD_DIR)$/..$/lib$/icudata.lib \
218	$(BUILD_DIR)$/..$/lib$/icuin$(ICU_BUILD_LIBPOST).lib \
219	$(BUILD_DIR)$/..$/lib$/icuuc$(ICU_BUILD_LIBPOST).lib \
220	$(BUILD_DIR)$/..$/lib$/icule$(ICU_BUILD_LIBPOST).lib \
221	$(BUILD_DIR)$/..$/lib$/icutu$(ICU_BUILD_LIBPOST).lib
222
223OUT2BIN= \
224	$(BUILD_DIR)$/..$/bin$/icudt$(ICU_MAJOR)$(ICU_MINOR).dll \
225	$(BUILD_DIR)$/..$/bin$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
226	$(BUILD_DIR)$/..$/bin$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
227	$(BUILD_DIR)$/..$/bin$/icule$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
228	$(BUILD_DIR)$/..$/bin$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
229	$(BUILD_DIR)$/..$/bin$/genccode.exe \
230	$(BUILD_DIR)$/..$/bin$/genbrk.exe \
231    $(BUILD_DIR)$/..$/bin$/gencmn.exe
232
233.ENDIF
234.ENDIF		# "$(GUI)"=="WNT"
235
236# --- Targets ------------------------------------------------------
237
238.INCLUDE : set_ext.mk
239.INCLUDE :	target.mk
240.INCLUDE :	tg_ext.mk
241
242.IF "$(BINARY_PATCH_FILES)"!=""
243
244$(PACKAGE_DIR)$/so_add_binary :  $(PACKAGE_DIR)$/$(ADD_FILES_FLAG_FILE)
245	cd $(PACKAGE_DIR) && gunzip -c $(BACK_PATH)$(BINARY_PATCH_FILES) | tar -xvf -
246	$(TOUCH) $(PACKAGE_DIR)$/so_add_binary
247
248$(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE) : $(PACKAGE_DIR)$/so_add_binary
249
250.ENDIF
251
252.IF "$(GUI)$(COM)"=="WNTGCC"
253ALLTAR : \
254	$(LB)$/icudata.lib \
255	$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib \
256	$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib \
257	$(LB)$/icule$(ICU_BUILD_LIBPOST).lib \
258	$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib
259
260$(LB)$/icudata.lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
261	$(TOUCH) $@
262
263$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
264	$(TOUCH) $@
265
266$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
267	$(TOUCH) $@
268
269$(LB)$/icule$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
270	$(TOUCH) $@
271
272$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
273	$(TOUCH) $@
274.ENDIF
275
276# Since you never know what will be in a patch (for example, it may already
277# patch at configure level) or in the case of a binary patch, we remove the
278# entire package directory if a patch is newer.
279# Changes in this makefile could also make a complete build necessary if
280# configure is affected.
281$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : makefile.mk
282
283