]> git.saurik.com Git - apple/icu.git/blame - icuSources/config/mh-msys-msvc
ICU-551.24.tar.gz
[apple/icu.git] / icuSources / config / mh-msys-msvc
CommitLineData
b331163b
A
1## -*-makefile-*-
2## MSYS with Microsoft Visual C++ compiler specific setup
3## Copyright (c) 2014, International Business Machines Corporation and
4## others. All Rights Reserved.
5
6# We install sbin tools into the same bin directory because
7# pkgdata needs some of the tools in sbin, and we can't always depend on
8# icu-config working on Windows.
9sbindir=$(bindir)
10
11# Need this option to use / instead of - when specifying options for the
12# rc.exe command
13MSYS_RC_MODE=1
14
15## Commands to generate dependency files
16GEN_DEPS.c= :
17GEN_DEPS.cc= :
18#GEN_DEPS.c= $(COMPILE.c) -E
19#GEN_DEPS.cc= $(COMPILE.cc) -E
20
21## Flags to create/use a static library
22ifneq ($(ENABLE_SHARED),YES)
23## Make sure that the static libraries can be built and used
24CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M#
25else
26## Make sure that the static libraries can be built
27STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
28endif
29
30## Flags for position independent code
31SHAREDLIBCFLAGS =
32SHAREDLIBCXXFLAGS =
33SHAREDLIBCPPFLAGS =
34
35## Additional flags when building libraries and with threads
36LIBCPPFLAGS =
37
38ifeq ($(ENABLE_RELEASE),1)
39# Make sure that assertions are disabled
40CPPFLAGS+=-DU_RELEASE=1#M#
41endif
42
43ifeq ($(ENABLE_DEBUG),1)
44# Pass debugging flag through
45CPPFLAGS+=-D_DEBUG=1#M#
46ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M#
47endif
48
49# -GF pools strings and places them into read-only memory
50# -EHsc enables exception handling
51# -Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility.
52# -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions.
53CFLAGS+=-GF -nologo
54CXXFLAGS+=-GF -nologo -EHsc -Zc:wchar_t
55CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE
56DEFS+=-DWIN32 -DCYGWINMSVC
57LDFLAGS+=-nologo
58
59# Commands to compile
60COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c
61COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c
62
63# Commands to link
64LINK.c= LINK.EXE -subsystem:console $(LDFLAGS)
65LINK.cc= LINK.EXE -subsystem:console $(LDFLAGS)
66
67## Commands to make a shared library
68SHLIB.c= LINK.EXE -DLL $(LDFLAGS)
69SHLIB.cc= LINK.EXE -DLL $(LDFLAGS)
70
71## Compiler switch to embed a runtime search path
72LD_RPATH=
73LD_RPATH_PRE=
74
75## Compiler switch to embed a library name
76LD_SONAME = -IMPLIB:$(SO_TARGET:.dll=.lib)
77
78## Shared object suffix
79SO = dll
80## Non-shared intermediate object suffix
81STATIC_O = ao
82# OUTOPT is for creating a specific output name
83OUTOPT = -out:
84
85# Static library prefix and file extension
86LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX)
87A = lib
88
89# Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead.
90AR = LIB.EXE#M#
91ARFLAGS := -nologo $(ARFLAGS:r=)#M#
92RANLIB = ls -s#M#
93AR_OUTOPT = -OUT:#M#
94
95## An import library is needed for z-OS, MSVC and Cygwin
96IMPORT_LIB_EXT = .lib
97
98LIBPREFIX=
99DEFAULT_LIBS = advapi32.lib
100
101# Change the stubnames so that poorly working FAT disks and installation programs can work.
102# This is also for backwards compatibility.
103DATA_STUBNAME = dt
104I18N_STUBNAME = in
105LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
106
107## Link commands to link to ICU libs
108ifeq ($(wildcard $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib),)
109LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib
110else
111LIBICUDT= $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib
112endif
113LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).lib $(LIBICUDT)
114LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib
115LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib
116LIBICULX= $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).lib
117LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).lib
118LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).lib
119LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib
120
121## These are the library specific LDFLAGS
122LDFLAGSICUDT+= -base:"0x4ad00000" -NOENTRY# The NOENTRY option is required for creating a resource-only DLL.
123LDFLAGSICUUC= -base:"0x4a800000"# in-uc = 1MB
124LDFLAGSICUI18N= -base:"0x4a900000"# io-in = 2MB
125LDFLAGSICUIO= -base:"0x4ab00000"# le-io = 1MB
126LDFLAGSICULE= -base:"0x4ac00000"# lx-le = 512KB
127LDFLAGSICULX= -base:"0x4ac80000"
128LDFLAGSCTESTFW=# Unused for now.
129LDFLAGSICUTOOLUTIL= -base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix.
130
131## Compilation rules
132%.$(STATIC_O): $(srcdir)/%.c
133 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -Fo$@ $<
134%.o: $(srcdir)/%.c
135 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -Fo$@ $<
136
137%.$(STATIC_O): $(srcdir)/%.cpp
138 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -Fo$@ $<
139%.o: $(srcdir)/%.cpp
140 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -Fo$@ $<
141
142
143## Dependency rules
144## This is a start to how depdendencies could work
145# The commented out rules may not properly delete the file when ^C is pressed
146# or the compiler fails.
147# make currently doesn't like rules with C:\\PROGRA~1\\.. in the depedency.
148# So system headers are ignored by ignoring \\
149%.d : $(srcdir)/%.c
150 @echo "generating dependency information for $<"
151 @$(GEN_DEPS.c) $< > $@
152# @echo -n "generating dependency information for "
153# @echo -n "$@ $(basename $<).o : " > $@
154# @$(SHELL) -ec '$(GEN_DEPS.c) $< \
155# | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \
156# | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \
157# || (rm -f $@ && echo $@ && false)'
158
159%.d : $(srcdir)/%.cpp
160 @echo "generating dependency information for $<"
161 @$(GEN_DEPS.cc) $< > $@
162# @echo -n "generating dependency information for "
163# @echo -n "$@ $(basename $<).o : " > $@
164# @$(SHELL) -ec '$(GEN_DEPS.cc) $< \
165# | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \
166# | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \
167# || (rm -f $@ && echo $@ && false)'
168
169## Compile a Windows resource file
170%.res : $(srcdir)/%.rc
171 rc.exe -fo$@ $(CPPFLAGS) $<
172
173## Versioned target for a shared library.
174FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
175MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
176
177## Starting in MSVC 2005, manifest files are required. This reduces the obnoxiousness of this feature.
178 POST_SO_BUILD_STEP = @([ -e $<.manifest ] && \
179 ( echo Embedding manifest into $< && mt.exe -nologo -manifest $<.manifest -outputresource:"$<;2" && rm -rf $<.manifest )) \
180 || true
181 POST_BUILD_STEP = @([ -e $@.manifest ] && \
182 ( echo Embedding manifest into $@ && mt.exe -nologo -manifest $@.manifest -outputresource:"$@;1" && rm -rf $@.manifest )) \
183 || true
184
185## Special pkgdata information that is needed
186PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
187ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; echo $(DESTDIR)$(ICUPKGDATA_DIR))#M#
188ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; echo $(DESTDIR)$(libdir))#M#
189
190## Versioned import library names. The library names are versioned,
191## but the import libraries do not need versioning.
192IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)#M#
193MIDDLE_IMPORT_LIB = $(IMPORT_LIB)#M#
194FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB)#M#
195
196# The following is for Makefile.inc's use.
197ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
198
199## Versioned libraries rules
200#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
201# $(RM) $@ && cp ${<F} $@
202
203# The following rule is sometimes a no op.
204# We only want to do a post-build step when a manifest file doesn't exist.
205%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
206 @echo -n
207 $(POST_SO_BUILD_STEP)
208
209## Install libraries as executable
210INSTALL-L=$(INSTALL_PROGRAM)
211
212# Environment variable to set a runtime search path
213LDLIBRARYPATH_ENVVAR = PATH
214
215# These are needed to allow the pkgdata nmake files to work
216PKGDATA_INVOKE_OPTS = MAKEFLAGS=
217
218# Include the version information in the shared library
219ENABLE_SO_VERSION_DATA=1
220
221## End MSYS-specific setup