xref: /aoo42x/main/icu/makefile.mk (revision dbde6b5d)
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	icu-format-security.patch
47
48# ADDITIONAL_FILES=
49
50.IF "$(GUI)"=="UNX"
51.IF "$(COMNAME)"=="sunpro5"
52#.IF "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
53#CC:=$(COMPATH)$/bin$/cc
54#CXX:=$(COMPATH)$/bin$/CC
55#.ENDIF          # "$(BUILD_TOOLS)$/cc"=="$(shell +-which cc)"
56.ENDIF          # "$(COMNAME)"=="sunpro5"
57
58.IF "$(SYSBASE)"!=""
59icu_CFLAGS+=-I$(SYSBASE)$/usr$/include
60.IF "$(COMNAME)"=="sunpro5"
61icu_CFLAGS+=$(C_RESTRICTIONFLAGS)
62.ENDIF			# "$(COMNAME)"=="sunpro5"
63# add SYSBASE libraries and make certain that they are found *after* the
64# icu build internal libraries - in case that icu is available in SYSBASE
65# as well
66icu_LDFLAGS+= -L../lib  -L../../lib -L../stubdata -L../../stubdata  -L$(SYSBASE)$/usr$/lib
67.ENDIF			# "$(SYSBASE)"!=""
68
69icu_CFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
70icu_LDFLAGS+=$(EXTRA_LINKFLAGS)
71icu_CXXFLAGS+=-O $(ARCH_FLAGS) $(EXTRA_CDEFS)
72
73# remove conversion and transliteration data to reduce binary size.
74CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
75
76# until someone introduces SOLARIS 64-bit builds
77.IF "$(OS)"=="SOLARIS"
78DISABLE_64BIT=--enable-64bit-libs=no
79.ENDIF			# "$(OS)"=="SOLARIS"
80
81.IF "$(HAVE_LD_HASH_STYLE)"  == "TRUE"
82LDFLAGSADD += -Wl,--hash-style=both
83.ENDIF
84
85.IF "$(HAVE_LD_BSYMBOLIC_FUNCTIONS)"  == "TRUE"
86LDFLAGSADD += -Wl,-Bsymbolic-functions -Wl,--dynamic-list-cpp-new -Wl,--dynamic-list-cpp-typeinfo
87.ENDIF
88
89# FreeBSD with gcc from ports needs -Wl,-rpath= to find the matching libstdc++
90.IF "$(OS)"=="FREEBSD"
91LDFLAGSADD+=$(FBSD_GCC_RPATH)
92.ENDIF
93
94CONFIGURE_DIR=source
95
96CONFIGURE_ACTION+=sh -c 'CFLAGS="$(icu_CFLAGS)" CXXFLAGS="$(icu_CXXFLAGS)" LDFLAGS="$(icu_LDFLAGS) $(LDFLAGSADD)" ./configure --enable-layout --enable-static --enable-shared=yes $(DISABLE_64BIT)'
97
98#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
99CONFIGURE_FLAGS=
100
101# Use of
102# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
103# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
104# doesn't work as it would result in
105# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
106# note the position of the single quotes.
107
108BUILD_DIR=$(CONFIGURE_DIR)
109BUILD_ACTION=$(AUGMENT_LIBRARY_PATH) $(GNUMAKE) -j$(EXTMAXPROCESS)
110OUT2LIB= \
111	$(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
112	$(BUILD_DIR)$/lib$/libicudata$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
113	$(BUILD_DIR)$/lib$/libicudata$(DLLPOST) \
114	$(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
115	$(BUILD_DIR)$/lib$/libicuuc$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
116	$(BUILD_DIR)$/lib$/libicuuc$(DLLPOST) \
117	$(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
118	$(BUILD_DIR)$/lib$/libicui18n$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
119	$(BUILD_DIR)$/lib$/libicui18n$(DLLPOST) \
120	$(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
121	$(BUILD_DIR)$/lib$/libicule$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
122	$(BUILD_DIR)$/lib$/libicule$(DLLPOST) \
123	$(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR).$(ICU_MICRO) \
124	$(BUILD_DIR)$/lib$/libicutu$(DLLPOST).$(ICU_MAJOR)$(ICU_MINOR) \
125	$(BUILD_DIR)$/lib$/libicutu$(DLLPOST)
126
127OUT2BIN= \
128	$(BUILD_DIR)$/bin$/genccode \
129	$(BUILD_DIR)$/bin$/genbrk \
130	$(BUILD_DIR)$/bin$/gencmn
131
132.ENDIF
133
134.IF "$(GUI)"=="WNT"
135CONFIGURE_DIR=source
136.IF "$(COM)"=="GCC"
137CONFIGURE_ACTION=rm data/mappings/ucm*.mk data/translit/trn*.mk ;
138.IF "$(MINGW_SHARED_GCCLIB)"=="YES"
139icu_LDFLAGS+=-shared-libgcc
140.ENDIF
141.IF "$(USE_MINGW)"=="cygwin"
142icu_LDFLAGS+=-L$(COMPATH)/lib/mingw -L$(COMPATH)/lib/w32api
143.ENDIF
144icu_LDFLAGS+=-L$(COMPATH)$/lib
145icu_LIBS=
146.IF "$(MINGW_SHARED_GXXLIB)"=="YES"
147icu_LIBS+=$(MINGW_SHARED_LIBSTDCPP)
148.ENDIF
149icu_LDFLAGS+=-Wl,--enable-runtime-pseudo-reloc-v2
150CONFIGURE_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'
151
152#CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
153CONFIGURE_FLAGS=
154
155# Use of
156# CONFIGURE_ACTION=sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure'
157# CONFIGURE_FLAGS=--enable-layout --enable-static --enable-shared=yes --enable-64bit-libs=no
158# doesn't work as it would result in
159# sh -c 'CFLAGS=-O CXXFLAGS=-O ./configure' --enable-layout ...
160# note the position of the single quotes.
161
162BUILD_DIR=$(CONFIGURE_DIR)
163BUILD_ACTION=$(GNUMAKE)
164OUT2LIB=
165
166OUT2BIN= \
167	$(BUILD_DIR)$/lib$/icudt$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
168	$(BUILD_DIR)$/lib$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
169	$(BUILD_DIR)$/lib$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
170	$(BUILD_DIR)$/lib$/icule$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
171	$(BUILD_DIR)$/lib$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(DLLPOST) \
172	$(BUILD_DIR)$/bin$/genccode.exe \
173	$(BUILD_DIR)$/bin$/genbrk.exe \
174	$(BUILD_DIR)$/bin$/gencmn.exe
175
176.ELSE
177BUILD_DIR=source
178.IF "full_debug" == ""
179
180# Activating the debug mechanism produces incompatible libraries, you'd have
181# at least to relink all modules that are directly using ICU. Note that library
182# names get a 'd' appended and you'd have to edit the solenv/inc/libs.mk
183# ICU*LIB macros as well. Normally you don't want all this.
184#
185# Instead, use the normal already existing Release build and edit the
186# corresponding *.vcproj file of the section you're interested in. Make sure
187# that
188# - for the VCCLCompilerTool section the following line exists:
189#   DebugInformationFormat="3"
190# - and for the VCLinkerTool the line
191#   GenerateDebugInformation="TRUE"
192# Then delete the corresponding Release output directory, and delete the target
193# flag files
194# $(OUTPATH)/misc/build/so_built_so_icu
195# $(OUTPATH)/misc/build/so_predeliver_so_icu
196# and run dmake again, after which you may copy the resulting libraries to your
197# OOo/SO installation.
198ICU_BUILD_VERSION=Debug
199ICU_BUILD_LIBPOST=d
200.ELSE
201ICU_BUILD_VERSION=Release
202ICU_BUILD_LIBPOST=
203.ENDIF
204
205.IF "$(CPUNAME)"=="INTEL"
206CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmak.cfg .
207.ELIF "$(CPUNAME)"=="X86_64"
208CONFIGURE_ACTION+= $(PERL) ..$/..$/..$/..$/..$/createmak.pl ..$/..$/..$/..$/..$/createmakWin64.cfg .
209.ENDIF
210
211.IF "$(CCNUMVER)"<="001400000000"
212BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHsc" && cd ..$/..
213.ELSE
214BUILD_ACTION=cd allinone && nmake /f all.mak EXFLAGS="-EHa -Zc:wchar_t-" && cd ..$/..
215.ENDIF
216
217OUT2LIB= \
218	$(BUILD_DIR)$/..$/lib$/icudata.lib \
219	$(BUILD_DIR)$/..$/lib$/icuin$(ICU_BUILD_LIBPOST).lib \
220	$(BUILD_DIR)$/..$/lib$/icuuc$(ICU_BUILD_LIBPOST).lib \
221	$(BUILD_DIR)$/..$/lib$/icule$(ICU_BUILD_LIBPOST).lib \
222	$(BUILD_DIR)$/..$/lib$/icutu$(ICU_BUILD_LIBPOST).lib
223
224OUT2BIN= \
225	$(BUILD_DIR)$/..$/bin$/icudt$(ICU_MAJOR)$(ICU_MINOR).dll \
226	$(BUILD_DIR)$/..$/bin$/icuin$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
227	$(BUILD_DIR)$/..$/bin$/icuuc$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
228	$(BUILD_DIR)$/..$/bin$/icule$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
229	$(BUILD_DIR)$/..$/bin$/icutu$(ICU_MAJOR)$(ICU_MINOR)$(ICU_BUILD_LIBPOST).dll \
230	$(BUILD_DIR)$/..$/bin$/genccode.exe \
231	$(BUILD_DIR)$/..$/bin$/genbrk.exe \
232    $(BUILD_DIR)$/..$/bin$/gencmn.exe
233
234.ENDIF
235.ENDIF		# "$(GUI)"=="WNT"
236
237# --- Targets ------------------------------------------------------
238
239.INCLUDE : set_ext.mk
240.INCLUDE :	target.mk
241.INCLUDE :	tg_ext.mk
242
243.IF "$(BINARY_PATCH_FILES)"!=""
244
245$(PACKAGE_DIR)$/so_add_binary :  $(PACKAGE_DIR)$/$(ADD_FILES_FLAG_FILE)
246	cd $(PACKAGE_DIR) && gunzip -c $(BACK_PATH)$(BINARY_PATCH_FILES) | tar -xvf -
247	$(TOUCH) $(PACKAGE_DIR)$/so_add_binary
248
249$(PACKAGE_DIR)$/$(CONFIGURE_FLAG_FILE) : $(PACKAGE_DIR)$/so_add_binary
250
251.ENDIF
252
253.IF "$(GUI)$(COM)"=="WNTGCC"
254ALLTAR : \
255	$(LB)$/icudata.lib \
256	$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib \
257	$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib \
258	$(LB)$/icule$(ICU_BUILD_LIBPOST).lib \
259	$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib
260
261$(LB)$/icudata.lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
262	$(TOUCH) $@
263
264$(LB)$/icuin$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
265	$(TOUCH) $@
266
267$(LB)$/icuuc$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
268	$(TOUCH) $@
269
270$(LB)$/icule$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
271	$(TOUCH) $@
272
273$(LB)$/icutu$(ICU_BUILD_LIBPOST).lib : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
274	$(TOUCH) $@
275.ENDIF
276
277# Since you never know what will be in a patch (for example, it may already
278# patch at configure level) or in the case of a binary patch, we remove the
279# entire package directory if a patch is newer.
280# Changes in this makefile could also make a complete build necessary if
281# configure is affected.
282$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : makefile.mk
283
284