]> granicus.if.org Git - icu/commitdiff
ICU-9456 Optimize the ICU4C build on Mac OS X
authorGeorge Rhoten <grhoten@users.noreply.github.com>
Fri, 3 Aug 2012 17:27:44 +0000 (17:27 +0000)
committerGeorge Rhoten <grhoten@users.noreply.github.com>
Fri, 3 Aug 2012 17:27:44 +0000 (17:27 +0000)
X-SVN-Rev: 32093

icu4c/source/config/mh-darwin
icu4c/source/data/Makefile.in
icu4c/source/extra/uconv/Makefile.in

index d8e6d5ba0e558831fb0cf97e474886557d7edfe9..3839d9c43fee77c9fcecedf7007258deebc82266 100644 (file)
@@ -1,7 +1,7 @@
 ## -*-makefile-*-
 ## Darwin-specific setup (Darwin is the Mac OS X developer preview, successor
 ## to Rhapsody, aka Mac OS X Server)
-## Copyright (c) 1999-2011 International Business Machines Corporation and
+## Copyright (c) 1999-2012 International Business Machines Corporation and
 ## others. All Rights Reserved.
 
 ## Flags for position independent code
@@ -9,12 +9,15 @@ SHAREDLIBCFLAGS = -dynamic
 SHAREDLIBCXXFLAGS = -dynamic
 SHAREDLIBCPPFLAGS =
 
+# Do not export internal methods by default
+LIBCFLAGS += -fvisibility=hidden
+LIBCXXFLAGS += -fvisibility=hidden
+
 # Pad out the paths to the maximum possible length
 LD_FLAGS += -headerpad_max_install_names
 
-## Commands to generate dependency files
-GEN_DEPS.c=    $(CC) -E -MMD  $(DEFS) $(CPPFLAGS)
-GEN_DEPS.cc=   $(CXX) -E -MMD  $(DEFS) $(CPPFLAGS)
+# We do not need to see the stderr message that the archive was made.
+ARFLAGS += -c
 
 ## Commands to compile
 COMPILE.c=     $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -fno-common -c
@@ -45,45 +48,36 @@ SO=         dylib
 ## Non-shared intermediate object suffix
 STATIC_O = ao
 
+# Make sure that both the static and dynamic intermediate objects
+# get dependency checking
+ifneq ($(ENABLE_STATIC),)
+ifneq ($(ENABLE_DYNAMIC),)
+       STATIC_DEPENDENCY_FILE=" $*.$(STATIC_O)"
+       DYNAMIC_DEPENDENCY_FILE=" $*.o"
+endif
+endif
+
 ## Override Versioned target for a shared library.
 FINAL_SO_TARGET=  $(basename $(SO_TARGET)).$(SO_TARGET_VERSION).$(SO)
 MIDDLE_SO_TARGET= $(basename $(SO_TARGET)).$(SO_TARGET_VERSION_MAJOR).$(SO)
 
-## Compilation rules
+## Compilation and dependency rules
 %.$(STATIC_O): $(srcdir)/%.c
-       $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS) -o $@ $<
+       $(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -MMD -MT "$*.d$(DYNAMIC_DEPENDENCY_FILE)" -o $@ $<
 %.o: $(srcdir)/%.c
-       $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS) -o $@ $<
+       $(strip $(COMPILE.c) $(DYNAMICCPPFLAGS) $(DYNAMICCFLAGS)) -MMD -MT "$*.d$(STATIC_DEPENDENCY_FILE)" -o $@ $<
 
 %.$(STATIC_O): $(srcdir)/%.cpp
-       $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS) -o $@ $<
+       $(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -MMD -MT "$*.d$(DYNAMIC_DEPENDENCY_FILE)" -o $@ $<
 %.o: $(srcdir)/%.cpp
-       $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS) -o $@ $<
-
-
-## Dependency rules
-%.d : $(srcdir)/%.c
-       @echo "generating dependency information for $<"
-       @$(GEN_DEPS.c) $< > /dev/null
-       @mv $@ $@~
-       @printf "%s" "$@ " > $@
-       @cat < $@~ >> $@
-       @-rm $@~
-
-%.d : $(srcdir)/%.cpp
-       @echo "generating dependency information for $<"
-       @$(GEN_DEPS.cc) $< >/dev/null
-       @mv $@ $@~
-       @printf "%s" "$@ " > $@
-       @cat < $@~ >> $@
-       @-rm $@~
+       $(strip $(COMPILE.cc) $(DYNAMICCPPFLAGS) $(DYNAMICCXXFLAGS)) -MMD -MT "$*.d$(STATIC_DEPENDENCY_FILE)" -o $@ $<
 
 ## Versioned libraries rules
 
 %.$(SO_TARGET_VERSION_MAJOR).$(SO): %.$(SO_TARGET_VERSION).$(SO)
-       $(RM) $@ && ln -s ${<F} $@
+       ln -sf ${<F} $@
 %.$(SO): %.$(SO_TARGET_VERSION_MAJOR).$(SO)
-       $(RM) $@ && ln -s ${*F}.$(SO_TARGET_VERSION).$(SO) $@
+       ln -sf ${*F}.$(SO_TARGET_VERSION).$(SO) $@
 
 # tzcode option
 TZORIG_EXTRA_CFLAGS=-DSTD_INSPIRED
