• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#******************************************************************************
2#
3#   Copyright (C) 1998-2013, International Business Machines
4#   Corporation and others.  All Rights Reserved.
5#
6#******************************************************************************
7## Top-level Makefile.in for ICU
8## Stephen F. Booth
9
10srcdir = @srcdir@
11top_srcdir = @top_srcdir@
12
13top_builddir = .
14
15include $(top_builddir)/icudefs.mk
16
17docdir = $(datadir)/doc
18docsubdir = $(PACKAGE)$(ICULIBDASHSUFFIX)/html
19docfilesdir = doc/html
20docfiles = $(docfilesdir)/*.png $(docfilesdir)/*.html $(docfilesdir)/*.css $(docfilesdir)/*.tag
21docsrchdir = $(docfilesdir)/search
22docsrchfiles = $(docsrchdir)/*
23
24##
25
26## Build directory information
27subdir = .
28
29#AUTOCONF = @AUTOCONF@
30
31## Optional directory setup
32@LAYOUT_TRUE@LAYOUT = layout layoutex
33@ICUIO_TRUE@ICUIO = io
34@EXTRAS_TRUE@EXTRA = extra
35@TESTS_TRUE@TEST = test
36@SAMPLES_TRUE@SAMPLE = samples
37@TOOLS_TRUE@TOOLS = tools
38
39## pkgconfig setup. Always have uc and i18n. Others are optional.
40ALL_PKGCONFIG_SUFFIX=uc i18n
41@LAYOUT_TRUE@ALL_PKGCONFIG_SUFFIX+= le lx
42@ICUIO_TRUE@ALL_PKGCONFIG_SUFFIX+= io
43
44DOXYGEN = @DOXYGEN@
45DOCZIP = icu-docs.zip
46
47## Files to remove for 'make clean'
48CLEANFILES = *~
49
50ALL_PKGCONFIG_FILES=$(ALL_PKGCONFIG_SUFFIX:%=$(top_builddir)/config/icu-%.pc)
51
52## Files built (autoconfed) and installed
53INSTALLED_BUILT_FILES = $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc $(top_builddir)/config/icu-config @platform_make_fragment@ $(EXTRA_DATA:%=$(DESTDIR)$(pkglibdir)/%) $(ALL_PKGCONFIG_FILES)
54
55## Files built (autoconfed) but not installed
56LOCAL_BUILT_FILES = icudefs.mk config/icucross.mk config/icucross.inc
57
58DOCDIRS = common i18n
59SUBDIRS =  stubdata common i18n $(LAYOUT) $(ICUIO) $(TOOLS) data $(EXTRA) $(SAMPLE) $(TEST)
60
61SECTION = 1
62
63MANX_FILES = config/icu-config.$(SECTION)
64
65ALL_MAN_FILES = $(MANX_FILES)
66
67## Extra files to install [nothing at present]
68EXTRA_DATA =
69
70## List of phony targets
71.PHONY : all all-local all-recursive install install-local install-udata install-udata-files install-udata-dlls		\
72install-recursive clean clean-local clean-recursive distclean		\
73distclean-local distclean-recursive doc dist dist-local dist-recursive	\
74check check-local check-recursive clean-recursive-with-twist install-icu \
75doc install-doc tests icu4j-data icu4j-data-install update-windows-makefiles xcheck-local xcheck-recursive xperf xcheck xperf-recursive \
76check-exhaustive check-exhaustive-local check-exhaustive-recursive releaseDist
77
78## Clear suffix list
79.SUFFIXES :
80
81## List of standard targets
82all: all-local all-recursive
83install: install-recursive install-local
84clean: clean-recursive-with-twist clean-local
85distclean : distclean-recursive distclean-local
86dist: dist-recursive dist-local
87check: all check-recursive
88check-recursive: all
89xcheck: all xcheck-recursive
90xperf: all xperf-recursive
91check-exhaustive: all check-exhaustive-recursive
92
93pcheck: all tests
94	@$(MAKE) -C test pcheck
95
96check-exhaustive-local: check-local
97
98xcheck-recursive: all xcheck-local
99	@$(MAKE) -C test xcheck
100
101xperf-recursive: all tests
102	@$(MAKE) -C test/perf xperf
103
104$(top_builddir)/config/icuinfo.xml: all
105	@$(MAKE) -C tools/icuinfo check
106
107ifeq ($(DOXYGEN),)
108doc doc-searchengine:
109	@echo you need Doxygen to generate documentation. Doxygen can be found on the Web
110	@echo at http://www.doxygen.org/
111else
112doc: doc/html/index.html
113
114doc-searchengine: Doxyfile $(wildcard ./common/unicode/platform.h $(srcdir)/common/unicode/*.h $(srcdir)/i18n/unicode/*.h $(srcdir)/layout/unicode/*.h $(srcdir)/io/unicode/*.h)
115	sed < Doxyfile -e 's%[^#]*SEARCHENGINE.*%SEARCHENGINE=YES%' | $(DOXYGEN) -
116	@echo adding links from non-namespaced class files
117	find doc/html -name 'classicu_1_1*' -print | sed -e 's%^\(.*class\)icu_1_1\(.*\)$$%ln & \1\2%' | sh
118	@echo Docs created - WARNING, probably contains non-GPL .js files
119
120doc/html/index.html: Doxyfile $(wildcard ./common/unicode/platform.h $(srcdir)/common/unicode/*.h $(srcdir)/i18n/unicode/*.h $(srcdir)/layout/unicode/*.h $(srcdir)/io/unicode/*.h)
121	$(DOXYGEN)
122	@echo adding links from non-namespaced class files
123	find doc/html -name 'classicu_1_1*' -print | sed -e 's%^\(.*class\)icu_1_1\(.*\)$$%ln & \1\2%' | sh
124
125Doxyfile: $(srcdir)/Doxyfile.in
126	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
127
128$(DOCZIP): doc
129	-$(RMV) $(DOCZIP)
130	( cd doc/html ; zip -r ../../$(DOCZIP) * )
131endif
132
133LOCAL_SUBDIRS = $(SUBDIRS)
134CLEAN_FIRST_SUBDIRS = $(TOOLS)
135
136$(LIBDIR) $(BINDIR):
137	-$(MKINSTALLDIRS) $@
138
139## Recursive targets
140all-recursive install-recursive clean-recursive distclean-recursive dist-recursive check-recursive check-exhaustive-recursive: $(LIBDIR) $(BINDIR)
141	@dot_seen=no; \
142	target=`echo $@ | sed s/-recursive//`; \
143	list='$(LOCAL_SUBDIRS)'; for subdir in $$list; do \
144	  echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
145	  if test "$$subdir" = "."; then \
146	    dot_seen=yes; \
147	    local_target="$$target-local"; \
148	  else \
149	    local_target="$$target"; \
150	  fi; \
151	  (cd $$subdir && $(MAKE) RECURSIVE=YES $$local_target) || exit; \
152	done; \
153	if test "$$dot_seen" = "no"; then \
154	  $(MAKE) "$$target-local" || exit; \
155	fi
156
157clean-recursive-with-twist:
158	$(MAKE) clean-recursive LOCAL_SUBDIRS='$(CLEAN_FIRST_SUBDIRS) $(filter-out $(CLEAN_FIRST_SUBDIRS),$(LOCAL_SUBDIRS))'
159
160all-local: $(srcdir)/configure $(LOCAL_BUILT_FILES) $(INSTALLED_BUILT_FILES)
161ifndef VERBOSE
162	@echo "Note: rebuild with \"$(MAKE) VERBOSE=1 $(MAKECMDGOALS)\" to show all compiler parameters."
163endif
164install-local: install-icu install-manx
165
166install-icu: $(INSTALLED_BUILT_FILES)
167	@$(MKINSTALLDIRS) $(DESTDIR)$(pkgdatadir)/config
168	@$(MKINSTALLDIRS) $(DESTDIR)$(pkglibdir)
169	@$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
170	@$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
171	$(INSTALL_DATA) @platform_make_fragment@ $(DESTDIR)$(pkgdatadir)/config/@platform_make_fragment_name@
172	$(INSTALL_SCRIPT) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(pkgdatadir)/mkinstalldirs
173	$(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
174	@$(MKINSTALLDIRS) $(DESTDIR)$(libdir)/pkgconfig
175	$(INSTALL_DATA) $(ALL_PKGCONFIG_FILES) $(DESTDIR)$(libdir)/pkgconfig/
176	$(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
177	$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
178	$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
179	$(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc
180#	@echo icuinfo.xml is built after make check.
181#	-$(INSTALL_DATA) $(top_builddir)/config/icuinfo.xml $(DESTDIR)$(pkglibdir)/icuinfo.xml
182	cd $(DESTDIR)$(pkglibdir)/..; \
183	    $(RM) current && ln -s $(VERSION) current; \
184	    $(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc; \
185	    $(RM) pkgdata.inc && ln -s current/pkgdata.inc pkgdata.inc
186
187ifeq ($(DOXYGEN),)
188install-doc:
189else
190install-doc: doc
191	$(RM) -r $(DESTDIR)$(docdir)/$(docsubdir)
192	$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(docsubdir)
193	$(INSTALL_DATA) $(docfiles) $(DESTDIR)$(docdir)/$(docsubdir)
194
195endif
196
197$(DESTDIR)$(pkglibdir)/%: $(top_srcdir)/../data/%
198	$(INSTALL_DATA) $< $@
199
200# Build the tests, but don't run them.
201tests: all
202	$(MAKE) -C $(top_builddir)/test
203
204clean-local:
205	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
206	-$(RMV) "test-*.xml"
207	-$(RMV) "perf-*.xml"
208	-$(RMV) $(ALL_PKGCONFIG_FILES) $(top_builddir)/config/icuinfo.xml
209	$(RMV) Doxyfile doc $(DOCZIP)
210
211distclean-local: clean-local
212	$(RMV) $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc $(top_builddir)/config/icu-config $(top_builddir)/config/icu.pc $(ALL_PKGCONFIG_FILES)
213	$(RMV) config.cache config.log config.status $(top_builddir)/config/icucross.mk $(top_builddir)/config/icucross.inc autom4te.cache uconfig.h.prepend
214	$(RMV) Makefile config/Makefile icudefs.mk $(LIBDIR) $(BINDIR)
215	-$(RMV) dist
216
217check-local: xcheck-local
218	-$(RMV) test-local.xml
219
220xcheck-local: $(top_builddir)/config/icu-config $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc
221	@echo verifying that icu-config --selfcheck can operate
222	@test "passed" = "$(shell $(top_builddir)/config/icu-config --selfcheck 2>&1)" || (echo "FAIL: icu-config could not run properly." ; exit 1)
223	@echo verifying that $(MAKE) -f Makefile.inc selfcheck can operate
224	@test "passed" = "$(shell $(MAKE) --no-print-directory -f $(top_builddir)/config/Makefile.inc SELFCHECK=1 selfcheck)" || (echo "FAIL: Makefile.inc could not run properly." ; exit 1 )
225	@echo "PASS: config selfcheck OK"
226
227#$(srcdir)/configure : $(srcdir)/configure.ac $(top_srcdir)/aclocal.m4
228#	cd $(srcdir) && aclocal && $(AUTOCONF)
229
230icudefs.mk: $(srcdir)/icudefs.mk.in  $(top_builddir)/config.status
231	cd $(top_builddir) \
232		&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
233
234config/icucross.mk: $(top_builddir)/icudefs.mk  $(top_builddir)/Makefile
235	@echo rebuilding $@
236	@(echo "CROSS_ICU_VERSION=$(VERSION)" ;\
237	  echo "TOOLEXEEXT=$(EXEEXT)" \
238	   ) > $@
239	@(echo 'TOOLBINDIR=$$(cross_buildroot)/bin' ;\
240	  echo 'TOOLLIBDIR=$$(cross_buildroot)/lib' ;\
241	  echo "INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(TOOLLIBDIR):$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$$$'"$(LDLIBRARYPATH_ENVVAR)" ;\
242	  echo "PKGDATA_INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$(TOOLLIBDIR):$$$$'"$(LDLIBRARYPATH_ENVVAR) " ;\
243	  echo ) >> $@
244
245config/icucross.inc: $(top_builddir)/icudefs.mk  $(top_builddir)/Makefile @platform_make_fragment@
246	@echo rebuilding $@
247	@(grep '^CURR_FULL_DIR' $(top_builddir)/icudefs.mk ; \
248	  grep '^CURR_FULL_DIR' @platform_make_fragment@ || echo ""; \
249	   ) > $@
250
251config/icu.pc: $(srcdir)/config/icu.pc.in
252	cd $(top_builddir) \
253	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
254
255config/icu-uc.pc: config/icu.pc Makefile icudefs.mk
256	@cat config/icu.pc > $@
257	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Common and Data libraries" >> $@
258	@echo "Name: $(PACKAGE)-uc" >> $@
259	@echo "Libs:" '-L$${libdir}' "${ICULIBS_UC}" "${ICULIBS_DT}" >> $@
260	@echo "Libs.private:" '$${baselibs}' >> $@
261	@echo $@ updated.
262
263config/icu-i18n.pc: config/icu.pc Makefile icudefs.mk
264	@cat config/icu.pc > $@
265	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Internationalization library" >> $@
266	@echo "Name: $(PACKAGE)-i18n" >> $@
267	@echo "Requires: icu-uc" >> $@
268	@echo "Libs:" "${ICULIBS_I18N}" >> $@
269	@echo $@ updated.
270
271config/icu-io.pc: config/icu.pc Makefile icudefs.mk
272	@cat config/icu.pc > $@
273	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Stream and I/O Library" >> $@
274	@echo "Name: $(PACKAGE)-io" >> $@
275	@echo "Requires: icu-i18n" >> $@
276	@echo "Libs:" "${ICULIBS_IO}" >> $@
277	@echo $@ updated.
278
279config/icu-le.pc: config/icu.pc Makefile icudefs.mk
280	@cat config/icu.pc > $@
281	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Layout library" >> $@
282	@echo "Name: $(PACKAGE)-le" >> $@
283	@echo "Requires: icu-uc" >> $@
284	@echo "Libs:" "${ICULIBS_LE}" >> $@
285	@echo $@ updated.
286
287config/icu-lx.pc: config/icu.pc Makefile icudefs.mk
288	@cat config/icu.pc > $@
289	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Paragraph Layout library" >> $@
290	@echo "Name: $(PACKAGE)-lx" >> $@
291	@echo "Requires: icu-le" >> $@
292	@echo "Libs:" "${ICULIBS_LX}" >> $@
293	@echo $@ updated.
294
295
296Makefile: $(srcdir)/Makefile.in icudefs.mk $(top_builddir)/config.status
297	cd $(top_builddir) \
298		&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
299
300$(top_builddir)/config/Makefile.inc: $(srcdir)/config/Makefile.inc.in  $(top_builddir)/config.status
301	cd $(top_builddir) \
302		&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
303
304$(top_builddir)/config/pkgdata.inc: icudefs.mk $(top_builddir)/config/pkgdataMakefile
305	cd $(top_builddir)/config; \
306		$(MAKE) -f pkgdataMakefile
307
308$(top_builddir)/config/pkgdataMakefile:
309	cd $(top_builddir) \
310		&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
311
312$(top_builddir)/config/icu-config: $(top_builddir)/Makefile $(top_srcdir)/config/icu-config-top $(top_srcdir)/config/icu-config-bottom $(top_builddir)/config/Makefile.inc @platform_make_fragment@ $(top_srcdir)/config/make2sh.sed
313	-$(RMV) $@
314	$(INSTALL_SCRIPT) $(top_srcdir)/config/icu-config-top $@
315	chmod u+w $@
316	@echo "# Following from @platform_make_fragment@" >> $@
317	LC_ALL=C sed -f $(top_srcdir)/config/make2sh.sed < $(top_builddir)/config/Makefile.inc | grep -v '#M#' | uniq >> $@
318	LC_ALL=C sed -f $(top_srcdir)/config/make2sh.sed < @platform_make_fragment@ | grep -v '#M#' | uniq >> $@
319	cat $(top_srcdir)/config/icu-config-bottom >> $@
320	echo "# Rebuilt on "`date` >> $@
321	chmod u-w $@
322
323config.status: $(srcdir)/configure $(srcdir)/common/unicode/uvernum.h
324	@echo
325	@echo
326	@echo "*** config.status has become stale ***"
327	@echo "   'configure' and/or 'uvernum.h' have changed, please"
328	@echo "  do 'runConfigureICU' (or 'configure') again, as per"
329	@echo "  the readme.html."
330	@echo
331	@echo
332	exit 1
333
334
335install-manx: $(MANX_FILES)
336	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
337	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
338
339config/%.$(SECTION): $(srcdir)/config/%.$(SECTION).in
340	cd $(top_builddir) \
341	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
342
343icu4j-data-install icu4j-data: all tests
344	@echo ICU4J_ROOT=$(ICU4J_ROOT)
345	@$(MAKE) -C test/testdata $@
346	@$(MAKE) -C data $@
347
348# For updating Windows makefiles
349
350WINDOWS_UPDATEFILES=$(srcdir)/data/makedata.mak $(shell find $(srcdir) -name '*.vcproj' -o -name '*.vcxproj')
351
352WINDOWS_UPDATEFILES_SED=config/windows-update.sed
353
354update-windows-makefiles: config.status
355	@echo Updating Windows Makefiles for ICU $(VERSION)
356	CONFIG_FILES=$(WINDOWS_UPDATEFILES_SED) CONFIG_HEADERS= $(SHELL) ./config.status
357	@for file in $(WINDOWS_UPDATEFILES); do \
358	  echo "Updating $$file"; \
359	  mv "$${file}" "$${file}.bak" && \
360	  sed -f $(WINDOWS_UPDATEFILES_SED) < "$${file}.bak" > "$${file}" && \
361	  rm "$${file}.bak"; \
362	done;
363	$(RMV) $(WINDOWS_UPDATEFILES_SED)
364	@echo Please check over the changes carefully before checking them in.
365
366# For building a source distribution.
367distcheck dist-local:
368	$(MAKE) -C . -f $(top_srcdir)/config/dist.mk srcdir="$(srcdir)" top_srcdir="$(top_srcdir)" $@
369
370ifeq ($(DESTDIR),)
371releaseDist:
372	@echo "Please provide DESTDIR when calling the target releaseDist."
373else
374releaseDist: install
375	@echo -n "ICU Version: " > $(DESTDIR)/readme.txt
376	@echo `./config/icu-config --noverify --version` >> $(DESTDIR)/readme.txt
377	@echo -n "HOST: " >> $(DESTDIR)/readme.txt
378	@echo `./config/icu-config --noverify --host` >> $(DESTDIR)/readme.txt
379	@echo -n "CC Compiler: " >> $(DESTDIR)/readme.txt
380	@echo `./config/icu-config --noverify --cc` >> $(DESTDIR)/readme.txt
381	@echo -n "CXX Compiler: " >> $(DESTDIR)/readme.txt
382	@echo `./config/icu-config --noverify --cxx` >> $(DESTDIR)/readme.txt
383endif
384
385check-installed-icu: install
386	@echo "Testing ICU installed in $(prefix)"
387	$(INSTALLED_INVOKE) $(bindir)/icuinfo$(EXEEXT)
388	$(INSTALLED_INVOKE) $(bindir)/uconv$(EXEEXT) -V
389	$(INSTALLED_INVOKE) $(bindir)/genrb$(EXEEXT) -V
390	$(INSTALLED_INVOKE) $(bindir)/gencnval$(EXEEXT) -h
391	@echo INSTALLED ICU IN "$(prefix)" OK!
392