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