]> git.saurik.com Git - apple/icu.git/blame - icuSources/config/mh-mingw64
ICU-66108.tar.gz
[apple/icu.git] / icuSources / config / mh-mingw64
CommitLineData
51004dcb 1## -*-makefile-*-
f3c0d7a5
A
2## Copyright (C) 2016 and later: Unicode, Inc. and others.
3## License & terms of use: http://www.unicode.org/copyright.html
51004dcb 4## Cygwin64/MinGW64 specific setup
b331163b 5## Copyright (c) 2012-2014, International Business Machines Corporation and
51004dcb
A
6## others. All Rights Reserved.
7
8# TODO: Finish the rest of this port. This platform port is incomplete.
9
10# This file is similar to mh-mingw
11# Any changes made here may also need to be made in mh-mingw
12
13# We install sbin tools into the same bin directory because
14# pkgdata needs some of the tools in sbin, and we can't always depend on
15# icu-config working on Windows.
16sbindir=$(bindir)
17
18## Commands to generate dependency files
19GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
20GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
21
22## Flags to create/use a static library
23ifneq ($(ENABLE_SHARED),YES)
24## Make sure that the static libraries can be built and used
25CPPFLAGS += -DU_STATIC_IMPLEMENTATION
26else
27## Make sure that the static libraries can be built
28STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
29endif
30
0f5d89e8
A
31## ICU requires a minimum target of Windows 7, and MinGW does not set this by default.
32## https://msdn.microsoft.com/en-us/library/aa383745.aspx
33CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
34
51004dcb
A
35## Flags for position independent code
36SHAREDLIBCFLAGS =
37SHAREDLIBCXXFLAGS =
38SHAREDLIBCPPFLAGS = -DPIC
39
40## Additional flags when building libraries and with threads
41THREADSCFLAGS = -mthreads
42THREADSCXXFLAGS = -mthreads
43LIBCPPFLAGS =
44
3d1f044b
A
45## Add 'd' suffix to the names of binary files with Debug configuration
46ifeq ($(ENABLE_DEBUG),1)
47ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M#
48endif
49
51004dcb
A
50# Commands to link. Link with C++ in case static libraries are used.
51LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS)
52#LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS)
53
54## Shared library options
55LD_SOOPTIONS= -Wl,-Bsymbolic
56
57## Commands to make a shared library
b331163b
A
58SHLIB.c= $(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(dir $@)lib$(notdir $(@:$(SO_TARGET_VERSION_MAJOR).$(SO)=))$(IMPORT_LIB_EXT)#M#
59SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(dir $@)lib$(notdir $(@:$(SO_TARGET_VERSION_MAJOR).$(SO)=))$(IMPORT_LIB_EXT)#M#
51004dcb
A
60
61## Compiler switch to embed a runtime search path
62LD_RPATH=
63LD_RPATH_PRE= -Wl,-rpath,
64
65## Compiler switch to embed a library name
66LD_SONAME =
67
68## Shared object suffix
69SO = dll
70## Non-shared intermediate object suffix
71STATIC_O = ao
72
73ifeq ($(ENABLE_SHARED),YES)
74SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
75else
76SO_TARGET_VERSION_SUFFIX =
77endif
78
79# Static library prefix and file extension
57a6839d 80LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
51004dcb
A
81A = a
82
83## An import library is needed for z/OS and MSVC
57a6839d 84IMPORT_LIB_EXT = .dll.a
51004dcb
A
85
86LIBPREFIX=
87
88# Change the stubnames so that poorly working FAT disks and installation programs can work.
89# This is also for backwards compatibility.
90DATA_STUBNAME = dt
91I18N_STUBNAME = in
92LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
93
b331163b
A
94#SH### copied from Makefile.inc
95#SH## for icu-config to test with
96#SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}"
97#SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}"
98
99#SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
100#SH#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
101#SH#
102#SH## ICULIBS is the set of libraries your application should link
103#SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well.
104#SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} "
105
340931cb
A
106# Note: The #M# is used to delete lines for icu-config
107MSYS_VERSION ?= $(if $(findstring Msys, $(shell uname -o)),$(word 1, $(subst ., ,$(shell uname -r))),0)#M#
108$(info Detected MSYS version: $(MSYS_VERSION))
109
110ifeq ($(MSYS_VERSION),$(filter $(MSYS_VERSION),0 1))
111 # Older versions of MSYS don't have cygpath by default. #M#
112
113 # Current full path directory. #M#
114 #CURR_FULL_DIR=$(shell pwd -W)#M# for MSYS
115 CURR_FULL_DIR?=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
116
117 # Current full path directory for use in source code in a -D compiler option. #M#
118 #CURR_SRCCODE_FULL_DIR=$(subst /,\\\\,$(shell pwd -W))#M# for MSYS
119 CURR_SRCCODE_FULL_DIR=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
120else
121 # MSYS2 and up have cygpath by default #M#
122
123 # Current full path directory. #M#
124 CURR_FULL_DIR?=$(shell cygpath . -a -m)#M#
125
126 # Current full path directory for use in source code in a -D compiler option. #M#
127 CURR_SRCCODE_FULL_DIR=$(shell cygpath . -a -m)#M#
128endif
51004dcb
A
129
130## Compilation rules
131%.$(STATIC_O): $(srcdir)/%.c
132 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
133%.o: $(srcdir)/%.c
134 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
135
136%.$(STATIC_O): $(srcdir)/%.cpp
137 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
138%.o: $(srcdir)/%.cpp
139 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
140
141
142## Dependency rules
143%.d: $(srcdir)/%.c
144 @echo "generating dependency information for $<"
145 @echo -n "$@ " > $@
146 @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE)
147
148%.d: $(srcdir)/%.cpp
149 @echo "generating dependency information for $<"
150 @echo -n "$@ " > $@
151 @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE)
152
153## Versioned target for a shared library.
154## Since symbolic links don't work the same way on Windows,
155## we only use the version major number.
156#FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
157FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
158MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
159
b331163b 160FINAL_IMPORT_LIB = $(dir $(SO_TARGET))lib$(notdir $(basename $(SO_TARGET)))$(IMPORT_LIB_EXT)#M#
51004dcb
A
161IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
162MIDDLE_IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
163
164## Special pkgdata information that is needed
165PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
166#ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
167#ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M#
168
169## Versioned libraries rules
170#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
171# $(RM) $@ && cp ${<F} $@
172%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
173 @echo -n
174
175# Environment variable to set a runtime search path
176LDLIBRARYPATH_ENVVAR = PATH
177
178# The type of assembly to write for generating an object file
179GENCCODE_ASSEMBLY=-a gcc-mingw64
180
181# These are needed to allow the pkgdata GNU make files to work
182PKGDATA_DEFS = -DU_MAKE=\"$(MAKE)\"
183
184## End Cygwin64/MinGW64 specific setup
185