2 ## Copyright (C) 2016 and later: Unicode, Inc. and others.
3 ## License & terms of use: http://www.unicode.org/copyright.html
4 ## Cygwin64/MinGW64 specific setup
5 ## Copyright (c) 2012-2014, International Business Machines Corporation and
6 ## others. All Rights Reserved.
8 # TODO: Finish the rest of this port. This platform port is incomplete.
10 # This file is similar to mh-mingw
11 # Any changes made here may also need to be made in mh-mingw
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.
18 ## Commands to generate dependency files
19 GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
20 GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS)
22 ## Flags to create/use a static library
23 ifneq ($(ENABLE_SHARED),YES)
24 ## Make sure that the static libraries can be built and used
25 CPPFLAGS += -DU_STATIC_IMPLEMENTATION
27 ## Make sure that the static libraries can be built
28 STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
31 ## Flags for position independent code
34 SHAREDLIBCPPFLAGS = -DPIC
36 ## Additional flags when building libraries and with threads
37 THREADSCFLAGS = -mthreads
38 THREADSCXXFLAGS = -mthreads
41 # Commands to link. Link with C++ in case static libraries are used.
42 LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS)
43 #LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS)
45 ## Shared library options
46 LD_SOOPTIONS= -Wl,-Bsymbolic
48 ## Commands to make a shared library
49 SHLIB.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#
50 SHLIB.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#
52 ## Compiler switch to embed a runtime search path
54 LD_RPATH_PRE= -Wl,-rpath,
56 ## Compiler switch to embed a library name
59 ## Shared object suffix
61 ## Non-shared intermediate object suffix
64 ifeq ($(ENABLE_SHARED),YES)
65 SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
67 SO_TARGET_VERSION_SUFFIX =
70 # Static library prefix and file extension
71 LIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
74 ## An import library is needed for z/OS and MSVC
75 IMPORT_LIB_EXT = .dll.a
79 # Change the stubnames so that poorly working FAT disks and installation programs can work.
80 # This is also for backwards compatibility.
83 LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
85 #SH### copied from Makefile.inc
86 #SH## for icu-config to test with
87 #SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}"
88 #SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}"
90 #SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
91 #SH#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
93 #SH## ICULIBS is the set of libraries your application should link
94 #SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well.
95 #SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} "
97 # The #M# is used to delete lines for icu-config
98 # Current full path directory.
99 #CURR_FULL_DIR=$(shell pwd -W)#M# for MSYS
100 CURR_FULL_DIR?=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
101 # Current full path directory for use in source code in a -D compiler option.
102 #CURR_SRCCODE_FULL_DIR=$(subst /,\\\\,$(shell pwd -W))#M# for MSYS
103 CURR_SRCCODE_FULL_DIR=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
106 %.$(STATIC_O): $(srcdir)/%.c
107 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
109 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
111 %.$(STATIC_O): $(srcdir)/%.cpp
112 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
114 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
119 @echo "generating dependency information for $<"
121 @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE)
124 @echo "generating dependency information for $<"
126 @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE)
128 ## Versioned target for a shared library.
129 ## Since symbolic links don't work the same way on Windows,
130 ## we only use the version major number.
131 #FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
132 FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
133 MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
135 FINAL_IMPORT_LIB = $(dir $(SO_TARGET))lib$(notdir $(basename $(SO_TARGET)))$(IMPORT_LIB_EXT)#M#
136 IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
137 MIDDLE_IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
139 ## Special pkgdata information that is needed
140 PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
141 #ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
142 #ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M#
144 ## Versioned libraries rules
145 #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
146 # $(RM) $@ && cp ${<F} $@
147 %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
150 # Environment variable to set a runtime search path
151 LDLIBRARYPATH_ENVVAR = PATH
153 # The type of assembly to write for generating an object file
154 GENCCODE_ASSEMBLY=-a gcc-mingw64
156 # These are needed to allow the pkgdata GNU make files to work
157 PKGDATA_DEFS = -DU_MAKE=\"$(MAKE)\"
159 ## End Cygwin64/MinGW64 specific setup