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