]>
Commit | Line | Data |
---|---|---|
73c04bcf A |
1 | ## Cygwin with Microsoft Visual C++ compiler specific setup |
2 | ## Copyright (c) 2001-2006, International Business Machines Corporation and | |
b75a7d8f | 3 | ## others. All Rights Reserved. |
374ca955 A |
4 | |
5 | # We install sbin tools into the same bin directory because | |
6 | # pkgdata needs some of the tools in sbin, and we can't always depend on | |
7 | # icu-config working on Windows. | |
8 | sbindir=$(bindir) | |
b75a7d8f A |
9 | |
10 | ## Commands to generate dependency files | |
11 | GEN_DEPS.c= : | |
12 | GEN_DEPS.cc= : | |
374ca955 A |
13 | #GEN_DEPS.c= $(COMPILE.c) /E |
14 | #GEN_DEPS.cc= $(COMPILE.cc) /E | |
15 | ||
16 | ## Flags to create/use a static library | |
17 | ifneq ($(ENABLE_SHARED),YES) | |
18 | ## Make sure that the static libraries can be built and used | |
73c04bcf | 19 | CPPFLAGS += -DU_STATIC_IMPLEMENTATION#M# |
374ca955 A |
20 | else |
21 | ## Make sure that the static libraries can be built | |
22 | STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION | |
23 | endif | |
b75a7d8f A |
24 | |
25 | ## Flags for position independent code | |
26 | SHAREDLIBCFLAGS = | |
27 | SHAREDLIBCXXFLAGS = | |
28 | SHAREDLIBCPPFLAGS = | |
29 | ||
30 | ## Additional flags when building libraries and with threads | |
31 | LIBCPPFLAGS = | |
b75a7d8f | 32 | |
374ca955 A |
33 | ifeq ($(ENABLE_RELEASE),1) |
34 | # Make sure that assertions are disabled | |
35 | CPPFLAGS+=-DU_RELEASE=1 | |
36 | endif | |
37 | ||
73c04bcf A |
38 | ifeq ($(ENABLE_DEBUG),1) |
39 | # Pass debugging flag through | |
40 | CPPFLAGS+=-D_DEBUG=1 | |
41 | ICULIBSUFFIX:=$(ICULIBSUFFIX)d | |
42 | endif | |
43 | ||
374ca955 | 44 | # /GF pools strings and places them into read-only memory |
73c04bcf A |
45 | # /EHsc enables exception handling |
46 | # /Zc:wchar_t makes wchar_t a native type. Required for C++ ABI compatibility. | |
47 | CFLAGS+=/GF /nologo | |
48 | CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t | |
374ca955 | 49 | DEFS+=-DWIN32 |
b75a7d8f A |
50 | LDFLAGS+=/nologo |
51 | ||
52 | # Commands to compile | |
374ca955 A |
53 | COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) /c |
54 | COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) /c | |
b75a7d8f A |
55 | |
56 | # Commands to link | |
57 | LINK.c= LINK.EXE /subsystem:console $(LDFLAGS) | |
58 | LINK.cc= LINK.EXE /subsystem:console $(LDFLAGS) | |
59 | ||
60 | ## Commands to make a shared library | |
374ca955 A |
61 | SHLIB.c= LINK.EXE /subsystem:console /DLL $(LDFLAGS) |
62 | SHLIB.cc= LINK.EXE /subsystem:console /DLL $(LDFLAGS) | |
b75a7d8f A |
63 | |
64 | ## Compiler switch to embed a runtime search path | |
65 | LD_RPATH= | |
66 | LD_RPATH_PRE= | |
67 | ||
68 | ## Compiler switch to embed a library name | |
374ca955 | 69 | LD_SONAME = /IMPLIB:$(SO_TARGET:.dll=.lib) |
b75a7d8f A |
70 | |
71 | ## Shared object suffix | |
72 | SO = dll | |
73 | ## Non-shared intermediate object suffix | |
374ca955 | 74 | STATIC_O = ao |
b75a7d8f A |
75 | # OUTOPT is for creating a specific output name |
76 | OUTOPT = /out: | |
77 | ||
374ca955 A |
78 | # Static library prefix and file extension |
79 | LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX) | |
80 | A = lib | |
81 | ||
b75a7d8f A |
82 | ## An import library is needed for z/OS and MSVC |
83 | IMPORT_LIB_EXT = .lib | |
84 | ||
374ca955 A |
85 | LIBPREFIX= |
86 | DEFAULT_LIBS = advapi32.lib | |
b75a7d8f | 87 | |
374ca955 A |
88 | # Change the stubnames so that poorly working FAT disks and installation programs can work. |
89 | # This is also for backwards compatibility. | |
90 | DATA_STUBNAME = dt | |
91 | I18N_STUBNAME = in | |
92 | LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX) | |
b75a7d8f | 93 | |
374ca955 A |
94 | ## Link commands to link to ICU libs |
95 | LIBICUDT= $(top_builddir)/stubdata/$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX).lib | |
96 | LIBICUUC= $(LIBDIR)/$(LIBICU)$(COMMON_STUBNAME)$(ICULIBSUFFIX).lib $(LIBICUDT) | |
97 | LIBICUI18N= $(LIBDIR)/$(LIBICU)$(I18N_STUBNAME)$(ICULIBSUFFIX).lib | |
98 | LIBICULE= $(LIBDIR)/$(LIBICU)$(LAYOUT_STUBNAME)$(ICULIBSUFFIX).lib | |
99 | LIBICULX= $(LIBDIR)/$(LIBICU)$(LAYOUTEX_STUBNAME)$(ICULIBSUFFIX).lib | |
100 | LIBICUIO= $(LIBDIR)/$(LIBICU)$(IO_STUBNAME)$(ICULIBSUFFIX).lib | |
101 | LIBCTESTFW= $(top_builddir)/tools/ctestfw/$(LIBICU)$(CTESTFW_STUBNAME)$(ICULIBSUFFIX).lib | |
102 | LIBICUTOOLUTIL= $(LIBDIR)/$(LIBICU)$(TOOLUTIL_STUBNAME)$(ICULIBSUFFIX).lib | |
103 | ||
104 | ## These are the library specific LDFLAGS | |
73c04bcf | 105 | LDFLAGSICUDT= /base:"0x4ad00000" /NOENTRY# The NOENTRY option is required for creating a resource-only DLL. |
374ca955 A |
106 | LDFLAGSICUUC= /base:"0x4a800000"# in-uc = 1MB |
107 | LDFLAGSICUI18N= /base:"0x4a900000"# io-in = 2MB | |
108 | LDFLAGSICUIO= /base:"0x4ab00000"# le-io = 1MB | |
109 | LDFLAGSICULE= /base:"0x4ac00000"# lx-le = 512KB | |
110 | LDFLAGSICULX= /base:"0x4ac80000" | |
111 | LDFLAGSCTESTFW=# Unused for now. | |
112 | LDFLAGSICUTOOLUTIL= /base:"0x4ac00000"# Same as layout. Layout and tools probably won't mix. | |
113 | ||
114 | # The #M# is used to delete lines for icu-config | |
115 | # Current full path directory. | |
73c04bcf | 116 | CURR_FULL_DIR=$(subst \,/,$(shell cygpath -da .))#M# -m isn't used because it doesn't work on Win98 |
374ca955 | 117 | # Current full path directory for use in source code in a -D compiler option. |
73c04bcf | 118 | CURR_SRCCODE_FULL_DIR=$(subst \,\\,$(shell cygpath -da .))#M# |
374ca955 A |
119 | |
120 | ifeq ($(srcdir),.) | |
121 | SOURCE_FILE=$< | |
122 | else | |
123 | SOURCE_FILE=$(shell cygpath -dma $<)#M# | |
124 | endif | |
b75a7d8f A |
125 | |
126 | ## Compilation rules | |
127 | %.$(STATIC_O): $(srcdir)/%.c | |
374ca955 | 128 | $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) /Fo$@ $(SOURCE_FILE) |
b75a7d8f | 129 | %.o: $(srcdir)/%.c |
374ca955 | 130 | $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) /Fo$@ $(SOURCE_FILE) |
b75a7d8f A |
131 | |
132 | %.$(STATIC_O): $(srcdir)/%.cpp | |
374ca955 | 133 | $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) /Fo$@ $(SOURCE_FILE) |
b75a7d8f | 134 | %.o: $(srcdir)/%.cpp |
374ca955 | 135 | $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) /Fo$@ $(SOURCE_FILE) |
b75a7d8f | 136 | |
b75a7d8f A |
137 | |
138 | ## Dependency rules | |
374ca955 A |
139 | ## This is a start to how depdendencies could work |
140 | # The commented out rules may not properly delete the file when ^C is pressed | |
141 | # or the compiler fails. | |
142 | # make currently doesn't like rules with C:\\PROGRA~1\\.. in the depedency. | |
143 | # So system headers are ignored by ignoring \\ | |
b75a7d8f A |
144 | %.d : $(srcdir)/%.c |
145 | @echo "generating dependency information for $<" | |
146 | @$(GEN_DEPS.c) $< > $@ | |
374ca955 A |
147 | # @echo -n "generating dependency information for " |
148 | # @echo -n "$@ $(basename $<).o : " > $@ | |
149 | # @$(SHELL) -ec '$(GEN_DEPS.c) $< \ | |
150 | # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ | |
151 | # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ | |
152 | # || (rm -f $@ && echo $@ && false)' | |
b75a7d8f A |
153 | |
154 | %.d : $(srcdir)/%.cpp | |
155 | @echo "generating dependency information for $<" | |
156 | @$(GEN_DEPS.cc) $< > $@ | |
374ca955 A |
157 | # @echo -n "generating dependency information for " |
158 | # @echo -n "$@ $(basename $<).o : " > $@ | |
159 | # @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ | |
160 | # | grep "#line 1 " | grep -v \\\\ | cut -d " " -f 3 \ | |
161 | # | /usr/bin/sort -u | sed s/\"$$/\\\\/ | sed s/^\"/\ / >> $@ \ | |
162 | # || (rm -f $@ && echo $@ && false)' | |
b75a7d8f A |
163 | |
164 | ## Compile a Windows resource file | |
165 | %.res : $(srcdir)/%.rc | |
73c04bcf | 166 | rc.exe /fo$@ $(CPPFLAGS) $(SOURCE_FILE) |
b75a7d8f A |
167 | |
168 | ## Versioned target for a shared library. | |
374ca955 A |
169 | FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO) |
170 | MIDDLE_SO_TARGET=$(FINAL_SO_TARGET) | |
b75a7d8f | 171 | |
374ca955 A |
172 | ## Special pkgdata information that is needed |
173 | PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION_MAJOR) | |
174 | ICUPKGDATA_INSTALL_DIR = $(shell cygpath -dma $(DESTDIR)$(ICUPKGDATA_DIR))#M# | |
175 | ICUPKGDATA_INSTALL_LIBDIR = $(shell cygpath -dma $(DESTDIR)$(libdir))#M# | |
176 | ||
177 | ## Versioned import library names. The library names are versioned, | |
178 | ## but the import libraries do not need versioning. | |
73c04bcf A |
179 | IMPORT_LIB = $(basename $(SO_TARGET))$(IMPORT_LIB_EXT)#M# |
180 | MIDDLE_IMPORT_LIB = $(IMPORT_LIB)#M# | |
181 | FINAL_IMPORT_LIB = $(MIDDLE_IMPORT_LIB)#M# | |
182 | ||
183 | # The following is for Makefile.inc's use. | |
184 | ICULIBSUFFIX_VERSION = $(LIB_VERSION_MAJOR) | |
b75a7d8f A |
185 | |
186 | ## Versioned libraries rules | |
187 | #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO) | |
374ca955 A |
188 | # $(RM) $@ && cp ${<F} $@ |
189 | # The following rule is a no op. We don't want symbolic links | |
b75a7d8f | 190 | %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO) |
374ca955 A |
191 | @echo -n |
192 | # $(RM) $@ && ln -s ${<F} $@ | |
b75a7d8f | 193 | |
374ca955 A |
194 | ## Install libraries as executable |
195 | INSTALL-L=$(INSTALL_PROGRAM) | |
b75a7d8f A |
196 | |
197 | # Environment variable to set a runtime search path | |
198 | LDLIBRARYPATH_ENVVAR = PATH | |
199 | ||
374ca955 A |
200 | # These are needed to allow the pkgdata nmake files to work |
201 | PKGDATA_OPTS = -v | |
202 | PKGDATA_INVOKE_OPTS = MAKEFLAGS= | |
203 | ||
204 | # Include the version information in the shared library | |
205 | ENABLE_SO_VERSION_DATA=1 | |
206 | ||
b75a7d8f A |
207 | ## End Cygwin-specific setup |
208 |