1ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## -*-makefile-*-
2ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Cygwin/MinGW specific setup
3f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius## Copyright (c) 2001-2014, International Business Machines Corporation and
4ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## others. All Rights Reserved.
5ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
6ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# TODO: Finish the rest of this port. This platform port is incomplete.
7ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
88393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius# This file is similar to mh-mingw64
98393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius# Any changes made here may also need to be made in mh-mingw64
108393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig Cornelius
11ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# We install sbin tools into the same bin directory because
12ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# pkgdata needs some of the tools in sbin, and we can't always depend on
13ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# icu-config working on Windows.
14ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Querusbindir=$(bindir)
15ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
16ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Commands to generate dependency files
17ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruGEN_DEPS.c=	$(CC) -E -MM $(DEFS) $(CPPFLAGS)
18ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruGEN_DEPS.cc=	$(CXX) -E -MM $(DEFS) $(CPPFLAGS)
19ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
20ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Flags to create/use a static library
21ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruifneq ($(ENABLE_SHARED),YES)
22ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Make sure that the static libraries can be built and used
23ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruCPPFLAGS += -DU_STATIC_IMPLEMENTATION
24ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruelse
25ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Make sure that the static libraries can be built
26ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSTATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
27ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queruendif
28ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
29ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Flags for position independent code
30ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSHAREDLIBCFLAGS = 
31ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSHAREDLIBCXXFLAGS = 
32ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSHAREDLIBCPPFLAGS = -DPIC
33ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
34ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Additional flags when building libraries and with threads
35ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTHREADSCFLAGS = -mthreads
36ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruTHREADSCXXFLAGS = -mthreads
37ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLIBCPPFLAGS =
38ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
39ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Commands to link. Link with C++ in case static libraries are used.
40ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLINK.c=       $(CXX) $(CXXFLAGS) $(LDFLAGS)
41ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#LINK.cc=      $(CXX) $(CXXFLAGS) $(LDFLAGS)
42ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
43103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius## Shared library options
44103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusLD_SOOPTIONS= -Wl,-Bsymbolic
45103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
46ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Commands to make a shared library
47f9878a236aa0d9662d8e40cafdaf2e04cd615835ccorneliusSHLIB.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#
48f9878a236aa0d9662d8e40cafdaf2e04cd615835ccorneliusSHLIB.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#
49ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
50ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Compiler switch to embed a runtime search path
51ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLD_RPATH=	
52ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLD_RPATH_PRE=	-Wl,-rpath,
53ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
54ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Compiler switch to embed a library name
55ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLD_SONAME = 
56ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
57ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Shared object suffix
58ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSO = dll
59ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Non-shared intermediate object suffix
60ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSTATIC_O = ao
61103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
62103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliusifeq ($(ENABLE_SHARED),YES)
63ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruSO_TARGET_VERSION_SUFFIX = $(SO_TARGET_VERSION_MAJOR)
64103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliuselse
65103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusSO_TARGET_VERSION_SUFFIX = 
66103e9ffba2cba345d0078eb8b8db33249f81840aCraig Corneliusendif
67ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
68ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Static library prefix and file extension
6959d709d503bab6e2b61931737e662dd293b40578ccorneliusLIBSICU = lib$(LIBPREFIX)$(STATIC_PREFIX)$(ICUPREFIX)
70103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusA = a
71ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
72ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## An import library is needed for z/OS and MSVC
7359d709d503bab6e2b61931737e662dd293b40578ccorneliusIMPORT_LIB_EXT = .dll.a
74ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
7554dcd9b6a06071f647dac967e9e267abb9410720Craig CorneliusLIBPREFIX=
76ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
77ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Change the stubnames so that poorly working FAT disks and installation programs can work.
78ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# This is also for backwards compatibility.
79ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruDATA_STUBNAME = dt
80ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruI18N_STUBNAME = in
81ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
82ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
83f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH### copied from Makefile.inc
84f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH## for icu-config to test with
85f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}"
86f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH#ICULIBS_COMMON_LIB_NAME_A="${LIBICU}${COMMON_STUBNAME}${ICULIBSUFFIX}.${A}"
87f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
88f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH#ICULIBS_DATA="-l$(ICUPREFIX)$(DATA_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
89f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH#ICULIBS_I18N="-l$(ICUPREFIX)$(I18N_STUBNAME)$(ICULIBSUFFIX)$(ICULIBSUFFIX_VERSION)"
90f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH#
91f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH## ICULIBS is the set of libraries your application should link
92f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH## with usually. Many applications will want to add ${ICULIBS_I18N} as well. 
93f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius#SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA} "
94f9878a236aa0d9662d8e40cafdaf2e04cd615835ccornelius
95ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# The #M# is used to delete lines for icu-config
96ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Current full path directory.
97ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#CURR_FULL_DIR=$(shell pwd -W)#M# for MSYS
988393335b955da7340c9f19b1b4b2d6c0c2c04be7Craig CorneliusCURR_FULL_DIR?=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
99ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Current full path directory for use in source code in a -D compiler option.
100ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#CURR_SRCCODE_FULL_DIR=$(subst /,\\\\,$(shell pwd -W))#M# for MSYS
10185bf2e2fbc60a9f938064abc8127d61da7d19882Claire HoCURR_SRCCODE_FULL_DIR=$(subst \,/,$(shell cmd /c cd))#M# for Cygwin shell
102ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
103ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Compilation rules
104ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.$(STATIC_O): $(srcdir)/%.c
105ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
106ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.o: $(srcdir)/%.c
107ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
108ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
109ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.$(STATIC_O): $(srcdir)/%.cpp
110ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
111ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.o: $(srcdir)/%.cpp
112ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	$(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
113ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
114ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
115ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Dependency rules
116ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.d: $(srcdir)/%.c
117ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "generating dependency information for $<"
118ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo -n "$@ " > $@
119ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE)
120ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
121ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.d: $(srcdir)/%.cpp
122ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo "generating dependency information for $<"
123ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo -n "$@ " > $@
124ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE)
125ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
126ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Versioned target for a shared library.
127ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Since symbolic links don't work the same way on Windows,
128ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## we only use the version major number.
129ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
130ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruFINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
131ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruMIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
132ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
133f9878a236aa0d9662d8e40cafdaf2e04cd615835ccorneliusFINAL_IMPORT_LIB = $(dir $(SO_TARGET))lib$(notdir $(basename $(SO_TARGET)))$(IMPORT_LIB_EXT)#M#
134103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusIMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
135103e9ffba2cba345d0078eb8b8db33249f81840aCraig CorneliusMIDDLE_IMPORT_LIB = $(FINAL_IMPORT_LIB)#M#
136103e9ffba2cba345d0078eb8b8db33249f81840aCraig Cornelius
137ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Special pkgdata information that is needed
138ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruPKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR)
139ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M#
140ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M#
141ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
142ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## Versioned libraries rules
143ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
144ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru#	$(RM) $@ && cp ${<F} $@
145ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru%.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
146ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru	@echo -n
147ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
148ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# Environment variable to set a runtime search path
149ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruLDLIBRARYPATH_ENVVAR = PATH
150ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
151ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# The type of assembly to write for generating an object file
152ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruGENCCODE_ASSEMBLY=-a gcc-cygwin
153ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
154ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru# These are needed to allow the pkgdata GNU make files to work
155ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste QueruPKGDATA_DEFS = -DU_MAKE=\"$(MAKE)\"
156ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
157ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru## End Cygwin/MinGW specific setup
158ac04d0bbe12b3ef54518635711412f178cb4d16Jean-Baptiste Queru
159