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