Applied Jim Nance's, <jim_nance@yahoo.com>, patch to reduce the size of a build by using a modified version of GNU make's implicit ruleset that incrementally add object files to static library archive and eliminates the need to have the unused object files sitting around. A clobber is required to see the savings.
Bug #15241 . r=sleestack
This commit is contained in:
Родитель
cd42feb263
Коммит
a080d5dcc4
|
@ -116,6 +116,7 @@ AR = @AR@
|
|||
AR_FLAGS = @AR_FLAGS@
|
||||
AR_EXTRACT = @AR_EXTRACT@
|
||||
AR_LIST = @AR_LIST@
|
||||
AR_DELETE = @AR_DELETE@
|
||||
AS = @AS@
|
||||
ASFLAGS = @ASFLAGS@
|
||||
AS_DASH_C_FLAG = @AS_DASH_C_FLAG@
|
||||
|
|
|
@ -183,7 +183,7 @@ else
|
|||
ALL_TRASH = $(TARGETS) $(OBJS) LOGS TAGS $(GARBAGE) a.out \
|
||||
$(NOSUCHFILE) $(JMC_STUBS) so_locations \
|
||||
_gen _stubs $(MDDEPDIR) $(wildcard gts_tmp_*) \
|
||||
$(PROGOBJS)
|
||||
$(PROGOBJS) $(LIBRARY:%.a=.%.timestamp)
|
||||
endif
|
||||
|
||||
ifdef JAVA_OR_NSJVM
|
||||
|
@ -554,6 +554,40 @@ endif
|
|||
SUB_LOBJS = $(shell for lib in $(SHARED_LIBRARY_LIBS); do $(AR_LIST) $${lib} $(CLEANUP1); done;)
|
||||
endif
|
||||
|
||||
ifndef SHARED_LIBRARY_LIBS
|
||||
|
||||
# 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
|
||||
# addition to the .a files, but not have regenerate all the .o files every time
|
||||
# we regenerate the .a file. Make knows how to do this by itself. However,
|
||||
# it wants to insert the .o files into the .a file 1 at a time which is both
|
||||
# slow and also breaks parallel builds. These rules get make to build all
|
||||
# the .o files ahead of time and insert them all at once. We use the
|
||||
# .timestamp file to make this work reliably.
|
||||
#
|
||||
# I have learned that $(shell) and $(wildcard) variables do not necessarily
|
||||
# get evaluated when they are used. All the $(shell) variables for a rule
|
||||
# seem to get evaluated right before the rules commands are executed, not
|
||||
# as we proceed from command to the next. This means that the "ar t" is
|
||||
# evaluating the library before we insert new objects.
|
||||
#
|
||||
$(LIBRARY)(%.o): %.o
|
||||
@echo 'queueing $< for insertion into $(LIBRARY)'; \
|
||||
touch $(LIBRARY:%.a=.%.timestamp)
|
||||
|
||||
$(LIBRARY:%.a=.%.timestamp) :
|
||||
@touch $@
|
||||
|
||||
$(LIBRARY): $(LIBRARY)($(OBJS) $(LOBJS)) $(LIBRARY:%.a=.%.timestamp) Makefile.in Makefile
|
||||
@touch $(LIBRARY:%.a=.%.timestamp)
|
||||
$(AR) $(AR_FLAGS) $(filter $filter(%.o, $^), $(shell echo *.o))
|
||||
$(AR_DELETE) $(LIBRARY) $(filter-out $(filter %.o, $^), \
|
||||
$(shell [ -f $(LIBRARY) ] && $(AR_LIST) $(LIBRARY)))
|
||||
@touch $@
|
||||
|
||||
else
|
||||
|
||||
$(LIBRARY): $(OBJS) $(LOBJS) Makefile Makefile.in
|
||||
rm -f $@
|
||||
ifdef SHARED_LIBRARY_LIBS
|
||||
|
@ -563,6 +597,8 @@ endif
|
|||
$(AR) $(AR_FLAGS) $(OBJS) $(LOBJS) $(SUB_LOBJS)
|
||||
$(RANLIB) $@
|
||||
@rm -f foodummyfilefoo $(SUB_LOBJS)
|
||||
|
||||
endif
|
||||
else
|
||||
ifdef OS2_IMPLIB
|
||||
$(LIBRARY): $(OBJS) $(DEF_FILE)
|
||||
|
|
|
@ -323,6 +323,7 @@ dnl ========================================================
|
|||
AR_FLAGS='cr $@'
|
||||
AR_LIST='$(AR) t'
|
||||
AR_EXTRACT='$(AR) x'
|
||||
AR_DELETE='$(AR) d'
|
||||
AS='$(CC)'
|
||||
AS_DASH_C_FLAG='-c'
|
||||
DLL_SUFFIX=so
|
||||
|
@ -627,6 +628,7 @@ case "$target" in
|
|||
AR_FLAGS='-M -a $@'
|
||||
AR_LIST='ar.elf t'
|
||||
AR_EXTRACT='ar.elf x'
|
||||
AR_DELETE='ar.elf d'
|
||||
_DEFINES_CFLAGS='-Wp,-include,$(DEPTH)/config-defs.h -DMOZILLA_CLIENT'
|
||||
_DEFINES_CXXFLAGS='-Wp,-include,$(DEPTH)/config-defs.h -DMOZILLA_CLIENT'
|
||||
_PREPROCESSOR_PREFIX="-Wp,"
|
||||
|
@ -717,6 +719,7 @@ dnl the qsort routine under solaris is faulty
|
|||
DSO_LDOPTS='-G -h $@'
|
||||
AR_LIST="$AR t"
|
||||
AR_EXTRACT="$AR x"
|
||||
AR_DELETE="$AR d"
|
||||
AR='$(CXX) -xar'
|
||||
AR_FLAGS='-o $@'
|
||||
AS='/usr/ccs/bin/as'
|
||||
|
@ -2763,6 +2766,7 @@ AC_SUBST(AR)
|
|||
AC_SUBST(AR_FLAGS)
|
||||
AC_SUBST(AR_LIST)
|
||||
AC_SUBST(AR_EXTRACT)
|
||||
AC_SUBST(AR_DELETE)
|
||||
AC_SUBST(AS)
|
||||
AC_SUBST(ASFLAGS)
|
||||
AC_SUBST(AS_DASH_C_FLAG)
|
||||
|
|
Загрузка…
Ссылка в новой задаче