Home | History | Annotate | Download | only in icu4c
      1 #******************************************************************************
      2 #
      3 #   Copyright (C) 1998-2009, 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 
     20 ##
     21 
     22 ## Build directory information
     23 subdir = .
     24 
     25 #AUTOCONF = @AUTOCONF@
     26 
     27 ## Optional directory setup
     28 @LAYOUT_TRUE@LAYOUT = layout layoutex
     29 @ICUIO_TRUE@ICUIO = io
     30 @EXTRAS_TRUE@EXTRA = extra
     31 @TESTS_TRUE@TEST = test
     32 @SAMPLES_TRUE@SAMPLE = samples
     33 
     34 DOXYGEN = @DOXYGEN@
     35 DOCZIP = icu-docs.zip
     36 
     37 ## Files to remove for 'make clean'
     38 CLEANFILES = *~
     39 
     40 ## Files built (autoconfed) and installed
     41 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)/%)
     42 
     43 ## Files built (autoconfed) but not installed
     44 LOCAL_BUILT_FILES = icudefs.mk config/icucross.mk
     45 
     46 DOCDIRS = common i18n
     47 SUBDIRS =  stubdata common i18n $(LAYOUT) tools data $(ICUIO) $(EXTRA) $(SAMPLE) $(TEST)
     48 
     49 SECTION = 1
     50 
     51 MANX_FILES = config/icu-config.$(SECTION)
     52 
     53 ALL_MAN_FILES = $(MANX_FILES)
     54 
     55 ## Extra files to install [nothing at present]
     56 EXTRA_DATA =
     57 
     58 ## List of phony targets
     59 .PHONY : all all-local all-recursive install install-local install-udata install-udata-files install-udata-dlls		\
     60 install-recursive clean clean-local clean-recursive distclean		\
     61 distclean-local distclean-recursive doc dist dist-local dist-recursive	\
     62 check check-local check-recursive clean-recursive-with-twist install-icu \
     63 doc install-doc tests
     64 
     65 ## Clear suffix list
     66 .SUFFIXES :
     67 
     68 ## List of standard targets
     69 all: all-local all-recursive
     70 install: install-recursive install-local
     71 clean: clean-recursive-with-twist clean-local
     72 distclean : distclean-recursive distclean-local
     73 dist: dist-recursive dist-local
     74 check: all check-recursive
     75 check-recursive: all
     76 
     77 ifeq ($(DOXYGEN),)
     78 doc:
     79 	@echo you need Doxygen to generate documentation. Doxygen can be found on the Web
     80 	@echo at http://www.doxygen.org/
     81 else
     82 doc: doc/html/index.html
     83 
     84 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)
     85 	$(DOXYGEN)
     86 
     87 Doxyfile: $(srcdir)/Doxyfile.in
     88 	CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
     89 
     90 $(DOCZIP): doc
     91 	-$(RMV) $(DOCZIP)
     92 	( cd doc/html ; zip -r ../../$(DOCZIP) * )
     93 endif
     94 
     95 LOCAL_SUBDIRS = $(SUBDIRS)
     96 CLEAN_FIRST_SUBDIRS = tools
     97 
     98 $(LIBDIR) $(BINDIR):
     99 	-$(MKINSTALLDIRS) $@
    100 
    101 ## Recursive targets
    102 all-recursive install-recursive clean-recursive distclean-recursive dist-recursive check-recursive: $(LIBDIR) $(BINDIR)
    103 	@dot_seen=no; \
    104 	target=`echo $@ | sed s/-recursive//`; \
    105 	list='$(LOCAL_SUBDIRS)'; for subdir in $$list; do \
    106 	  echo "$(MAKE)[$(MAKELEVEL)]: Making \`$$target' in \`$$subdir'"; \
    107 	  if test "$$subdir" = "."; then \
    108 	    dot_seen=yes; \
    109 	    local_target="$$target-local"; \
    110 	  else \
    111 	    local_target="$$target"; \
    112 	  fi; \
    113 	  (cd $$subdir && $(MAKE) RECURSIVE=YES $$local_target) || exit; \
    114 	done; \
    115 	if test "$$dot_seen" = "no"; then \
    116 	  $(MAKE) "$$target-local" || exit; \
    117 	fi
    118 
    119 clean-recursive-with-twist:
    120 	$(MAKE) clean-recursive LOCAL_SUBDIRS='$(CLEAN_FIRST_SUBDIRS) $(filter-out $(CLEAN_FIRST_SUBDIRS),$(LOCAL_SUBDIRS))'
    121 
    122 all-local: $(srcdir)/configure $(LOCAL_BUILT_FILES) $(INSTALLED_BUILT_FILES)
    123 
    124 install-local: install-icu install-manx
    125 
    126 install-icu: $(INSTALLED_BUILT_FILES)
    127 	@$(MKINSTALLDIRS) $(DESTDIR)$(pkgdatadir)/config
    128 	@$(MKINSTALLDIRS) $(DESTDIR)$(pkglibdir)
    129 	@$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
    130 	@$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
    131 	$(INSTALL_DATA) @platform_make_fragment@ $(DESTDIR)$(pkgdatadir)/config/@platform_make_fragment_name@
    132 	$(INSTALL_SCRIPT) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(pkgdatadir)/mkinstalldirs
    133 	$(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
    134 	$(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
    135 	$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
    136 	$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
    137 	$(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc
    138 	cd $(DESTDIR)$(pkglibdir)/..; \
    139 	    $(RM) current && ln -s $(VERSION) current; \
    140 	    $(RM) Makefile.inc && ln -s current/Makefile.inc Makefile.inc; \
    141 	    $(RM) pkgdata.inc && ln -s current/pkgdata.inc pkgdata.inc
    142 
    143 ifeq ($(DOXYGEN),)
    144 install-doc:
    145 else
    146 install-doc: doc
    147 	$(RM) -r $(DESTDIR)$(docdir)/$(docsubdir)
    148 	$(MKINSTALLDIRS) $(DESTDIR)$(docdir)/$(docsubdir)
    149 	$(INSTALL_DATA) doc/html/* $(DESTDIR)$(docdir)/$(docsubdir)
    150 endif
    151 
    152 $(DESTDIR)$(pkglibdir)/%: $(top_srcdir)/../data/%
    153 	$(INSTALL_DATA) $< $@
    154 
    155 # Build the tests, but don't run them.
    156 tests: all
    157 	$(MAKE) -C $(top_builddir)/test
    158 
    159 dist-local:
    160 
    161 clean-local:
    162 	test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
    163 	$(RMV) Doxyfile doc $(DOCZIP)
    164 
    165 distclean-local: clean-local
    166 	$(RMV) $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc $(top_builddir)/config/icu-config
    167 	$(RMV) config.cache config.log config.status $(top_builddir)/config/icucross.mk
    168 	$(RMV) Makefile config/Makefile icudefs.mk $(LIBDIR) $(BINDIR)
    169 
    170 check-local: $(top_builddir)/config/icu-config $(top_builddir)/config/Makefile.inc $(top_builddir)/config/pkgdata.inc
    171 	@echo verifying that icu-config --selfcheck can operate
    172 	@test "passed" = "$(shell $(top_builddir)/config/icu-config --selfcheck 2>&1)" || (echo "FAIL: icu-config could not run properly." ; exit 1)
    173 	@echo verifying that $(MAKE) -f Makefile.inc selfcheck can operate
    174 	@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 )
    175 	@echo "PASS: config selfcheck OK"
    176 
    177 #$(srcdir)/configure : $(srcdir)/configure.in $(top_srcdir)/aclocal.m4
    178 #	cd $(srcdir) && $(AUTOCONF)
    179 
    180 icudefs.mk: $(srcdir)/icudefs.mk.in  $(top_builddir)/config.status
    181 	cd $(top_builddir) \
    182 		&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    183 
    184 config/icucross.mk: $(top_builddir)/icudefs.mk  $(top_builddir)/Makefile
    185 	@echo rebuilding $@
    186 	@(echo "CROSS_ICU_VERSION=$(VERSION)" ;\
    187 	  echo "TOOLEXEEXT=$(EXEEXT)" \
    188 	   ) > $@
    189 	@(echo 'TOOLBINDIR=$$(cross_buildroot)/bin' ;\
    190 	  echo 'TOOLLIBDIR=$$(cross_buildroot)/lib' ;\
    191 	  echo "INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(TOOLLIBDIR):$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$$$'"$(LDLIBRARYPATH_ENVVAR)" ;\
    192 	  echo "PKGDATA_INVOKE=$(LDLIBRARYPATH_ENVVAR)=$(LIBRARY_PATH_PREFIX)"'$$(cross_buildroot)/stubdata:$$(cross_buildroot)/tools/ctestfw:$$(TOOLLIBDIR):$$$$'"$(LDLIBRARYPATH_ENVVAR) "'$$'"(PKGDATA_INVOKE_OPTS)" ;\
    193 	  echo ) >> $@
    194 
    195 Makefile: $(srcdir)/Makefile.in icudefs.mk $(top_builddir)/config.status
    196 	cd $(top_builddir) \
    197 		&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    198 
    199 $(top_builddir)/config/Makefile.inc: $(srcdir)/config/Makefile.inc.in  $(top_builddir)/config.status
    200 	cd $(top_builddir) \
    201 		&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
    202 
    203 $(top_builddir)/config/pkgdata.inc: icudefs.mk $(top_builddir)/config/pkgdataMakefile
    204 	cd $(top_builddir)/config; \
    205 		$(MAKE) -f pkgdataMakefile
    206 
    207 $(top_builddir)/config/pkgdataMakefile:
    208 	cd $(top_builddir) \
    209 		&& CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
    210 
    211 $(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
    212 	-$(RMV) $@
    213 	$(INSTALL_SCRIPT) $(top_srcdir)/config/icu-config-top $@
    214 	chmod u+w $@
    215 	@echo "# Following from @platform_make_fragment@" >> $@
    216 	sed -f $(top_srcdir)/config/make2sh.sed < $(top_builddir)/config/Makefile.inc | grep -v '#M#' | uniq >> $@
    217 	sed -f $(top_srcdir)/config/make2sh.sed < @platform_make_fragment@ | grep -v '#M#' | uniq >> $@
    218 	cat $(top_srcdir)/config/icu-config-bottom >> $@
    219 	echo "# Rebuilt on "`date` >> $@
    220 	chmod u-w $@
    221 
    222 config.status: $(srcdir)/configure $(srcdir)/common/unicode/uversion.h
    223 	@echo
    224 	@echo
    225 	@echo "*** config.status has become stale ***"
    226 	@echo "   'configure' and/or 'uversion.h' have changed, please"
    227 	@echo "  do 'runConfigureICU' (or 'configure') again, as per"
    228 	@echo "  the readme.html."
    229 	@echo
    230 	@echo
    231 	exit 1
    232 
    233 
    234 install-manx: $(MANX_FILES)
    235 	$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
    236 	$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
    237 
    238 config/%.$(SECTION): $(srcdir)/config/%.$(SECTION).in
    239 	cd $(top_builddir) \
    240 	 && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
    241 
    242