[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #14927] Fix for building archive members in parallel

From: Alon Blayer-Gat
Subject: [bug #14927] Fix for building archive members in parallel
Date: Mon, 25 Dec 2006 23:03:18 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061204 Firefox/

Follow-up Comment #3, bug #14927 (project make):

Following is a way to add objects in parallel with 3.80/81
The main idea -
*- depend files are used as sentinels of the object files
*- object files which do not have depend files are extracted from the library
with their original modification date.
#FILES - a given list of source files no extension (e.g. .cc)
#L - The Archive
#DEP_FILES - depend files
#*_BASE - directories

DEP_FILES = $(patsubst %,$(DEP_BASE)/%.d,$(FILES))
vpath %.d $(DEP_BASE)

#make a list of existing depend files
existing_depend_files=$(if $(wildcard $L), \
$(foreach dep_file,$(FILES),$(wildcard $(DEP_BASE)/$(dep_file).d)),)

#make a list of non-existing depend files
non_existing_depend_files=$(filter-out $(existing_depend_files), \
$(patsubst %,$(DEP_BASE)/%.d,$(FILES)))

#If depend file does not exist then first try to take out object with
original modification time
#Then just create the depend file
define make_nonexisting_depend
$(if $(wildcard $L),cd $(@D);$(AR) -xvo $(L) $*.o,)
$(DEPEND.cc) $< -MT '$1 $(OBJ_BASE)/$*.o' -MP -MF $1

$(non_existing_depend_files): $(DEP_BASE)/%.d: %.cc
        $(call make_nonexisting_depend,$@)
#If depend file exists compile as well.
define make_existing_depend
$(COMPILE.cc) $< -MM -MT '$1 $(OBJ_BASE)/$*.o' -MP -MF $1 -o

$(existing_depend_files): $(DEP_BASE)/%.d: %.cc
        $(call make_existing_depend,$@)

include $(patsubst %,$(DEP_BASE)/%.d,$(FILES))

#Library is made of:
#object files created by the existing depend files target
#object files from the non existing depend files list created by the object
target itself
#If all object were updated remove library first
$L: $(existing_depend_files) $(patsubst
        $(if $(filter-out $?,$^),@$(RM) $@; echo $@ was removed,)
        $(AR) $(ARFLAGS) $@ $(patsubst %.d,%.o,$(filter %.d,$?)) $(filter
        $(RM) $(OBJ_BASE)/*.o
$(OBJ_FILES): $(OBJ_BASE)/%.o: %.cc                                          
        $(COMPILE.cc) $< -o $@



Reply to this item at:


  Message sent via/by Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]