2 ## Copyright (C) 2016 and later: Unicode, Inc. and others.
3 ## License & terms of use: http://www.unicode.org/copyright.html
4 ## Cygwin-specific setup
5 ## Copyright (c) 2001-2010, International Business Machines Corporation and
6 ## others. All Rights Reserved.
8 ## Commands to generate dependency files
9 GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS)
10 GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS)
12 ## Flags to create/use a static library
13 ifneq ($(ENABLE_SHARED),YES)
14 ## Make sure that the static libraries can be built and used
15 CPPFLAGS += -DU_STATIC_IMPLEMENTATION
17 ## Make sure that the static libraries can be built
18 STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
21 ## ICU requires a minimum target of Windows 7, and WINVER is not set to this by default.
22 ## https://msdn.microsoft.com/en-us/library/aa383745.aspx
23 CPPFLAGS += -DWINVER=0x0601 -D_WIN32_WINNT=0x0601
25 ## Flags for position independent code
28 SHAREDLIBCPPFLAGS = -DPIC
30 ## Additional flags when building libraries and with threads
31 THREADSCPPFLAGS = -D_REENTRANT
34 # Commands to link. Link with C++ in case static libraries are used.
35 LINK.c= $(CXX) $(CXXFLAGS) $(LDFLAGS)
36 #LINK.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS)
38 ## Shared library options
39 LD_SOOPTIONS= -Wl,-Bsymbolic
41 ## Commands to make a shared library
42 # $(subst) won't work in shell script. #M# at the end omits these
43 # lines from the shell script (Make only)
44 SHLIB.c= $(CC) $(CFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M#
45 SHLIB.cc= $(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(LD_SOOPTIONS) -Wl,--enable-auto-import -Wl,--out-implib=$(subst cyg,lib,$@).$(A)#M#
46 # the #SH# lines don't go through further postprocessing.
47 # so, they must be valid shell script starting from column 4
48 #SH#SHLIB_c="$(CC) $(CFLAGS) $(LDFLAGS) -shared "
49 #SH#SHLIB_cc="$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared "
52 ## Compiler switch to embed a runtime search path
54 LD_RPATH_PRE= -Wl,-rpath,
56 ## Compiler switch to embed a library name
59 ## Shared object suffix
61 ## Non-shared intermediate object suffix
63 LIBICU = cyg$(ICUPREFIX)
64 ## To have an import library is better on Cygwin
65 IMPORT_LIB_EXT = .dll.a
68 %.$(STATIC_O): $(srcdir)/%.c
69 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
71 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
73 %.$(STATIC_O): $(srcdir)/%.cpp
74 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
76 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
81 @echo "generating dependency information for $<"
83 @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE)
86 @echo "generating dependency information for $<"
88 @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE)
90 ## Versioned target for a shared library.
91 ## Since symbolic links don't work the same way on Windows,
92 ## we only use the version major number.
93 #FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION).$(SO)
94 FINAL_SO_TARGET=$(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
95 MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
97 IMPORT_LIB = $(subst cyg,lib,$(FINAL_SO_TARGET)).$(A)#M#
98 MIDDLE_IMPORT_LIB = $(subst cyg,lib,$(basename $(SO_TARGET)))$(SO_TARGET_VERSION_MAJOR).$(SO).$(A)#M#
99 FINAL_IMPORT_LIB = $(IMPORT_LIB)#M#
101 # The following is for Makefile.inc's use.
102 ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR)
104 ## Versioned libraries rules
105 #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
106 # $(RM) $@ && cp ${<F} $@
107 %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
108 $(RM) $(subst cyg,lib,$@).$(A) && ln -s $(subst cyg,lib,${<F}).$(A) $(subst cyg,lib,$@).$(A)
110 ## Install libraries as executable
111 INSTALL-L=$(INSTALL_PROGRAM)
113 ## Bind internal references
115 # LDflags that pkgdata will use
116 BIR_LDFLAGS= -Wl,-Bsymbolic
118 # Dependencies [i.e. map files] for the final library
121 # Environment variable to set a runtime search path
122 LDLIBRARYPATH_ENVVAR = PATH
124 # The type of assembly to write for generating an object file
125 GENCCODE_ASSEMBLY=-a gcc-cygwin
127 # put this here again so it gets cyguc...
129 #SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}uc${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}"
133 #SH### copied from Makefile.inc
134 #SH#ICULIBS_COMMON="-l${LIBICU}uc${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
135 #SH#ICULIBS_DATA="-l${LIBICU}${DATA_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
136 #SH#ICULIBS_I18N="-l${LIBICU}${I18N_STUBNAME}${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
137 #SH#ICULIBS_TOOLUTIL="-l${LIBICU}tu${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
138 #SH#ICULIBS_CTESTFW="-l${LIBICU}ctestfw${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
139 #SH#ICULIBS_ICUIO="-l${LIBICU}io${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
140 #SH#ICULIBS_OBSOLETE="-l${LIBICU}obsolete${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
141 #SH#ICULIBS_LAYOUT="-l${LIBICU}le${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
142 #SH#ICULIBS_LAYOUTEX="-l${LIBICU}lx${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}"
143 #SH#ICULIBS_BASE="${LIBS} -L${libdir}"
144 #SH#ICULIBS="${ICULIBS_BASE} ${ICULIBS_I18N} ${ICULIBS_COMMON} ${ICULIBS_DATA}"
146 ## End Cygwin-specific setup