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