diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 6940f74514ac..decd67b2cf30 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -59,6 +59,7 @@ ENABLE_TESTS = @ENABLE_TESTS@ ENABLE_PICS = @ENABLE_PICS@ NO_UNIX_LDAP = @NO_UNIX_LDAP@ BUILD_IDLC = @BUILD_IDLC@ +USE_IMPLICIT_ARCHIVE = @USE_IMPLICIT_ARCHIVE@ MOZ_STRIP_NOT_EXPORTED = @MOZ_STRIP_NOT_EXPORTED@ diff --git a/config/rules.mk b/config/rules.mk index c965b113d65a..1a0d5b3d10e9 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -554,8 +554,7 @@ endif SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;) endif -ifndef SHARED_LIBRARY_LIBS - +ifdef USE_IMPLICIT_ARCHIVE # This rule overrides the builtin rule that tells make how to insert object # files into archive libraries. A few notes about what is going on: # The whole point of doing this is to avoid having to store the .o files in @@ -572,6 +571,7 @@ ifndef SHARED_LIBRARY_LIBS # as we proceed from command to the next. This means that the "ar t" is # evaluating the library before we insert new objects. # +ifndef SHARED_LIBRARY_LIBS $(LIBRARY)(%.o): %.o @echo 'queueing $< for insertion into $(LIBRARY)'; \ touch $(LIBRARY:%.a=.%.timestamp) @@ -593,6 +593,17 @@ $(LIBRARY): $(LIBRARY)($(OBJS) $(LOBJS)) $(LIBRARY:%.a=.%.timestamp) Makefile.in else +$(LIBRARY): $(OBJS) $(LOBJS) Makefile Makefile.in + rm -f $@ + @rm -f $(SUB_LOBJS) + @for lib in $(SHARED_LIBRARY_LIBS); do $(AR_EXTRACT) $${lib}; $(CLEANUP2); done + $(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS) + $(RANLIB) $@ + @rm -f foodummyfilefoo $(SUB_LOBJS) +endif # ! SHARED_LIBRARY_LIBS + +else # ! USE_IMPLICIT_ARCHIVE + $(LIBRARY): $(OBJS) $(LOBJS) Makefile Makefile.in rm -f $@ ifdef SHARED_LIBRARY_LIBS @@ -603,8 +614,8 @@ endif $(RANLIB) $@ @rm -f foodummyfilefoo $(SUB_LOBJS) -endif -else +endif # USE_IMPLICIT_ARCHIVE +else # OS2 ifdef OS2_IMPLIB $(LIBRARY): $(OBJS) $(DEF_FILE) rm -f $@ @@ -1293,7 +1304,7 @@ $(MDDEPDIR): MDDEPEND_FILES := $(wildcard $(MDDEPDIR)/*.pp) ifdef MDDEPEND_FILES -ifdef SHARED_LIBRARY_LIBS +ifdef PERL # The script mddepend.pl checks the dependencies and writes to stdout # one rule to force out-of-date objects. For example, # foo.o boo.o: FORCE diff --git a/configure.in b/configure.in index 3d828389fbf6..29ceeaaa0312 100644 --- a/configure.in +++ b/configure.in @@ -2678,6 +2678,12 @@ AC_ARG_ENABLE(verbose-config-defs, VERBOSE_CONFIG_DEFS= fi]) +dnl use GNU make's implicit archive feature to save space +MOZ_ARG_ENABLE_BOOL(implicit-archive, +[ --enable-implicit-archive + Use GNU make's implicit archive feature], + USE_IMPLICIT_ARCHIVE=1) + dnl ======================================================== dnl = dnl = --diable-dtd-debug @@ -2815,6 +2821,7 @@ AC_SUBST(FULL_STATIC_BUILD) AC_SUBST(NO_UNIX_LDAP) AC_SUBST(BUILD_IDLC) AC_SUBST(MOZ_ENABLE_GTK_MOZILLA) +AC_SUBST(USE_IMPLICIT_ARCHIVE) AC_SUBST(MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS) AC_SUBST(MOZ_STRIP_NOT_EXPORTED)