2005-12-01 02:06:30 +00:00
|
|
|
## Cygwin with Microsoft Visual C++ compiler specific setup
|
2010-04-26 05:36:56 +00:00
|
|
|
## Copyright (c) 2001-2010, International Business Machines Corporation and
|
2003-02-11 00:13:48 +00:00
|
|
|
## others. All Rights Reserved.
|
|
|
|
|
2004-05-05 17:55:08 +00:00
|
|
|
# We install sbin tools into the same bin directory because
|
|
|
|
# pkgdata needs some of the tools in sbin, and we can't always depend on
|
|
|
|
# icu-config working on Windows.
|
2004-10-02 06:53:24 +00:00
|
|
|
sbindir=$(bindir)
|
2004-05-05 17:55:08 +00:00
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
## Commands to generate dependency files
|
|
|
|
GEN_DEPS.c= :
|
|
|
|
GEN_DEPS.cc= :
|
2003-10-17 07:22:14 +00:00
|
|
|
#GEN_DEPS.c= $(COMPILE.c) /E
|
|
|
|
#GEN_DEPS.cc= $(COMPILE.cc) /E
|
2003-02-11 00:13:48 +00:00
|
|
|
|
2004-09-12 22:30:29 +00:00
|
|
|
## Flags to create/use a static library
|
|
|
|
ifneq ($(ENABLE_SHARED),YES)
|
|
|
|
## Make sure that the static libraries can be built and used
|
2005-12-01 02:06:30 +00:00
|
|
|
CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M#
|
2004-09-12 22:30:29 +00:00
|
|
|
else
|
|
|
|
## Make sure that the static libraries can be built
|
2004-04-28 03:09:32 +00:00
|
|
|
STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
|
2004-09-12 22:30:29 +00:00
|
|
|
endif
|
2004-04-28 03:09:32 +00:00
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
## Flags for position independent code
|
|
|
|
SHAREDLIBCFLAGS =
|
|
|
|
SHAREDLIBCXXFLAGS =
|
|
|
|
SHAREDLIBCPPFLAGS =
|
|
|
|
|
|
|
|
## Additional flags when building libraries and with threads
|
|
|
|
LIBCPPFLAGS =
|
2004-04-01 00:21:58 +00:00
|
|
|
|
2004-08-27 03:56:13 +00:00
|
|
|
ifeq ($(ENABLE_RELEASE),1)
|
|
|
|
# Make sure that assertions are disabled
|
2007-10-13 08:16:49 +00:00
|
|
|
CPPFLAGS+=-DU_RELEASE=1#M#
|
2004-08-27 03:56:13 +00:00
|
|
|
endif
|
|
|
|
|
2007-09-27 00:05:18 +00:00
|
|
|
ifeq ($(ENABLE_DEBUG),1)
|
|
|
|
# Pass debugging flag through
|
2007-10-13 08:16:49 +00:00
|
|
|
CPPFLAGS+=-D_DEBUG=1#M#
|
|
|
|
ICULIBSUFFIX:=$(ICULIBSUFFIX)d#M#
|
2007-09-27 00:05:18 +00:00
|
|
|
endif
|
|
|
|
|
2003-09-13 08:46:41 +00:00
|
|
|
# /GF pools strings and places them into read-only memory
|
2005-10-28 00:32:00 +00:00
|
|
|
# /EHsc enables exception handling
|
2006-01-17 21:12:17 +00:00
|
|
|
# /Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility.
|
2006-12-13 04:41:02 +00:00
|
|
|
# -D_CRT_SECURE_NO_DEPRECATE is needed to quiet warnings about using standard C functions.
|
2007-09-27 00:05:18 +00:00
|
|
|
CFLAGS+=/GF /nologo
|
|
|
|
CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t
|
|
|
|
CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE
|
2004-04-28 03:09:32 +00:00
|
|
|
DEFS+=-DWIN32
|
2008-11-24 20:04:52 +00:00
|
|
|
DEFS+=-DCYGWINMSVC
|
2003-02-11 00:13:48 +00:00
|
|
|
LDFLAGS+=/nologo
|
|
|
|
|
|
|
|
# Commands to compile
|
2003-09-13 08:46:41 +00:00
|
|
|
COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) /c
|
|
|
|
COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) /c
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
# Commands to link
|
2003-02-17 17:48:50 +00:00
|
|
|
LINK.c= LINK.EXE /subsystem:console $(LDFLAGS)
|
|
|
|
LINK.cc= LINK.EXE /subsystem:console $(LDFLAGS)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
## Commands to make a shared library
|
2006-12-15 16:28:19 +00:00
|
|
|
SHLIB.c= LINK.EXE /DLL $(LDFLAGS)
|
|
|
|
SHLIB.cc= LINK.EXE /DLL $(LDFLAGS)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
## Compiler switch to embed a runtime search path
|
|
|
|
LD_RPATH=
|
|
|
|
LD_RPATH_PRE=
|
|
|
|
|
|
|
|
## Compiler switch to embed a library name
|
2004-04-05 21:26:57 +00:00
|
|
|
LD_SONAME = /IMPLIB:$(SO_TARGET:.dll=.lib)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
## Shared object suffix
|
|
|
|
SO = dll
|
|
|
|
## Non-shared intermediate object suffix
|
2004-04-28 03:09:32 +00:00
|
|
|
STATIC_O = ao
|
2003-02-11 00:13:48 +00:00
|
|
|
# OUTOPT is for creating a specific output name
|
|
|
|
OUTOPT = /out:
|
|
|
|
|
2004-03-29 22:48:08 +00:00
|
|
|
# Static library prefix and file extension
|
|
|
|
LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX)
|
|
|
|
A = lib
|
|
|
|
|
2007-07-13 08:10:41 +00:00
|
|
|
# Cygwin's ar can't handle Win64 right now. So we use Microsoft's tool instead.
|
2007-10-13 08:16:49 +00:00
|
|
|
AR = LIB.EXE#M#
|
|
|
|
ARFLAGS := /nologo $(ARFLAGS:r=)#M#
|
|
|
|
RANLIB = ls -s#M#
|
|
|
|
AR_OUTOPT = /OUT:#M#
|
2007-07-13 08:10:41 +00:00
|
|
|
|
2008-10-10 16:52:15 +00:00
|
|
|
## An import library is needed for z/OS, MSVC and Cygwin
|
2003-03-19 01:56:39 +00:00
|
|
|
IMPORT_LIB_EXT = .lib
|
|
|
|
|
2004-04-05 21:26:57 +00:00
|
|
|
LIBPREFIX=
|
2003-09-13 08:46:41 +00:00
|
|
|
DEFAULT_LIBS = advapi32.lib
|
2003-02-11 00:13:48 +00:00
|
|
|
|
2004-04-19 17:32:30 +00:00
|
|
|
# Change the stubnames so that poorly working FAT disks and installation programs can work.
|
|
|
|
# This is also for backwards compatibility.
|
|
|
|
DATA_STUBNAME = dt
|
|
|
|
I18N_STUBNAME = in
|
2004-09-12 22:30:29 +00:00
|
|
|
LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
|
2004-04-19 17:32:30 +00:00
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
## Link commands to link to ICU libs
|
2007-07-13 08:10:41 +00:00
|
|
|
ifeq ($(wildcard $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib),)
|
2004-05-12 01:07:29 +00:00
|
|
|
LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib
|
2007-07-13 08:10:41 +00:00
|
|
|
else
|
|
|
|
LIBICUDT= $(LIBDIR)/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib
|
|
|
|
endif
|
2004-04-28 05:35:58 +00:00
|
|
|
LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).lib $(LIBICUDT)
|
2004-04-19 17:32:30 +00:00
|
|
|
LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib
|
|
|
|
LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib
|
|
|
|
LIBICULX= $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).lib
|
2004-05-06 05:56:22 +00:00
|
|
|
LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).lib
|
2004-04-19 17:32:30 +00:00
|
|
|
LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).lib
|
|
|
|
LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib
|
2004-05-06 05:56:22 +00:00
|
|
|
|
|
|
|
## These are the library specific LDFLAGS
|
2006-12-15 16:28:19 +00:00
|
|
|
LDFLAGSICUDT+= /base:"0x4ad00000" /NOENTRY# The NOENTRY option is required for creating a resource-only DLL.
|
2004-05-06 05:56:22 +00:00
|
|
|
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"
|
2004-05-14 20:08:13 +00:00
|
|
|
LDFLAGSCTESTFW=# Unused for now.
|
2004-05-06 05:56:22 +00:00
|
|
|
LDFLAGSICUTOOLUTIL= /base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix.
|
2003-02-11 00:13:48 +00:00
|
|
|
|
2004-10-02 06:53:24 +00:00
|
|
|
# The #M# is used to delete lines for icu-config
|
2004-03-31 22:33:46 +00:00
|
|
|
# Current full path directory.
|
2005-03-17 21:08:13 +00:00
|
|
|
CURR_FULL_DIR=$(subst \,/,$(shell cygpath -da .))#M# -m isn't used because it doesn't work on Win98
|
2004-03-31 22:33:46 +00:00
|
|
|
# Current full path directory for use in source code in a -D compiler option.
|
2005-03-22 03:37:06 +00:00
|
|
|
CURR_SRCCODE_FULL_DIR=$(subst \,\\,$(shell cygpath -da .))#M#
|
2003-02-11 00:13:48 +00:00
|
|
|
|
2004-06-07 04:41:08 +00:00
|
|
|
ifeq ($(srcdir),.)
|
|
|
|
SOURCE_FILE=$<
|
|
|
|
else
|
2004-10-02 06:53:24 +00:00
|
|
|
SOURCE_FILE=$(shell cygpath -dma $<)#M#
|
2004-06-07 04:41:08 +00:00
|
|
|
endif
|
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
## Compilation rules
|
|
|
|
%.$(STATIC_O): $(srcdir)/%.c
|
2004-06-07 04:41:08 +00:00
|
|
|
$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) /Fo$@ $(SOURCE_FILE)
|
2003-02-11 00:13:48 +00:00
|
|
|
%.o: $(srcdir)/%.c
|
2004-06-07 04:41:08 +00:00
|
|
|
$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) /Fo$@ $(SOURCE_FILE)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
%.$(STATIC_O): $(srcdir)/%.cpp
|
2004-06-07 04:41:08 +00:00
|
|
|
$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) /Fo$@ $(SOURCE_FILE)
|
2003-02-11 00:13:48 +00:00
|
|
|
%.o: $(srcdir)/%.cpp
|
2004-06-07 04:41:08 +00:00
|
|
|
$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) /Fo$@ $(SOURCE_FILE)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
## Dependency rules
|
2003-10-17 07:22:14 +00:00
|
|
|
## This is a start to how depdendencies could work
|
|
|
|
# The commented out rules may not properly delete the file when ^C is pressed
|
|
|
|
# or the compiler fails.
|
|
|
|
# make currently doesn't like rules with C:\\PROGRA~1\\.. in the depedency.
|
|
|
|
# So system headers are ignored by ignoring \\
|
2003-02-11 00:13:48 +00:00
|
|
|
%.d : $(srcdir)/%.c
|
|
|
|
@echo "generating dependency information for $<"
|
|
|
|
@$(GEN_DEPS.c) $< > $@
|
2003-10-17 07:22:14 +00:00
|
|
|
# @echo -n "generating dependency information for "
|
|
|
|
# @echo -n "$@ $(basename $<).o : " > $@
|
|
|
|
# @$(SHELL) -ec '$(GEN_DEPS.c) $< \
|
|
|
|
# | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \
|
|
|
|
# | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \
|
|
|
|
# || (rm -f $@ && echo $@ && false)'
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
%.d : $(srcdir)/%.cpp
|
|
|
|
@echo "generating dependency information for $<"
|
|
|
|
@$(GEN_DEPS.cc) $< > $@
|
2003-10-17 07:22:14 +00:00
|
|
|
# @echo -n "generating dependency information for "
|
|
|
|
# @echo -n "$@ $(basename $<).o : " > $@
|
|
|
|
# @$(SHELL) -ec '$(GEN_DEPS.cc) $< \
|
|
|
|
# | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \
|
|
|
|
# | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \
|
|
|
|
# || (rm -f $@ && echo $@ && false)'
|
2003-02-11 00:13:48 +00:00
|
|
|
|
2003-02-17 17:48:50 +00:00
|
|
|
## Compile a Windows resource file
|
|
|
|
%.res : $(srcdir)/%.rc
|
2007-09-27 00:05:18 +00:00
|
|
|
rc.exe /fo$@ $(CPPFLAGS) $(SOURCE_FILE)
|
2003-02-17 17:48:50 +00:00
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
## Versioned target for a shared library.
|
2003-09-15 22:31:59 +00:00
|
|
|
FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
|
2004-10-21 16:22:07 +00:00
|
|
|
MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
|
2004-06-17 18:14:07 +00:00
|
|
|
|
2006-12-16 21:07:01 +00:00
|
|
|
## Starting in MSVC 2005, manifest files are required. This reduces the obnoxiousness of this feature.
|
2007-10-13 08:16:49 +00:00
|
|
|
POST_SO_BUILD_STEP = @([ -e $<.manifest ] && \
|
2008-10-10 16:52:15 +00:00
|
|
|
( echo Embedding manifest into $< && mt.exe -nologo -manifest $<.manifest -outputresource:"$<;2" && rm -rf $<.manifest )) \
|
2007-10-13 08:16:49 +00:00
|
|
|
|| true
|
2008-10-10 16:52:15 +00:00
|
|
|
POST_BUILD_STEP = @([ -e $@.manifest ] && \
|
|
|
|
( echo Embedding manifest into $@ && mt.exe -nologo -manifest $@.manifest -outputresource:"$@;1" && rm -rf $@.manifest )) \
|
2007-10-13 08:16:49 +00:00
|
|
|
|| true
|
2006-12-16 21:07:01 +00:00
|
|
|
|
2004-06-17 18:14:07 +00:00
|
|
|
## Special pkgdata information that is needed
|
2004-03-31 22:33:46 +00:00
|
|
|
PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
|
2008-10-10 16:52:15 +00:00
|
|
|
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#
|
2003-03-19 01:56:39 +00:00
|
|
|
|
2004-04-07 16:54:33 +00:00
|
|
|
## Versioned import library names. The library names are versioned,
|
|
|
|
## but the import libraries do not need versioning.
|
2005-05-25 07:01:32 +00:00
|
|
|
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)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
|
|
|
## Versioned libraries rules
|
2003-03-21 01:12:29 +00:00
|
|
|
#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
|
2004-03-29 22:58:46 +00:00
|
|
|
# $(RM) $@ && cp ${<F} $@
|
2006-12-16 21:07:01 +00:00
|
|
|
|
|
|
|
# The following rule is sometimes a no op.
|
|
|
|
# We only want to do a post-build step when a manifest file doesn't exist.
|
2003-03-21 01:12:29 +00:00
|
|
|
%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
|
2004-10-21 16:22:07 +00:00
|
|
|
@echo -n
|
2006-12-16 21:07:01 +00:00
|
|
|
$(POST_SO_BUILD_STEP)
|
2003-02-11 00:13:48 +00:00
|
|
|
|
2004-11-17 20:41:21 +00:00
|
|
|
## Install libraries as executable
|
|
|
|
INSTALL-L=$(INSTALL_PROGRAM)
|
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
# Environment variable to set a runtime search path
|
|
|
|
LDLIBRARYPATH_ENVVAR = PATH
|
|
|
|
|
2003-09-26 00:14:25 +00:00
|
|
|
# These are needed to allow the pkgdata nmake files to work
|
2003-09-23 00:29:28 +00:00
|
|
|
PKGDATA_INVOKE_OPTS = MAKEFLAGS=
|
|
|
|
|
2003-09-26 00:14:25 +00:00
|
|
|
# Include the version information in the shared library
|
|
|
|
ENABLE_SO_VERSION_DATA=1
|
|
|
|
|
2003-02-11 00:13:48 +00:00
|
|
|
## End Cygwin-specific setup
|
|
|
|
|