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