intl/icu/source/config/mh-msys-msvc

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

mercurial