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.
9 #################################
10 #################################
12 #################################
13 #################################
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.
22 # Sane defaults, which are typically overridden on the command line.
27 APPLE_INTERNAL_DIR=/AppleInternal
30 #################################
31 # Environment variables
32 #################################
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).
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"
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"
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"
58 #################################
60 #################################
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.
70 # EXTRA_HDRS = ./extra/ustdio/ ./layout/
71 HDR_MAKE_SUBDIR = ./common/ ./i18n/ $(EXTRA_HDRS)
73 #################################
75 #################################
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.
82 INSTALL = /usr/bin/install
83 COMMON_OBJ = ./common/*.o
85 STUB_DATA_OBJ = ./stubdata/*.o
87 #EXTRA_LIBS =./extra/ ./layout/ ./tools/ctestfw/ ./tools/toolutil/
88 #DATA_OBJ = ./data/out/build/*.o
90 #################################
92 #################################
94 #We need to clean after installing.
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
104 CLEAN_SUBDIR = ./stubdata ./common ./i18n ./layout ./layoutex ./data ./tools ./$(MANUAL_CLEAN_TOOLS) $(MANUAL_CLEAN_EXTRA) $(MANUAL_CLEAN_TEST) $(MANUAL_CLEAN_SAMPLE)
106 #################################
108 #################################
110 CONFIG_FLAGS = --disable-renaming --disable-extras --disable-ustdio --disable-layout --disable-tests --disable-samples --with-data-packaging=archive --prefix=/usr/local
112 #################################
114 #################################
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.
123 LIB_NAME = libicucore
130 INSTALLED_DYLIB = $(LIB_NAME).$(CORE_VERS).$(DYLIB_SUFF)
131 DYLIB = $(LIB_NAME).$(DYLIB_SUFF)
133 #################################
135 #################################
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
142 #################################
143 #################################
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.
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 \
161 for j in `find $(SRCROOT)/icuSources/ | grep ".cvsignore"` ; do \
162 if test -f $$j ; then \
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).
171 installhdrs : $(SRCROOT)/icuSources/Makefile
173 'cd $(SRCROOT)/icuSources; \
174 for subdir in $(HDR_MAKE_SUBDIR); do \
175 (cd $$subdir; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) install-headers); \
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.
183 install : installhdrs $(SRCROOT)/icuSources/Makefile
185 'cd $(SRCROOT)/icuSources; \
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)/; \
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;) \
199 if test ! -d $(DSTROOT)$(datadir)/; then \
200 $(INSTALL) -d -m 0755 $(DSTROOT)$(datadir)/; \
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); \
205 if test -f $(SRCROOT)/$(L_DATA_FILE); then \
206 $(INSTALL) -b -m 0644 $(SRCROOT)/$(L_DATA_FILE) $(DSTROOT)$(datadir)$(L_DATA_FILE); \
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); \
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; \
217 if test -f $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); then \
218 rm -rf $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); \
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); \
229 (cd $(SRCROOT)/icuSources; $(MAKE) -e DESTDIR=$(DSTROOT) $(ENV) distclean-local;) \
232 if test -f $(SRCROOT)/icuSources/config/icu-config; then \
233 rm -rf $(SRCROOT)/icuSources/config/icu-config; \
235 if test -f $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); then \
236 rm -rf $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); \
239 $(SRCROOT)/icuSources/Makefile :
241 'cd $(SRCROOT)/icuSources; \
242 $(ENV_CONFIGURE) ./configure $(CONFIG_FLAGS);'
244 #################################
246 #################################
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.
252 debug: installhdrs $(SRCROOT)/icuSources/Makefile
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)/; \
260 $(INSTALL) -b -m 0664 ./$(INSTALLED_DYLIB) $(DSTROOT)$(libdir)$(INSTALLED_DYLIB); \
261 cd $(DSTROOT)$(libdir); \
262 ln -fs $(INSTALLED_DYLIB) $(DYLIB);'
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;) \
268 if test ! -d $(DSTROOT)$(datadir)/; then \
269 $(INSTALL) -d -m 0755 $(DSTROOT)$(datadir)/; \
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); \
274 $(INSTALL) -b -m 0644 $(SRCROOT)/icuSources/$(ICU_DATA_DIR)/$(L_DATA_FILE) $(DSTROOT)$(datadir)$(L_DATA_FILE); \
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; \
280 if test -f $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); then \
281 rm -rf $(SRCROOT)/icuSources/$(INSTALLED_DYLIB); \