]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | ## |
2 | # Makefile for ICU | |
3 | # | |
4 | # See http://www.gnu.org/manual/make/html_chapter/make_toc.html#SEC_Contents | |
5 | # for documentation on makefiles. Most of this was culled from the ncurses makefile. | |
6 | # | |
7 | ## | |
8 | ||
9 | ################################# | |
10 | ################################# | |
11 | # MAKE VARS | |
12 | ################################# | |
13 | ################################# | |
14 | ||
15 | # ':=' denotes a "simply expanded" variable. It's value is | |
16 | # set at the time of definition and it never recursively expands | |
17 | # when used. This is in contrast to using '=' which denotes a | |
18 | # recursively expanded variable. | |
19 | ||
20 | SHELL := /bin/sh | |
21 | ||
22 | # Sane defaults, which are typically overridden on the command line. | |
23 | SRCROOT=/tmp | |
24 | OBJROOT=$(SRCROOT) | |
25 | SYMROOT=$(OBJROOT) | |
26 | DSTROOT=/tmp/build | |
27 | APPLE_INTERNAL_DIR=/AppleInternal | |
28 | RC_ARCHS= | |
29 | ||
30 | ################################# | |
31 | # Environment variables | |
32 | ################################# | |
33 | ||
34 | # $(RC_ARCHS:%=-arch %) is a substitution reference. It denotes, in this case, | |
35 | # for every value <val> in RC_ARCHS, replace it with "-arch <val>". Substitution | |
36 | # references have the form $(var:a=b). We can insert the strip and prebinding commands | |
37 | # into CFLAGS (and CXXFLAGS). This controls a lot of the external variables so we don't | |
38 | # need to directly modify the ICU files (like for CFLAGS, etc). | |
39 | ||
40 | ENV= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \ | |
41 | CFLAGS="-DICU_DATA_DIR=\"\\\"/usr/share/icu/\\\"\" $(RC_ARCHS:%=-arch %) -g -Os -fno-exceptions" \ | |
42 | CXXFLAGS="-DICU_DATA_DIR=\"\\\"/usr/share/icu/\\\"\" $(RC_ARCHS:%=-arch %) -g -Os -fno-exceptions" \ | |
43 | RC_ARCHS="$(RC_ARCHS)" \ | |
44 | DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib" | |
45 | ||
46 | ENV_CONFIGURE= APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \ | |
47 | CFLAGS="-DICU_DATA_DIR=\"\\\"/usr/share/icu/\\\"\" -g -Os -fno-exceptions" \ | |
48 | CXXFLAGS="-DICU_DATA_DIR=\"\\\"/usr/share/icu/\\\"\" -g -Os -fno-exceptions" \ | |
49 | RC_ARCHS="$(RC_ARCHS)" \ | |
50 | DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib" | |
51 | ||
52 | ENV_DEBUG = APPLE_INTERNAL_DIR="$(APPLE_INTERNAL_DIR)" \ | |
53 | CFLAGS="-DICU_DATA_DIR=\"\\\"/usr/share/icu/\\\"\" $(RC_ARCHS:%=-arch %) -O0 -g -fno-exceptions" \ | |
54 | CXXFLAGS="-DICU_DATA_DIR=\"\\\"/usr/share/icu/\\\"\" $(RC_ARCHS:%=-arch %) -O0 -g -fno-exceptions" \ | |
55 | RC_ARCHS="$(RC_ARCHS)" \ | |
56 | DYLD_LIBRARY_PATH="$(DSTROOT)/usr/local/lib" | |
57 | ||
58 | ################################# | |
59 | # Headers | |
60 | ################################# | |
61 | ||
62 | # For installhdrs. Not every compiled module has an associated header. Normally, | |
63 | # ICU installs headers as a sub-targe of the install target. But since we only want | |
64 | # certain libraries to install (and since we link all of our own .o modules), we need | |
65 | # invoke the headers targets ourselves. This may be problematic because there isn't a | |
66 | # good way to dist-clean afterwards...we need to do explicit dist-cleans, especially if | |
67 | # install the extra libraries. | |
68 | ||
69 | EXTRA_HDRS = | |
70 | # EXTRA_HDRS = ./extra/ustdio/ ./layout/ | |
71 | HDR_MAKE_SUBDIR = ./common/ ./i18n/ $(EXTRA_HDRS) | |
72 | ||
73 | ################################# | |
74 | # Install | |
75 | ################################# | |
76 | ||
77 | # For install. We currently don't install EXTRA_LIBS. We also don't install the data | |
78 | # directly into the ICU library. It is now installed at /usr/share/icu/*.dat. Thus we | |
79 | # don't use DATA_OBJ anymore. This could change if we decide to move the data back into | |
80 | # the icucore monolithic library. | |
81 | ||
82 | INSTALL = /usr/bin/install | |
83 | COMMON_OBJ = ./common/*.o | |
84 | I18N_OBJ = ./i18n/*.o | |
85 | STUB_DATA_OBJ = ./stubdata/*.o | |
86 | EXTRA_LIBS = | |
87 | #EXTRA_LIBS =./extra/ ./layout/ ./tools/ctestfw/ ./tools/toolutil/ | |
88 | #DATA_OBJ = ./data/out/build/*.o | |
89 | ||
90 | ################################# | |
91 | # Cleaning | |
92 | ################################# | |
93 | ||
94 | #We need to clean after installing. | |
95 | ||
96 | EXTRA_CLEAN = | |
97 | ||
98 | # Some directories aren't cleaned recursively. Clean them manually... | |
99 | MANUAL_CLEAN_TOOLS = ./tools/dumpce | |
100 | MANUAL_CLEAN_EXTRA = ./extra/scrptrun ./samples/layout ./extra/ustdio ./extra | |
101 | MANUAL_CLEAN_TEST = ./test/collperf ./test/iotest ./test/letest ./test/thaitest ./test/threadtest ./test/testmap ./test | |
102 | MANUAL_CLEAN_SAMPLE = ./samples/layout ./samples | |
103 | ||
104 | CLEAN_SUBDIR = ./stubdata ./common ./i18n ./layout ./layoutex ./data ./tools ./$(MANUAL_CLEAN_TOOLS) $(MANUAL_CLEAN_EXTRA) $(MANUAL_CLEAN_TEST) $(MANUAL_CLEAN_SAMPLE) | |
105 | ||
106 | ################################# | |
107 | # Config flags | |
108 | ################################# | |
109 | ||
110 | CONFIG_FLAGS = --disable-renaming --disable-extras --disable-ustdio --disable-layout --disable-tests --disable-samples --with-data-packaging=archive --prefix=/usr/local | |
111 | ||
112 | ################################# | |
113 | # Install paths | |
114 | ################################# | |
115 | ||
116 | # This may or may not be an appropriate name for the icu dylib. This naming scheme is | |
117 | # an attempt to follow the icu convention in naming the dylib and then having symbolic | |
118 | # links of easier to remember library names point it it. *UPDATE* the version and | |
119 | # sub-version variables as needed. The Core version should be 'A' until the core | |
120 | # version changes it's API...that is a new version isn't backwards compatible. | |
121 | # The ICU version/subversion should reflect the actual ICU version. | |
122 | ||
123 | LIB_NAME = libicucore | |
124 | ICU_VERS = 26 | |
125 | ICU_SUBVERS = 0 | |
126 | CORE_VERS = A | |
127 | DYLIB_SUFF = dylib | |
128 | libdir = /usr/lib/ | |
129 | ||
130 | INSTALLED_DYLIB = $(LIB_NAME).$(CORE_VERS).$(DYLIB_SUFF) | |
131 | DYLIB = $(LIB_NAME).$(DYLIB_SUFF) | |
132 | ||
133 | ################################# | |
134 | # Data files | |
135 | ################################# | |
136 | ||
137 | datadir=/usr/share/icu/ | |
138 | ICU_DATA_DIR= /data/out/ | |
139 | B_DATA_FILE=icudt$(ICU_VERS)b.dat | |
140 | L_DATA_FILE=icudt$(ICU_VERS)l.dat | |
141 | ||
142 | ################################# | |
143 | ################################# | |
144 | # TARGETS | |
145 | ################################# | |
146 | ################################# | |
147 | # Since our sources are in icuSources (ignore the ICU subdirectory for now), we wish to | |
148 | # copy them to somewhere else. We tar it to stdout, cd to the appropriate directory, and | |
149 | # untar from stdin. We then look for all the CVS directories and remove them. We may have | |
150 | # to remove the .cvsignore files also. | |
151 | ||
152 | installsrc : | |
153 | if test ! -d $(SRCROOT); then mkdir $(SRCROOT); fi; | |
154 | if test -d $(SRCROOT)/icuSources ; then rm -rf $(SRCROOT)/icuSources; fi; | |
155 | tar cf - ./makefile ./icuSources ./$(L_DATA_FILE) | (cd $(SRCROOT) ; tar xfp -); \ | |
156 | for i in `find $(SRCROOT)/icuSources/ | grep "CVS$$"` ; do \ | |
157 | if test -d $$i ; then \ | |
158 | rm -rf $$i; \ | |
159 | fi; \ | |
160 | done | |
161 | for j in `find $(SRCROOT)/icuSources/ | grep ".cvsignore"` ; do \ | |
162 | if test -f $$j ; then \ | |
163 | rm -f $$j; \ | |
164 | fi; \ | |
165 | done | |
166 | ||
167 | # This works. Just not for ~ in the DSTROOT. We run configure first (in case it hasn't | |
168 | # been already). Then we make the install-headers target on specific makefiles (since | |
169 | # not every subdirectory/sub-component has a install-headers target). | |
170 | ||
171 | installhdrs : $(SRCROOT)/icuSources/Makefile | |
172 | $(SHELL) -ec \ | |
173 | 'cd $(SRCROOT)/icuSources; \ | |
174 | for subdir in $(HDR_MAKE_SUBDIR); do \ | |
175 | (cd $$subdir; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) install-headers); \ | |
176 | done;' | |
177 | ||
178 | # We run configure and run make first. This generates the .o files. We then link them | |
179 | # all up together into libicucore. Then we put it into its install location, create | |
180 | # symbolic links, and then strip the main dylib. Then install the remaining libraries. | |
181 | # We cleanup the sources folder. | |
182 | ||
183 | install : installhdrs $(SRCROOT)/icuSources/Makefile | |
184 | $(SHELL) -ec \ | |
185 | 'cd $(SRCROOT)/icuSources; \ | |
186 | $(MAKE) $(ENV); \ | |
187 | $(ENV) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic $(RC_ARCHS:%=-arch %) $(CXXFLAGS) $(LDFLAGS) -single_module -sectorder __TEXT __text /usr/local/lib/OrderFiles/libicucore.order -install_name $(libdir)$(INSTALLED_DYLIB) -o ./$(INSTALLED_DYLIB) $(COMMON_OBJ) $(I18N_OBJ) $(STUB_DATA_OBJ); \ | |
188 | if test ! -d $(DSTROOT)$(libdir)/; then \ | |
189 | $(INSTALL) -d -m 0775 $(DSTROOT)$(libdir)/; \ | |
190 | fi; \ | |
191 | $(INSTALL) -b -m 0664 ./$(INSTALLED_DYLIB) $(DSTROOT)$(libdir)$(INSTALLED_DYLIB); \ | |
192 | cd $(DSTROOT)$(libdir); \ | |
193 | ln -fs $(INSTALLED_DYLIB) $(DYLIB); \ | |
194 | cp $(INSTALLED_DYLIB) $(SYMROOT)/$(INSTALLED_DYLIB); \ | |
195 | strip -x -u -r -S $(DSTROOT)$(libdir)$(INSTALLED_DYLIB);' | |
196 | for subdir in $(EXTRA_LIBS); do \ | |
197 | (cd $(SRCROOT)/icuSources/$$subdir; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) install-library;) \ | |
198 | done; | |
199 | if test ! -d $(DSTROOT)$(datadir)/; then \ | |
200 | $(INSTALL) -d -m 0755 $(DSTROOT)$(datadir)/; \ | |
201 | fi; | |
202 | if test -f $(SRCROOT)/icuSources/$(ICU_DATA_DIR)/$(B_DATA_FILE); then \ | |
203 | $(INSTALL) -b -m 0644 $(SRCROOT)/icuSources/$(ICU_DATA_DIR)/$(B_DATA_FILE) $(DSTROOT)$(datadir)$(B_DATA_FILE); \ | |
204 | fi; | |
205 | if test -f $(SRCROOT)/$(L_DATA_FILE); then \ | |
206 | $(INSTALL) -b -m 0644 $(SRCROOT)/$(L_DATA_FILE) $(DSTROOT)$(datadir)$(L_DATA_FILE); \ | |
207 | fi; | |
208 | for i in $(CLEAN_SUBDIR) ; do \ | |
209 | if test -e $(SRCROOT/icuSources/$$i); then \ | |
210 | (cd $(SRCROOT)/icuSources/$$i; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) distclean); \ | |
211 | fi; \ | |
212 | done; \ | |
213 | (cd $(SRCROOT)/icuSources; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) distclean-local;) | |
214 | if test -f $(SRCROOT)/icuSources/config/icu-config; then \ | |
215 | rm -rf $(SRCROOT)/icuSources/config/icu-config; \ | |
216 | fi; | |
217 | if test -f $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); then \ | |
218 | rm -rf $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); \ | |
219 | fi; | |
220 | ||
221 | clean : | |
222 | if test -d $(SRCROOT)/icuSources; then \ | |
223 | if test -e $(SRCROOT)/icuSources/Makefile; then \ | |
224 | for i in $(CLEAN_SUBDIR) ; do \ | |
225 | if test -e $(SRCROOT/icuSources/$$i); then \ | |
226 | (cd $(SRCROOT)/icuSources/$$i; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) distclean); \ | |
227 | fi; \ | |
228 | done; \ | |
229 | (cd $(SRCROOT)/icuSources; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) distclean-local;) \ | |
230 | fi; \ | |
231 | fi; | |
232 | if test -f $(SRCROOT)/icuSources/config/icu-config; then \ | |
233 | rm -rf $(SRCROOT)/icuSources/config/icu-config; \ | |
234 | fi; | |
235 | if test -f $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); then \ | |
236 | rm -rf $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); \ | |
237 | fi; | |
238 | ||
239 | $(SRCROOT)/icuSources/Makefile : | |
240 | $(SHELL) -ec \ | |
241 | 'cd $(SRCROOT)/icuSources; \ | |
242 | $(ENV_CONFIGURE) ./configure $(CONFIG_FLAGS);' | |
243 | ||
244 | ################################# | |
245 | # OPTIONAL TARGETS | |
246 | ################################# | |
247 | ||
248 | # These targets aren't required by B&I. They're supposed to make life easier by not deleting | |
249 | # the object files so that we don't have to rebuild the entire binary every single time. This | |
250 | # should aid in development. | |
251 | ||
252 | debug: installhdrs $(SRCROOT)/icuSources/Makefile | |
253 | $(SHELL) -ec \ | |
254 | 'cd $(SRCROOT)/icuSources; \ | |
255 | $(MAKE) $(ENV_DEBUG); \ | |
256 | $(ENV_DEBUG) $(CXX) -current_version $(ICU_VERS).$(ICU_SUBVERS) -compatibility_version 1 -dynamiclib -dynamic $(RC_ARCHS:%=-arch %) $(CXXFLAGS) $(LDFLAGS) -install_name $(libdir)$(INSTALLED_DYLIB) -o ./$(INSTALLED_DYLIB) $(COMMON_OBJ) $(I18N_OBJ) $(STUB_DATA_OBJ); \ | |
257 | if test ! -d $(DSTROOT)$(libdir)/; then \ | |
258 | $(INSTALL) -d -m 0775 $(DSTROOT)$(libdir)/; \ | |
259 | fi; \ | |
260 | $(INSTALL) -b -m 0664 ./$(INSTALLED_DYLIB) $(DSTROOT)$(libdir)$(INSTALLED_DYLIB); \ | |
261 | cd $(DSTROOT)$(libdir); \ | |
262 | ln -fs $(INSTALLED_DYLIB) $(DYLIB);' | |
263 | ||
264 | debug-install: debug installhdrs $(SRCROOT)/icuSources/Makefile | |
265 | for subdir in $(EXTRA_LIBS); do \ | |
266 | (cd $(SRCROOT)/icuSources/$$subdir; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV_DEBUG) install-library;) \ | |
267 | done; | |
268 | if test ! -d $(DSTROOT)$(datadir)/; then \ | |
269 | $(INSTALL) -d -m 0755 $(DSTROOT)$(datadir)/; \ | |
270 | fi; | |
271 | if test -f $(SRCROOT)/icuSources/$(ICU_DATA_DIR)/$(B_DATA_FILE); then \ | |
272 | $(INSTALL) -b -m 0644 $(SRCROOT)/icuSources/$(ICU_DATA_DIR)/$(B_DATA_FILE) $(DSTROOT)$(datadir)$(B_DATA_FILE); \ | |
273 | else \ | |
274 | $(INSTALL) -b -m 0644 $(SRCROOT)/icuSources/$(ICU_DATA_DIR)/$(L_DATA_FILE) $(DSTROOT)$(datadir)$(L_DATA_FILE); \ | |
275 | fi; | |
276 | (cd $(SRCROOT)/icuSources; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) distclean-local;) | |
277 | if test -f $(SRCROOT)/icuSources/config/icu-config; then \ | |
278 | rm -rf $(SRCROOT)/icuSources/config/icu-config; \ | |
279 | fi; | |
280 | if test -f $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); then \ | |
281 | rm -rf $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); \ | |
282 | fi; |