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