]>
Commit | Line | Data |
---|---|---|
1 | ## -*-makefile-*- | |
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. | |
7 | ||
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) | |
11 | ||
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 | |
16 | else | |
17 | ## Make sure that the static libraries can be built | |
18 | STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION | |
19 | endif | |
20 | ||
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 | |
24 | ||
25 | ## Flags for position independent code | |
26 | SHAREDLIBCFLAGS = | |
27 | SHAREDLIBCXXFLAGS = | |
28 | SHAREDLIBCPPFLAGS = -DPIC | |
29 | ||
30 | ## Additional flags when building libraries and with threads | |
31 | THREADSCPPFLAGS = -D_REENTRANT | |
32 | LIBCPPFLAGS = | |
33 | ||
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) | |
37 | ||
38 | ## Shared library options | |
39 | LD_SOOPTIONS= -Wl,-Bsymbolic | |
40 | ||
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 " | |
50 | ||
51 | ||
52 | ## Compiler switch to embed a runtime search path | |
53 | LD_RPATH= | |
54 | LD_RPATH_PRE= -Wl,-rpath, | |
55 | ||
56 | ## Compiler switch to embed a library name | |
57 | LD_SONAME = | |
58 | ||
59 | ## Shared object suffix | |
60 | SO = dll | |
61 | ## Non-shared intermediate object suffix | |
62 | STATIC_O = ao | |
63 | LIBICU = cyg$(ICUPREFIX) | |
64 | ## To have an import library is better on Cygwin | |
65 | IMPORT_LIB_EXT = .dll.a | |
66 | ||
67 | ## Compilation rules | |
68 | %.$(STATIC_O): $(srcdir)/%.c | |
69 | $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $< | |
70 | %.o: $(srcdir)/%.c | |
71 | $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $< | |
72 | ||
73 | %.$(STATIC_O): $(srcdir)/%.cpp | |
74 | $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $< | |
75 | %.o: $(srcdir)/%.cpp | |
76 | $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $< | |
77 | ||
78 | ||
79 | ## Dependency rules | |
80 | %.d: $(srcdir)/%.c | |
81 | @echo "generating dependency information for $<" | |
82 | @echo -n "$@ " > $@ | |
83 | @$(GEN_DEPS.c) $< >> $@ || (rm -f $@ && FALSE) | |
84 | ||
85 | %.d: $(srcdir)/%.cpp | |
86 | @echo "generating dependency information for $<" | |
87 | @echo -n "$@ " > $@ | |
88 | @$(GEN_DEPS.cc) $< >> $@ || (rm -f $@ && FALSE) | |
89 | ||
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) | |
96 | ||
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# | |
100 | ||
101 | # The following is for Makefile.inc's use. | |
102 | ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) | |
103 | ||
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) | |
109 | ||
110 | ## Install libraries as executable | |
111 | INSTALL-L=$(INSTALL_PROGRAM) | |
112 | ||
113 | ## Bind internal references | |
114 | ||
115 | # LDflags that pkgdata will use | |
116 | BIR_LDFLAGS= -Wl,-Bsymbolic | |
117 | ||
118 | # Dependencies [i.e. map files] for the final library | |
119 | BIR_DEPS= | |
120 | ||
121 | # Environment variable to set a runtime search path | |
122 | LDLIBRARYPATH_ENVVAR = PATH | |
123 | ||
124 | # The type of assembly to write for generating an object file | |
125 | GENCCODE_ASSEMBLY=-a gcc-cygwin | |
126 | ||
127 | # put this here again so it gets cyguc... | |
128 | ||
129 | #SH#ICULIBS_COMMON_LIB_NAME="${LIBICU}uc${ICULIBSUFFIX}${ICULIBSUFFIX_VERSION}.${SO}" | |
130 | ||
131 | # for icu-config | |
132 | ||
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}" | |
145 | ||
146 | ## End Cygwin-specific setup | |
147 |