index a53f95659c073e707d631eeacbc477c2ac61da37..a1d8845437a89507cf427467fcc14d86567d9382 100644 (file)
@@ -513,12 +513,6 @@ $(BUILDDIR)/%.spp: $(SPREPSRCDIR)/%.txt $(TOOLBINDIR)/gensprep$(TOOLEXEEXT) $(BU
 ####################################################    BRK
 # BRK FILES
 
-#thaidict.brk: $(SRCDATADIR)/thaidict.brk
-#      $(RMV) $@ && ln -s $(BUILDDIR) $@
-
-#khmerdict.brk: $(SRCDATADIR)/khmerdict.brk
-#      $(RMV) $@ && ln -s $(BUILDDIR) $@
-
 $(BRKBLDDIR)/%.brk: $(BRKSRCDIR)/%.txt $(TOOLBINDIR)/genbrk$(TOOLEXEEXT) $(DAT_FILES)
        $(INVOKE) $(TOOLBINDIR)/genbrk -c -i $(BUILDDIR) -r $< -o $@
 
@@ -668,7 +662,7 @@ $(COLLATION_INDEX_FILE): $(SRCLISTDEPS)
        echo "}" >> $@;
 
 ### brk res
-$(BRKBLDDIR)/%.res: $(BRKSRCDIR)/%.txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(BRK_FILES) $(DAT_FILES)
+$(BRKBLDDIR)/%.res: $(BRKSRCDIR)/%.txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT) $(BRK_FILES) $(CTD_FILES) $(DAT_FILES)
        $(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -i $(BUILDDIR) -s $(BRKSRCDIR) -d $(BRKBLDDIR) $(<F)
 
 $(BRKBLDDIR)/$(INDEX_NAME).res: $(OUTTMPDIR)/$(BREAK_TREE)/$(INDEX_NAME).txt $(TOOLBINDIR)/genrb$(TOOLEXEEXT)
index 5ab56c51b187c126c8f556abf25b02e2f2989852..eef69515d35bf658c9744078ce2c87663cc514cb 100644 (file)
@@ -77,7 +77,8 @@ DEPS = $(OBJECTS:.o=.d)
 
 ## List of phony targets
 .PHONY : all all-local install install-local clean clean-local \
-distclean resclean distclean-local dist dist-local check check-local resfiles package-resfiles install-resfiles install-man
+distclean resclean distclean-local dist dist-local \
+check check-local build-dir resfiles package-resfiles install-resfiles install-man
 
 ## Clear suffix list
 .SUFFIXES :
@@ -91,7 +92,7 @@ distclean : distclean-local
 dist: dist-local
 check: check-local
 
-all-local: $(TARGET) resfiles $(ALL_MAN_FILES)
+all-local: build-dir $(TARGET) resfiles $(ALL_MAN_FILES)
 
 install-local: all-local install-target install-resfiles install-man
 
@@ -128,6 +129,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 pkgdata.inc: pkgdataMakefile
        $(MAKE) -f pkgdataMakefile
 
+build-dir:
+       @$(MKINSTALLDIRS) $(RESDIR)
+
 pkgdataMakefile:
        cd $(top_builddir) \
        && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@@ -142,6 +146,12 @@ $(TARGET) : $(OBJECTS)  $(UCONVMSG_LIB)
 
 resfiles: $(RESFILES) package-resfiles
 
+# The | is an order-only prerequisite. This helps when the -j option is used,
+# and we don't want the files to be built before the directories are built.
+ifneq ($(filter order-only,$(.FEATURES)),)
+$(RESFILES) $(RESDIR)/$(RESDIR).lst: | build-dir
+endif
+
 ifeq ($(UCONVMSG_STATIC),YES)
 $(UCONVMSG_LIB): resfiles
 endif
@@ -150,8 +160,7 @@ endif
 package-resfiles: $(RESFILES) $(RESDIR)/$(RESDIR).lst pkgdata.inc
        $(INVOKE) $(PKGDATA_INVOKE_OPTS) $(TOOLBINDIR)/pkgdata -p $(MSGNAME) $(PKGDATA_OPTS) -m $(PKGMODE) -s $(RESDIR) -d $(RESDIR) -T $(RESDIR) $(RESDIR)/$(RESDIR).lst
 
-$(RESDIR)/$(RESDIR).lst: Makefile $(srcdir)/resfiles.mk
-       @$(MKINSTALLDIRS) $(RESDIR)
+$(RESDIR)/$(RESDIR).lst: Makefile build-dir $(srcdir)/resfiles.mk
        @-$(RMV) $@
        @for file in $(RESFILES:$(RESDIR)/%.res=%.res); do \
          echo $$file >> $@; \
@@ -170,7 +179,6 @@ endif
 $(UCONVMSG_LIB): resfiles
 
 $(MSGNAME)/%.res: $(srcdir)/$(RESOURCESDIR)/%.txt
-       $(MKINSTALLDIRS) $(@D)
        $(INVOKE) $(TOOLBINDIR)/genrb -e UTF-8 -s $(^D) -d $(@D) $(^F)
 
 install-man: $(ALL_MAN_FILES)