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## Flags for position independent code 32SHAREDLIBCFLAGS = 33SHAREDLIBCXXFLAGS = 34SHAREDLIBCPPFLAGS = -DPIC 35 36## Additional flags when building libraries and with threads 37THREADSCFLAGS = -mthreads 38THREADSCXXFLAGS = -mthreads 39LIBCPPFLAGS = 40 41# Commands to link. Link with C++ in case static libraries are used. 42LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS) 43#LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) 44 45## Shared library options 46LD_SOOPTIONS= -Wl,-Bsymbolic 47 48## Commands to make a shared library 49SHLIB.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# 50SHLIB.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# 51 52## Compiler switch to embed a runtime search path 53LD_RPATH= 54LD_RPATH_PRE= -Wl,-rpath, 55 56## Compiler switch to embed a library name 57LD_SONAME = 58 59## Shared object suffix 60SO = dll 61## Non-shared intermediate object suffix 62STATIC_O = ao 63 64ifeq ($(ENABLE_SHARED),YES) 65SO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR) 66else 67SO_TARGET_VERSION_SUFFIX = 68endif 69 70# Static library prefix and file extension 71LIBSICU = $(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX) 72A = a 73 74## An import library is needed for z/OS and MSVC 75IMPORT_LIB_EXT = .dll.a 76 77LIBPREFIX=lib 78 79# Change the stubnames so that poorly working FAT disks and installation programs can work. 80# This is also for backwards compatibility. 81DATA_STUBNAME = dt 82I18N_STUBNAME = in 83LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) 84 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}" 89 90#SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" 91#SH#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)" 92#SH# 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} " 96 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 100CURR_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 103CURR_SRCCODE_FULL_DIR=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell 104 105## Compilation rules 106%.$(STATIC_O): $(srcdir)/%.c 107 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< 108%.o: $(srcdir)/%.c 109 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< 110 111%.$(STATIC_O): $(srcdir)/%.cpp 112 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< 113%.o: $(srcdir)/%.cpp 114 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< 115 116 117## Dependency rules 118%.d: $(srcdir)/%.c 119 @echo "generating dependency information for $<" 120 @echo -n "$@ " > $@ 121 @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE) 122 123%.d: $(srcdir)/%.cpp 124 @echo "generating dependency information for $<" 125 @echo -n "$@ " > $@ 126 @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE) 127 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) 132FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) 133MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) 134 135FINAL_IMPORT_LIB = $(dir $(SO_TARGET))lib$(notdir $(basename $(SO_TARGET)))$(IMPORT_LIB_EXT)#M# 136IMPORT_LIB = $(FINAL_IMPORT_LIB)#M# 137MIDDLE_IMPORT_LIB = $(FINAL_IMPORT_LIB)#M# 138 139## Special pkgdata information that is needed 140PKGDATA_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# 143 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) 148 @echo -n 149 150# Environment variable to set a runtime search path 151LDLIBRARYPATH_ENVVAR = PATH 152 153# The type of assembly to write for generating an object file 154GENCCODE_ASSEMBLY=-a gcc-cygwin 155 156# These are needed to allow the pkgdata GNU make files to work 157PKGDATA_DEFS = -DU_MAKE=\"$(MAKE)\" 158 159## End Cygwin/MinGW specific setup 160 161