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