## Cygwin with Microsoft Visual C++ compiler specific setup
-## Copyright (c) 2001-2010, International Business Machines Corporation and
+## 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
## 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)
STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
endif
+## ICU requires a minimum target of Windows 7, and WINVER is not set to this by default.
+## https://msdn.microsoft.com/en-us/library/aa383745.aspx
+CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
+
## Flags for position independent code
SHAREDLIBCFLAGS =
SHAREDLIBCXXFLAGS =
# /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.
-CFLAGS+=/GF /nologo
-CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t
+# -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
-DEFS+=-DCYGWINMSVC
-LDFLAGS+=/nologo
+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 /DLL $(LDFLAGS)
-SHLIB.cc= LINK.EXE /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)
# 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#
+ARFLAGS := -nologo $(ARFLAGS:r=)#M#
RANLIB = ls -s#M#
-AR_OUTOPT = /OUT:#M#
+AR_OUTOPT = -OUT:#M#
## An import library is needed for z/OS, MSVC and Cygwin
IMPORT_LIB_EXT = .lib
LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib
## These are the library specific LDFLAGS
-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
-LDFLAGSICULE= /base:"0x4ac00000"# lx-le = 512KB
-LDFLAGSICULX= /base:"0x4ac80000"
+LDFLAGSICUDT+= -NOENTRY# The NOENTRY option is required for creating a resource-only DLL.
+LDFLAGSICUUC=# Unused for now.
+LDFLAGSICUI18N=# Unused for now.
+LDFLAGSICUIO=# Unused for now.
+LDFLAGSICULX=# Unused for now.
LDFLAGSCTESTFW=# Unused for now.
-LDFLAGSICUTOOLUTIL= /base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix.
+LDFLAGSICUTOOLUTIL=# Unused for now.
# The #M# is used to delete lines for icu-config
# Current full path directory.
-CURR_FULL_DIR=$(subst \,/,$(shell cygpath -da .))#M# -m isn't used because it doesn't work on Win98
+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#
## 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
## Compile a Windows resource file
%.res : $(srcdir)/%.rc
- rc.exe /fo$@ $(CPPFLAGS) $(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)