X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/374ca955a76ecab1204ca8bfa63ff9238d998416..f3c0d7a59d99c2a94c6b8822291f0e42be3773c9:/icuSources/config/mh-cygwin-msvc diff --git a/icuSources/config/mh-cygwin-msvc b/icuSources/config/mh-cygwin-msvc index 2e28e71a..4744bb94 100644 --- a/icuSources/config/mh-cygwin-msvc +++ b/icuSources/config/mh-cygwin-msvc @@ -1,5 +1,7 @@ -## Cygwin-specific setup -## Copyright (c) 2001-2004, International Business Machines Corporation and +## Cygwin with Microsoft Visual C++ compiler specific setup +## Copyright (C) 2016 and later: Unicode, Inc. and others. +## License & terms of use: http://www.unicode.org/copyright.html +## Copyright (c) 2001-2013, International Business Machines Corporation and ## others. All Rights Reserved. # We install sbin tools into the same bin directory because @@ -10,13 +12,13 @@ sbindir=$(bindir) ## Commands to generate dependency files GEN_DEPS.c= : GEN_DEPS.cc= : -#GEN_DEPS.c= $(COMPILE.c) /E -#GEN_DEPS.cc= $(COMPILE.cc) /E +#GEN_DEPS.c= $(COMPILE.c) -E +#GEN_DEPS.cc= $(COMPILE.cc) -E ## Flags to create/use a static library ifneq ($(ENABLE_SHARED),YES) ## Make sure that the static libraries can be built and used -CPPFLAGS += -DU_STATIC_IMPLEMENTATION +CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M# else ## Make sure that the static libraries can be built STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION @@ -30,64 +32,65 @@ SHAREDLIBCPPFLAGS = ## Additional flags when building libraries and with threads LIBCPPFLAGS = -ifeq ($(ENABLE_DEBUG),1) -# /MDd means 'compiles and links a debugable multithreaded program with DLL' -THREADSCFLAGS += /MDd -THREADSCXXFLAGS += /MDd -# The debug flags are defined here because configure can't handle them. -CFLAGS+=/Zi -CXXFLAGS+=/Zi -LDFLAGS+=/DEBUG -else -# /MD means 'compiles and links a multithreaded program with DLL' -THREADSCFLAGS += /MD -THREADSCXXFLAGS += /MD -endif - ifeq ($(ENABLE_RELEASE),1) # Make sure that assertions are disabled -CPPFLAGS+=-DU_RELEASE=1 +CPPFLAGS+=-DU_RELEASE=1#M# +endif + +ifeq ($(ENABLE_DEBUG),1) +# Pass debugging flag through +CPPFLAGS+=-D_DEBUG=1#M# +ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M# endif # /GF pools strings and places them into read-only memory -# /GX enables exception handling -CFLAGS += /GF -CXXFLAGS += /GF /GX -CPPFLAGS+=/nologo -DEFS+=-DWIN32 -LDFLAGS+=/nologo +# /EHsc enables exception handling +# /Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. +# -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions. +# -utf-8 set source file encoding to utf-8. +CFLAGS+=-GF -nologo -utf-8 +CXXFLAGS+=-GF -nologo -EHsc -Zc:wchar_t -utf-8 +CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE +DEFS+=-DWIN32 -DCYGWINMSVC +LDFLAGS+=-nologo # Commands to compile -COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) /c -COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) /c +COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c +COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c # Commands to link -LINK.c= LINK.EXE /subsystem:console $(LDFLAGS) -LINK.cc= LINK.EXE /subsystem:console $(LDFLAGS) +LINK.c= LINK.EXE -subsystem:console $(LDFLAGS) +LINK.cc= LINK.EXE -subsystem:console $(LDFLAGS) ## Commands to make a shared library -SHLIB.c= LINK.EXE /subsystem:console /DLL $(LDFLAGS) -SHLIB.cc= LINK.EXE /subsystem:console /DLL $(LDFLAGS) +SHLIB.c= LINK.EXE -DLL $(LDFLAGS) +SHLIB.cc= LINK.EXE -DLL $(LDFLAGS) ## Compiler switch to embed a runtime search path LD_RPATH= LD_RPATH_PRE= ## Compiler switch to embed a library name -LD_SONAME = /IMPLIB:$(SO_TARGET:.dll=.lib) +LD_SONAME = -IMPLIB:$(SO_TARGET:.dll=.lib) ## Shared object suffix SO = dll ## Non-shared intermediate object suffix STATIC_O = ao # OUTOPT is for creating a specific output name -OUTOPT = /out: +OUTOPT = -out: # Static library prefix and file extension LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX) A = lib -## An import library is needed for z/OS and MSVC +# Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead. +AR = LIB.EXE#M# +ARFLAGS := -nologo $(ARFLAGS:r=)#M# +RANLIB = ls -s#M# +AR_OUTOPT = -OUT:#M# + +## An import library is needed for z/OS, MSVC and Cygwin IMPORT_LIB_EXT = .lib LIBPREFIX= @@ -100,7 +103,11 @@ I18N_STUBNAME = in LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) ## Link commands to link to ICU libs +ifeq ($(wildcard $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib),) LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib +else +LIBICUDT= $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib +endif LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).lib $(LIBICUDT) LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib @@ -110,20 +117,19 @@ LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSU LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib ## These are the library specific LDFLAGS -LDFLAGSICUDT=# Unused for now. -LDFLAGSICUUC= /base:"0x4a800000"# in-uc = 1MB -LDFLAGSICUI18N= /base:"0x4a900000"# io-in = 2MB -LDFLAGSICUIO= /base:"0x4ab00000"# le-io = 1MB -LDFLAGSICULE= /base:"0x4ac00000"# lx-le = 512KB -LDFLAGSICULX= /base:"0x4ac80000" +LDFLAGSICUDT+= -base:"0x4ad00000" -NOENTRY# The NOENTRY option is required for creating a resource-only DLL. +LDFLAGSICUUC= -base:"0x4a800000"# in-uc = 1MB +LDFLAGSICUI18N= -base:"0x4a900000"# io-in = 2MB +LDFLAGSICUIO= -base:"0x4ab00000"# le-io = 1MB +LDFLAGSICULX= -base:"0x4ac80000" LDFLAGSCTESTFW=# Unused for now. -LDFLAGSICUTOOLUTIL= /base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. +LDFLAGSICUTOOLUTIL= -base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. # The #M# is used to delete lines for icu-config # Current full path directory. -CURR_FULL_DIR=$(shell cygpath -dma .)#M# +CURR_FULL_DIR?=$(subst \,/,$(shell cygpath -da .))#M# -m isn't used because it doesn't work on Win98 # Current full path directory for use in source code in a -D compiler option. -CURR_SRCCODE_FULL_DIR=$(subst \,\\\\,$(shell cygpath -da .))#M# +CURR_SRCCODE_FULL_DIR=$(subst \,\\,$(shell cygpath -da .))#M# ifeq ($(srcdir),.) SOURCE_FILE=$< @@ -133,14 +139,14 @@ endif ## Compilation rules %.$(STATIC_O): $(srcdir)/%.c - $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) /Fo$@ $(SOURCE_FILE) + $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -Fo$@ $(SOURCE_FILE) %.o: $(srcdir)/%.c - $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) /Fo$@ $(SOURCE_FILE) + $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -Fo$@ $(SOURCE_FILE) %.$(STATIC_O): $(srcdir)/%.cpp - $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) /Fo$@ $(SOURCE_FILE) + $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -Fo$@ $(SOURCE_FILE) %.o: $(srcdir)/%.cpp - $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) /Fo$@ $(SOURCE_FILE) + $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -Fo$@ $(SOURCE_FILE) ## Dependency rules @@ -171,30 +177,43 @@ endif ## Compile a Windows resource file %.res : $(srcdir)/%.rc - rc.exe /fo$@ $(SOURCE_FILE) + rc.exe -fo$@ $(CPPFLAGS) $(SOURCE_FILE) ## Versioned target for a shared library. FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) +## Starting in MSVC 2005, manifest files are required. This reduces the obnoxiousness of this feature. + POST_SO_BUILD_STEP = @([ -e $<.manifest ] && \ + ( echo Embedding manifest into $< && mt.exe -nologo -manifest $<.manifest -outputresource:"$<;2" && rm -rf $<.manifest )) \ + || true + POST_BUILD_STEP = @([ -e $@.manifest ] && \ + ( echo Embedding manifest into $@ && mt.exe -nologo -manifest $@.manifest -outputresource:"$@;1" && rm -rf $@.manifest )) \ + || true + ## Special pkgdata information that is needed PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR) -ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M# -ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M# +ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M# +ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; cygpath -dma $(DESTDIR)$(libdir))#M# ## Versioned import library names. The library names are versioned, ## but the import libraries do not need versioning. -IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT) -MIDDLE_IMPORT_LIB = $(IMPORT_LIB) -FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB) +IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)#M# +MIDDLE_IMPORT_LIB = $(IMPORT_LIB)#M# +FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB)#M# + +# The following is for Makefile.inc's use. +ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) ## Versioned libraries rules #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) # $(RM) $@ && cp ${