michael@0: ## MSYS with Microsoft Visual C++ compiler specific setup michael@0: ## Copyright (c) 2001-2013, International Business Machines Corporation and michael@0: ## others. All Rights Reserved. michael@0: michael@0: # We install sbin tools into the same bin directory because michael@0: # pkgdata needs some of the tools in sbin, and we can't always depend on michael@0: # icu-config working on Windows. michael@0: sbindir=$(bindir) michael@0: michael@0: ## Commands to generate dependency files michael@0: GEN_DEPS.c= : michael@0: GEN_DEPS.cc= : michael@0: #GEN_DEPS.c= $(COMPILE.c) -E michael@0: #GEN_DEPS.cc= $(COMPILE.cc) -E michael@0: michael@0: ## Flags to create/use a static library michael@0: ifneq ($(ENABLE_SHARED),YES) michael@0: ## Make sure that the static libraries can be built and used michael@0: CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M# michael@0: else michael@0: ## Make sure that the static libraries can be built michael@0: STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION michael@0: endif michael@0: michael@0: ## Flags for position independent code michael@0: SHAREDLIBCFLAGS = michael@0: SHAREDLIBCXXFLAGS = michael@0: SHAREDLIBCPPFLAGS = michael@0: michael@0: ## Additional flags when building libraries and with threads michael@0: LIBCPPFLAGS = michael@0: michael@0: ifeq ($(ENABLE_RELEASE),1) michael@0: # Make sure that assertions are disabled michael@0: CPPFLAGS+=-DU_RELEASE=1#M# michael@0: endif michael@0: michael@0: ifeq ($(ENABLE_DEBUG),1) michael@0: # Pass debugging flag through michael@0: CPPFLAGS+=-D_DEBUG=1#M# michael@0: ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M# michael@0: endif michael@0: michael@0: # -GF pools strings and places them into read-only memory michael@0: # -EHsc enables exception handling michael@0: # -Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. michael@0: # -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions. michael@0: CFLAGS+=-GF -nologo michael@0: CXXFLAGS+=-GF -nologo -EHsc -Zc:wchar_t michael@0: CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE michael@0: DEFS+=-DWIN32 -DCYGWINMSVC michael@0: LDFLAGS+=-nologo michael@0: michael@0: # Commands to compile michael@0: COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) -c michael@0: COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) -c michael@0: michael@0: # Commands to link michael@0: LINK.c= LINK.EXE -subsystem:console $(LDFLAGS) michael@0: LINK.cc= LINK.EXE -subsystem:console $(LDFLAGS) michael@0: michael@0: ## Commands to make a shared library michael@0: SHLIB.c= LINK.EXE -DLL $(LDFLAGS) michael@0: SHLIB.cc= LINK.EXE -DLL $(LDFLAGS) michael@0: michael@0: ## Compiler switch to embed a runtime search path michael@0: LD_RPATH= michael@0: LD_RPATH_PRE= michael@0: michael@0: ## Compiler switch to embed a library name michael@0: LD_SONAME = -IMPLIB:$(SO_TARGET:.dll=.lib) michael@0: michael@0: ## Shared object suffix michael@0: SO = dll michael@0: ## Non-shared intermediate object suffix michael@0: STATIC_O = ao michael@0: # OUTOPT is for creating a specific output name michael@0: OUTOPT = -out: michael@0: michael@0: # Static library prefix and file extension michael@0: LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX) michael@0: A = lib michael@0: michael@0: # Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead. michael@0: AR = LIB.EXE#M# michael@0: ARFLAGS := -nologo $(ARFLAGS:r=)#M# michael@0: RANLIB = ls -s#M# michael@0: AR_OUTOPT = -OUT:#M# michael@0: michael@0: ## An import library is needed for z-OS, MSVC and Cygwin michael@0: IMPORT_LIB_EXT = .lib michael@0: michael@0: LIBPREFIX= michael@0: DEFAULT_LIBS = advapi32.lib michael@0: michael@0: # Change the stubnames so that poorly working FAT disks and installation programs can work. michael@0: # This is also for backwards compatibility. michael@0: DATA_STUBNAME = dt michael@0: I18N_STUBNAME = in michael@0: LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) michael@0: michael@0: ## Link commands to link to ICU libs michael@0: ifeq ($(wildcard $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib),) michael@0: LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib michael@0: else michael@0: LIBICUDT= $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib michael@0: endif michael@0: LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).lib $(LIBICUDT) michael@0: LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib michael@0: LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib michael@0: LIBICULX= $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).lib michael@0: LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).lib michael@0: LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).lib michael@0: LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib michael@0: michael@0: ## These are the library specific LDFLAGS michael@0: LDFLAGSICUDT+= -base:"0x4ad00000" -NOENTRY# The NOENTRY option is required for creating a resource-only DLL. michael@0: LDFLAGSICUUC= -base:"0x4a800000"# in-uc = 1MB michael@0: LDFLAGSICUI18N= -base:"0x4a900000"# io-in = 2MB michael@0: LDFLAGSICUIO= -base:"0x4ab00000"# le-io = 1MB michael@0: LDFLAGSICULE= -base:"0x4ac00000"# lx-le = 512KB michael@0: LDFLAGSICULX= -base:"0x4ac80000" michael@0: LDFLAGSCTESTFW=# Unused for now. michael@0: LDFLAGSICUTOOLUTIL= -base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. michael@0: michael@0: ## Compilation rules michael@0: %.$(STATIC_O): $(srcdir)/%.c michael@0: $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -Fo$@ $< michael@0: %.o: $(srcdir)/%.c michael@0: $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -Fo$@ $< michael@0: michael@0: %.$(STATIC_O): $(srcdir)/%.cpp michael@0: $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -Fo$@ $< michael@0: %.o: $(srcdir)/%.cpp michael@0: $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -Fo$@ $< michael@0: michael@0: michael@0: ## Dependency rules michael@0: ## This is a start to how depdendencies could work michael@0: # The commented out rules may not properly delete the file when ^C is pressed michael@0: # or the compiler fails. michael@0: # make currently doesn't like rules with C:\\PROGRA~1\\.. in the depedency. michael@0: # So system headers are ignored by ignoring \\ michael@0: %.d : $(srcdir)/%.c michael@0: @echo "generating dependency information for $<" michael@0: @$(GEN_DEPS.c) $< > $@ michael@0: # @echo -n "generating dependency information for " michael@0: # @echo -n "$@ $(basename $<).o : " > $@ michael@0: # @$(SHELL) -ec '$(GEN_DEPS.c) $< \ michael@0: # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ michael@0: # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ michael@0: # || (rm -f $@ && echo $@ && false)' michael@0: michael@0: %.d : $(srcdir)/%.cpp michael@0: @echo "generating dependency information for $<" michael@0: @$(GEN_DEPS.cc) $< > $@ michael@0: # @echo -n "generating dependency information for " michael@0: # @echo -n "$@ $(basename $<).o : " > $@ michael@0: # @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ michael@0: # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ michael@0: # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ michael@0: # || (rm -f $@ && echo $@ && false)' michael@0: michael@0: ## Compile a Windows resource file michael@0: %.res : $(srcdir)/%.rc michael@0: rc.exe -fo$@ $(CPPFLAGS) $< michael@0: michael@0: ## Versioned target for a shared library. michael@0: FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) michael@0: MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) michael@0: michael@0: ## Starting in MSVC 2005, manifest files are required. This reduces the obnoxiousness of this feature. michael@0: POST_SO_BUILD_STEP = @([ -e $<.manifest ] && \ michael@0: ( echo Embedding manifest into $< && mt.exe -nologo -manifest $<.manifest -outputresource:"$<;2" && rm -rf $<.manifest )) \ michael@0: || true michael@0: POST_BUILD_STEP = @([ -e $@.manifest ] && \ michael@0: ( echo Embedding manifest into $@ && mt.exe -nologo -manifest $@.manifest -outputresource:"$@;1" && rm -rf $@.manifest )) \ michael@0: || true michael@0: michael@0: ## Special pkgdata information that is needed michael@0: PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR) michael@0: ICUPKGDATA_INSTALL_DIR = $(shell mkdir -p $(DESTDIR)$(ICUPKGDATA_DIR) ; echo $(DESTDIR)$(ICUPKGDATA_DIR))#M# michael@0: ICUPKGDATA_INSTALL_LIBDIR = $(shell mkdir -p $(DESTDIR)$(libdir) ; echo $(DESTDIR)$(libdir))#M# michael@0: michael@0: ## Versioned import library names. The library names are versioned, michael@0: ## but the import libraries do not need versioning. michael@0: IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)#M# michael@0: MIDDLE_IMPORT_LIB = $(IMPORT_LIB)#M# michael@0: FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB)#M# michael@0: michael@0: # The following is for Makefile.inc's use. michael@0: ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) michael@0: michael@0: ## Versioned libraries rules michael@0: #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) michael@0: # $(RM) $@ && cp ${