[2/2] Sort objects in gdb and gdbserver Makefiles
Commit Message
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> Tom mentioned this a while ago, as a way to give you a cheap sense of
Simon> progression in your build, as all object files will be built
Simon> alphabetically (including the directory part).
Try this for fun.
Tom
Comments
On 2018-09-16 16:08, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> Tom mentioned this a while ago, as a way to give you a cheap
> sense of
> Simon> progression in your build, as all object files will be built
> Simon> alphabetically (including the directory part).
>
> Try this for fun.
Ah, impressive! Though to be really useful, it would have to tell you
how many objects are required to be built this particular time. For
example, you touch a header file and 100 .o files need to be rebuilt, it
would show as "[X / 100]". Then you would know if you have time to get
coffee or not.
I pushed my two patches.
Thanks,
Simon
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> Ah, impressive! Though to be really useful, it would have to tell you
Simon> how many objects are required to be built this particular time.
Yeah. I couldn't think of a way to do this though.
Tom
@@ -1894,11 +1894,27 @@ libgdb.a: $(LIBGDB_OBS)
$(AR) q libgdb.a $(LIBGDB_OBS)
$(RANLIB) libgdb.a
+ALL_GDB_OBS = gdb.o $(LIBGDB_OBS)
+
+# Usage: set-object-index LIST
+# Where LIST is a list WORD1...WORDN
+# Define $(WORDN)-index to an integer and then recurse on the
+# remaining words.
+define set-object-index =
+$(if $(1),
+ $(lastword $(1))-index := $(words $(1))
+ $(call set-object-index,$(wordlist 1,$(words $(wordlist 2,100000,$(1))),$(1))))
+endef
+
+$(eval $(call set-object-index,$(ALL_GDB_OBS)))
+
+override ECHO_CXX = @echo "[$($@-index) / $(words $(ALL_GDB_OBS))] CXX $@ ";
+
# Removing the old gdb first works better if it is running, at least on SunOS.
-gdb$(EXEEXT): gdb.o $(LIBGDB_OBS) $(CDEPS) $(TDEPLIBS)
+gdb$(EXEEXT): $(ALL_GDB_OBS) $(CDEPS) $(TDEPLIBS)
$(SILENCE) rm -f gdb$(EXEEXT)
$(ECHO_CXXLD) $(CC_LD) $(INTERNAL_LDFLAGS) $(WIN32LDAPP) \
- -o gdb$(EXEEXT) gdb.o $(LIBGDB_OBS) \
+ -o gdb$(EXEEXT) $(ALL_GDB_OBS) \
$(TDEPLIBS) $(TUI_LIBRARY) $(CLIBS) $(LOADLIBES)
ifneq ($(CODESIGN_CERT),)
$(ECHO_SIGN) $(CODESIGN) -s $(CODESIGN_CERT) gdb$(EXEEXT)