Home | History | Annotate | Download | only in icu4c
      1 #******************************************************************************
      2 #
      3 #   Copyright (C) 1998-2012, International Business Machines
      4 #   Corporation and others.  All Rights Reserved.
      5 #
      6 #******************************************************************************
      7 ## Top-level Makefile.in for ICU
      8 ## Stephen F. Booth
      9 
     10 srcdir = @srcdir@
     11 top_srcdir = @top_srcdir@
     12 
     13 top_builddir = .
     14 
     15 include $(top_builddir)/icudefs.mk
     16 
     17 docdir = $(datadir)/doc
     18 docsubdir = $(PACKAGE)$(ICULIBDASHSUFFIX)/html
     19 docfilesdir = doc/html
     20 docfiles = $(docfilesdir)/*.png $(docfilesdir)/*.html $(docfilesdir)/*.css $(docfilesdir)/*.tag 
     21 docsrchdir = $(docfilesdir)/search
     22 docsrchfiles = $(docsrchdir)/*
     23 
     24 ##
     25 
     26 ## Build directory information
     27 subdir = .
     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.
     39 ALL_PKGCONFIG_SUFFIX=uc i18n
     40 @LAYOUT_TRUE@ALL_PKGCONFIG_SUFFIX+= le lx
     41 @ICUIO_TRUE@ALL_PKGCONFIG_SUFFIX+= io
     42 
     43 DOXYGEN = @DOXYGEN@
     44 DOCZIP = icu-docs.zip
     45 
     46 ## Files to remove for 'make clean'
     47 CLEANFILES = *~
     48 
     49 ALL_PKGCONFIG_FILES=$(ALL_PKGCONFIG_SUFFIX:%=$(top_builddir)/config/icu-%.pc)
     50 
     51 ## Files built (autoconfed) and installed
     52 INSTALLED_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
     55 LOCAL_BUILT_FILES = icudefs.mk config/icucross.mk
     56 
     57 DOCDIRS = common i18n
     58 SUBDIRS =  stubdata common i18n $(LAYOUT) tools data $(ICUIO) $(EXTRA) $(SAMPLE) $(TEST)
     59 
     60 SECTION = 1
     61 
     62 MANX_FILES = config/icu-config.$(SECTION)
     63 
     64 ALL_MAN_FILES = $(MANX_FILES)
     65 
     66 ## Extra files to install [nothing at present]
     67 EXTRA_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		\
     71 install-recursive clean clean-local clean-recursive distclean		\
     72 distclean-local distclean-recursive doc dist dist-local dist-recursive	\
     73 check check-local check-recursive clean-recursive-with-twist install-icu \
     74 doc install-doc tests icu4j-data icu4j-data-install update-windows-makefiles xcheck-local xcheck-recursive xperf xcheck xperf-recursive \
     75 check-exhaustive check-exhaustive-local check-exhaustive-recursive releaseDist
     76 
     77 ## Clear suffix list
     78 .SUFFIXES :
     79 
     80 ## List of standard targets
     81 all: all-local all-recursive
     82 install: install-recursive install-local
     83 clean: clean-recursive-with-twist clean-local
     84 distclean : distclean-recursive distclean-local
     85 dist: dist-recursive dist-local
     86 check: all check-recursive
     87 check-recursive: all
     88 xcheck: all xcheck-recursive
     89 xperf: all xperf-recursive
     90 check-exhaustive: all check-exhaustive-recursive
     91 
     92 check-exhaustive-local: check-local
     93 
     94 xcheck-recursive: all xcheck-local
     95 	@$(MAKE) -C test xcheck
     96 
     97 xperf-recursive: all tests
     98 	@$(MAKE) -C test/perf xperf
     99 
    100 $(top_builddir)/config/icuinfo.xml: all
    101 	@$(MAKE) -C tools/icuinfo check
    102 
    103 ifeq ($(DOXYGEN),)
    104 doc doc-searchengine:
    105 	@echo you need Doxygen to generate documentation. Doxygen can be found on the Web
    106 	@echo at http://www.doxygen.org/
    107 else
    108 doc: doc/html/index.html
    109 
    110 doc-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 
    116 doc/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 
    121 Doxyfile: $(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) * )
    127 endif
    128 
    129 LOCAL_SUBDIRS = $(SUBDIRS)
    130 CLEAN_FIRST_SUBDIRS = tools
    131 
    132 $(LIBDIR) $(BINDIR):
    133 	-$(MKINSTALLDIRS) $@
    134 
    135 ## Recursive targets
    136 all-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 
    153 clean-recursive-with-twist:
    154 	$(MAKE) clean-recursive LOCAL_SUBDIRS='$(CLEAN_FIRST_SUBDIRS) $(filter-out $(CLEAN_FIRST_SUBDIRS),$(LOCAL_SUBDIRS))'
    155 
    156 all-local: $(srcdir)/configure $(LOCAL_BUILT_FILES) $(INSTALLED_BUILT_FILES)
    157 ifndef VERBOSE
    158 	@echo "Note: rebuild with \"$(MAKE) VERBOSE=1 $(MAKECMDGOALS)\" to show all compiler parameters."
    159 endif
    160 install-local: install-icu install-manx
    161 
    162 install-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 
    183 ifeq ($(DOXYGEN),)
    184 install-doc:
    185 else
    186 install-doc: doc
    187 	$(RM) -r $(DESTDIR)$(docdir)/$(docsubdir)
    188 	$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(docsubdir)
    189 	$(INSTALL_DATA) $(docfiles) $(DESTDIR)$(docdir)/$(docsubdir)
    190 
    191 endif
    192 
    193 $(DESTDIR)$(pkglibdir)/%: $(top_srcdir)/../data/%
    194 	$(INSTALL_DATA) $< $@
    195 
    196 # Build the tests, but don't run them.
    197 tests: all
    198 	$(MAKE) -C $(top_builddir)/test
    199 
    200 clean-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 
    207 distclean-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 autom4te.cache uconfig.h.prepend
    210 	$(RMV) Makefile config/Makefile icudefs.mk $(LIBDIR) $(BINDIR)
    211 	-$(RMV) dist
    212 
    213 check-local: xcheck-local
    214 	-$(RMV) test-local.xml
    215 
    216 xcheck-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 
    226 icudefs.mk: $(srcdir)/icudefs.mk.in  $(top_builddir)/config.status
    227 	cd $(top_builddir) \
    228 		&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    229 
    230 config/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 
    241 
    242 config/icu.pc: $(srcdir)/config/icu.pc.in
    243 	cd $(top_builddir) \
    244 	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    245 
    246 config/icu-uc.pc: config/icu.pc Makefile icudefs.mk
    247 	@cat config/icu.pc > $@
    248 	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Common and Data libraries" >> $@
    249 	@echo "Name: $(PACKAGE)-uc" >> $@
    250 	@echo "Libs:" '-L$${libdir}' "${ICULIBS_UC}" "${ICULIBS_DT}" >> $@
    251 	@echo "Libs.private:" '$${baselibs}' >> $@
    252 	@echo $@ updated.
    253 
    254 config/icu-i18n.pc: config/icu.pc Makefile icudefs.mk
    255 	@cat config/icu.pc > $@
    256 	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Internationalization library" >> $@
    257 	@echo "Name: $(PACKAGE)-i18n" >> $@
    258 	@echo "Requires: icu-uc" >> $@
    259 	@echo "Libs:" "${ICULIBS_I18N}" >> $@
    260 	@echo $@ updated.
    261 
    262 config/icu-io.pc: config/icu.pc Makefile icudefs.mk
    263 	@cat config/icu.pc > $@
    264 	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Stream and I/O Library" >> $@
    265 	@echo "Name: $(PACKAGE)-io" >> $@
    266 	@echo "Requires: icu-i18n" >> $@
    267 	@echo "Libs:" "${ICULIBS_IO}" >> $@
    268 	@echo $@ updated.
    269 
    270 config/icu-le.pc: config/icu.pc Makefile icudefs.mk
    271 	@cat config/icu.pc > $@
    272 	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Layout library" >> $@
    273 	@echo "Name: $(PACKAGE)-le" >> $@
    274 	@echo "Requires: icu-uc" >> $@
    275 	@echo "Libs:" "${ICULIBS_LE}" >> $@
    276 	@echo $@ updated.
    277 
    278 config/icu-lx.pc: config/icu.pc Makefile icudefs.mk
    279 	@cat config/icu.pc > $@
    280 	@echo "Description: $(PACKAGE_ICU_DESCRIPTION): Paragraph Layout library" >> $@
    281 	@echo "Name: $(PACKAGE)-lx" >> $@
    282 	@echo "Requires: icu-le" >> $@
    283 	@echo "Libs:" "${ICULIBS_LX}" >> $@
    284 	@echo $@ updated.
    285 
    286 
    287 Makefile: $(srcdir)/Makefile.in icudefs.mk $(top_builddir)/config.status
    288 	cd $(top_builddir) \
    289 		&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    290 
    291 $(top_builddir)/config/Makefile.inc: $(srcdir)/config/Makefile.inc.in  $(top_builddir)/config.status
    292 	cd $(top_builddir) \
    293 		&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
    294 
    295 $(top_builddir)/config/pkgdata.inc: icudefs.mk $(top_builddir)/config/pkgdataMakefile
    296 	cd $(top_builddir)/config; \
    297 		$(MAKE) -f pkgdataMakefile
    298 
    299 $(top_builddir)/config/pkgdataMakefile:
    300 	cd $(top_builddir) \
    301 		&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
    302 
    303 $(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
    304 	-$(RMV) $@
    305 	$(INSTALL_SCRIPT) $(top_srcdir)/config/icu-config-top $@
    306 	chmod u+w $@
    307 	@echo "# Following from @platform_make_fragment@" >> $@
    308 	LC_ALL=C sed -f $(top_srcdir)/config/make2sh.sed < $(top_builddir)/config/Makefile.inc | grep -v '#M#' | uniq >> $@
    309 	LC_ALL=C sed -f $(top_srcdir)/config/make2sh.sed < @platform_make_fragment@ | grep -v '#M#' | uniq >> $@
    310 	cat $(top_srcdir)/config/icu-config-bottom >> $@
    311 	echo "# Rebuilt on "`date` >> $@
    312 	chmod u-w $@
    313 
    314 config.status: $(srcdir)/configure $(srcdir)/common/unicode/uvernum.h
    315 	@echo
    316 	@echo
    317 	@echo "*** config.status has become stale ***"
    318 	@echo "   'configure' and/or 'uvernum.h' have changed, please"
    319 	@echo "  do 'runConfigureICU' (or 'configure') again, as per"
    320 	@echo "  the readme.html."
    321 	@echo
    322 	@echo
    323 	exit 1
    324 
    325 
    326 install-manx: $(MANX_FILES)
    327 	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
    328 	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
    329 
    330 config/%.$(SECTION): $(srcdir)/config/%.$(SECTION).in
    331 	cd $(top_builddir) \
    332 	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    333 
    334 icu4j-data-install icu4j-data: all tests
    335 	@echo ICU4J_ROOT=$(ICU4J_ROOT)
    336 	@$(MAKE) -C test/testdata $@
    337 	@$(MAKE) -C data $@
    338 
    339 # For updating Windows makefiles
    340 
    341 WINDOWS_UPDATEFILES=$(srcdir)/data/makedata.mak $(shell find $(srcdir) -name '*.vcproj' -o -name '*.vcxproj')
    342 
    343 WINDOWS_UPDATEFILES_SED=config/windows-update.sed
    344 
    345 update-windows-makefiles: config.status
    346 	@echo Updating Windows Makefiles for ICU $(VERSION)
    347 	CONFIG_FILES=$(WINDOWS_UPDATEFILES_SED) CONFIG_HEADERS= $(SHELL) ./config.status
    348 	@for file in $(WINDOWS_UPDATEFILES); do \
    349 	  echo "Updating $$file"; \
    350 	  mv "$${file}" "$${file}.bak" && \
    351 	  sed -f $(WINDOWS_UPDATEFILES_SED) < "$${file}.bak" > "$${file}" && \
    352 	  rm "$${file}.bak"; \
    353 	done;
    354 	$(RMV) $(WINDOWS_UPDATEFILES_SED)
    355 	@echo Please check over the changes carefully before checking them in.
    356 
    357 # For building a source distribution.
    358 distcheck dist-local:
    359 	$(MAKE) -C . -f $(top_srcdir)/config/dist.mk srcdir="$(srcdir)" top_srcdir="$(top_srcdir)" $@
    360 
    361 ifeq ($(DESTDIR),)
    362 releaseDist:
    363 	@echo "Please provide DESTDIR when calling the target releaseDist."
    364 else
    365 releaseDist: install
    366 	@echo -n "ICU Version: " > $(DESTDIR)/readme.txt
    367 	@echo `./config/icu-config --noverify --version` >> $(DESTDIR)/readme.txt
    368 	@echo -n "HOST: " >> $(DESTDIR)/readme.txt
    369 	@echo `./config/icu-config --noverify --host` >> $(DESTDIR)/readme.txt
    370 	@echo -n "CC Compiler: " >> $(DESTDIR)/readme.txt
    371 	@echo `./config/icu-config --noverify --cc` >> $(DESTDIR)/readme.txt
    372 	@echo -n "CXX Compiler: " >> $(DESTDIR)/readme.txt
    373 	@echo `./config/icu-config --noverify --cxx` >> $(DESTDIR)/readme.txt
    374 endif
    375 
    376 check-installed-icu: install
    377 	@echo "Testing ICU installed in $(prefix)"
    378 	$(INSTALLED_INVOKE) $(bindir)/icuinfo$(EXEEXT)
    379 	$(INSTALLED_INVOKE) $(bindir)/uconv$(EXEEXT) -V
    380 	$(INSTALLED_INVOKE) $(bindir)/genrb$(EXEEXT) -V
    381 	$(INSTALLED_INVOKE) $(bindir)/gencnval$(EXEEXT) -h
    382 	@echo INSTALLED ICU IN "$(prefix)" OK!
    383