1 ## Cygwin-specific setup
2 ## Copyright (c) 2001-2004, International Business Machines Corporation and
3 ## others. All Rights Reserved.
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.
10 ## Commands to generate dependency files
13 #GEN_DEPS.c= $(COMPILE.c) /E
14 #GEN_DEPS.cc= $(COMPILE.cc) /E
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
21 ## Make sure that the static libraries can be built
22 STATICCPPFLAGS = -DU_STATIC_IMPLEMENTATION
25 ## Flags for position independent code
30 ## Additional flags when building libraries and with threads
33 ifeq ($(ENABLE_DEBUG),1)
34 # /MDd means 'compiles and links a debugable multithreaded program with DLL'
36 THREADSCXXFLAGS += /MDd
37 # The debug flags are defined here because configure can't handle them.
42 # /MD means 'compiles and links a multithreaded program with DLL'
44 THREADSCXXFLAGS += /MD
47 ifeq ($(ENABLE_RELEASE),1)
48 # Make sure that assertions are disabled
49 CPPFLAGS+=-DU_RELEASE=1
52 # /GF pools strings and places them into read-only memory
53 # /GX enables exception handling
61 COMPILE.c= $(CC) $(CPPFLAGS) $(DEFS) $(CFLAGS) /c
62 COMPILE.cc= $(CXX) $(CPPFLAGS) $(DEFS) $(CXXFLAGS) /c
65 LINK.c= LINK.EXE /subsystem:console $(LDFLAGS)
66 LINK.cc= LINK.EXE /subsystem:console $(LDFLAGS)
68 ## Commands to make a shared library
69 SHLIB.c= LINK.EXE /subsystem:console /DLL $(LDFLAGS)
70 SHLIB.cc= LINK.EXE /subsystem:console /DLL $(LDFLAGS)
72 ## Compiler switch to embed a runtime search path
76 ## Compiler switch to embed a library name
77 LD_SONAME = /IMPLIB:$(SO_TARGET:.dll=.lib)
79 ## Shared object suffix
81 ## Non-shared intermediate object suffix
83 # OUTOPT is for creating a specific output name
86 # Static library prefix and file extension
87 LIBSICU = $(STATIC_PREFIX)$(ICUPREFIX)
90 ## An import library is needed for z/OS and MSVC
94 DEFAULT_LIBS = advapi32.lib
96 # Change the stubnames so that poorly working FAT disks and installation programs can work.
97 # This is also for backwards compatibility.
100 LIBICU = $(STATIC_PREFIX_WHEN_USED)$(ICUPREFIX)
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
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.
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#
131 SOURCE_FILE=$(shell cygpath -dma $<)#M#
135 %.$(STATIC_O): $(srcdir)/%.c
136 $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) /Fo$@ $(SOURCE_FILE)
138 $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) /Fo$@ $(SOURCE_FILE)
140 %.$(STATIC_O): $(srcdir)/%.cpp
141 $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) /Fo$@ $(SOURCE_FILE)
143 $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) /Fo$@ $(SOURCE_FILE)
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 \\
153 @echo "generating dependency information for $<"
154 @$(GEN_DEPS.c) $< > $@
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)'
162 %.d : $(srcdir)/%.cpp
163 @echo "generating dependency information for $<"
164 @$(GEN_DEPS.cc) $< > $@
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)'
172 ## Compile a Windows resource file
173 %.res : $(srcdir)/%.rc
174 rc.exe /fo$@ $(SOURCE_FILE)
176 ## Versioned target for a shared library.
177 FINAL_SO_TARGET= $(basename $(SO_TARGET))$(SO_TARGET_VERSION_MAJOR).$(SO)
178 MIDDLE_SO_TARGET=$(FINAL_SO_TARGET)
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#
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)
191 ## Versioned libraries rules
192 #%$(SO_TARGET_VERSION_MAJOR).$(SO): %$(SO_TARGET_VERSION).$(SO)
193 # $(RM) $@ && cp ${<F} $@
194 # The following rule is a no op. We don't want symbolic links
195 %.$(SO): %$(SO_TARGET_VERSION_MAJOR).$(SO)
197 # $(RM) $@ && ln -s ${<F} $@
199 ## Install libraries as executable
200 INSTALL-L=$(INSTALL_PROGRAM)
202 # Environment variable to set a runtime search path
203 LDLIBRARYPATH_ENVVAR = PATH
205 # These are needed to allow the pkgdata nmake files to work
207 PKGDATA_INVOKE_OPTS = MAKEFLAGS=
209 # Include the version information in the shared library
210 ENABLE_SO_VERSION_DATA=1
212 ## End Cygwin-specific setup