1## -*-makefile-*- 2## Copyright (C) 2016 and later: Unicode, Inc. and others. 3## License & terms of use: http://www.unicode.org/copyright.html 4## Cygwin/MinGW specific setup 5## Copyright (c) 2001-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# This file is similar to mh-mingw64 11# Any changes made here may also need to be made in mh-mingw64 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 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 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 45# Commands to link. Link with C++ in case static libraries are used. 46LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS) 47#LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) 48 49## Shared library options 50LD_SOOPTIONS= -Wl,-Bsymbolic 51 52## Commands to make a shared library 53SHLIB.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# 54SHLIB.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# 55 56## Compiler switch to embed a runtime search path 57LD_RPATH= 58LD_RPATH_PRE= -Wl,-rpath, 59 60## Compiler switch to embed a library name 61LD_SONAME = 62 63## Shared object suffix 64SO = dll 65## Non-shared intermediate object suffix 66STATIC_O = ao 67 68ifeq ($(ENABLE_SHARED),YES) 69SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR) 70else 71SO_TARGET_VERSION_SUFFIX = 72endif 73 74# Static library prefix and file extension 75LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX) 76A = a 77 78## An import library is needed for z/OS and MSVC 79IMPORT_LIB_EXT = .dll.a 80 81LIBPREFIX=lib 82 83# Change the stubnames so that poorly working FAT disks and installation programs can work. 84# This is also for backwards compatibility. 85DATA_STUBNAME = dt 86I18N_STUBNAME = in 87LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) 88 89#SH### copied from Makefile.inc 90#SH## for icu-config to test with 91#SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}" 92#SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}" 93 94#SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" 95#SH#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" 96#SH# 97#SH## ICULIBS is the set of libraries your application should link 98#SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well. 99#SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} " 100 101# The #M# is used to delete lines for icu-config 102# Current full path directory. 103#CURR_FULL_DIR=$(shell pwd -W)#M# for MSYS 104CURR_FULL_DIR?=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell 105# Current full path directory for use in source code in a -D compiler option. 106#CURR_SRCCODE_FULL_DIR=$(subst /,\\\\,$(shell pwd -W))#M# for MSYS 107CURR_SRCCODE_FULL_DIR=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell 108 109## Compilation rules 110%.$(STATIC_O): $(srcdir)/%.c 111 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 112%.o: $(srcdir)/%.c 113 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 114 115%.$(STATIC_O): $(srcdir)/%.cpp 116 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 117%.o: $(srcdir)/%.cpp 118 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 119 120 121## Dependency rules 122%.d: $(srcdir)/%.c 123 @echo "generating dependency information for $<" 124 @echo -n "$@ " > $@ 125 @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE) 126 127%.d: $(srcdir)/%.cpp 128 @echo "generating dependency information for $<" 129 @echo -n "$@ " > $@ 130 @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE) 131 132## Versioned target for a shared library. 133## Since symbolic links don't work the same way on Windows, 134## we only use the version major number. 135#FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO) 136FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) 137MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) 138 139FINAL_IMPORT_LIB = $(dir $(SO_TARGET))lib$(notdir $(basename $(SO_TARGET)))$(IMPORT_LIB_EXT)#M# 140IMPORT_LIB = $(FINAL_IMPORT_LIB)#M# 141MIDDLE_IMPORT_LIB = $(FINAL_IMPORT_LIB)#M# 142 143## Special pkgdata information that is needed 144PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR) 145#ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M# 146#ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M# 147 148## Versioned libraries rules 149#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) 150# $(RM) $@ && cp ${<F} $@ 151%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO) 152 @echo -n 153 154# Environment variable to set a runtime search path 155LDLIBRARYPATH_ENVVAR = PATH 156 157# The type of assembly to write for generating an object file 158GENCCODE_ASSEMBLY=-a gcc-cygwin 159 160# These are needed to allow the pkgdata GNU make files to work 161PKGDATA_DEFS = -DU_MAKE=\"$(MAKE)\" 162 163## End Cygwin/MinGW specific setup 164 165