From 1cdb68d116a4498e5acb28cf518142bdf05afdc6 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 18 Apr 2005 13:55:57 +0000 Subject: "make xxx DEBUG=yyy,zzz" now working, but the "up to date" message is getting suppressed. :( --- src/Makefile.housekeeping | 54 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src/Makefile.housekeeping') diff --git a/src/Makefile.housekeeping b/src/Makefile.housekeeping index dd4bd084..9c8f28bd 100644 --- a/src/Makefile.housekeeping +++ b/src/Makefile.housekeeping @@ -158,13 +158,6 @@ $(BIN)/NIC : $(AUTO_DEPS) @perl -ne 'chomp; print "$$1\n" if /\# NIC\t(.*)$$/' $^ >> $@ CLEANUP += $(BIN)/NIC -# Library of all objects -# -$(BLIB) : $(BOBJS) - $(AR) r $@ $(BOBJS) - $(RANLIB) $@ -blib : $(BLIB) - # Analyse a target name (e.g. "bin/dfe538--prism2_pci.zrom.tmp") and # derive the variables: # @@ -232,10 +225,9 @@ TGT_MAKEROM_FLAGS = $(strip $(MAKEROM_FLAGS_$(TGT_ROM_NAME)) \ # the target. # COMMA := , -DEBUG_OBJECTS = $(foreach D,$(subst $(COMMA), ,$(DEBUG)),$(BIN)/$(D).dbg.o) -$(foreach OBJ,$(filter-out $(dbg.o_OBJS),$(DEBUG_OBJECTS)), \ - $(error $(OBJ) is not a valid debug object) \ -) +DEBUG_OBJS = $(foreach D,$(subst $(COMMA), ,$(DEBUG)),$(BIN)/$(D).dbg.o) +DEBUG_REPLACE_OBJS = $(foreach D,$(subst $(COMMA), ,$(DEBUG)),$(BIN)/$(D).o) +BLIB_OBJS = $(DEBUG_OBJS) $(filter-out $(DEBUG_ORIG_OBJS),$(BOBJS)) # Print out all derived information for a given target. # @@ -258,25 +250,33 @@ $(BIN)/%.info : @echo @echo 'makerom target flags : $(TGT_MAKEROM_FLAGS)' @echo - @echo 'Debugging objects : $(DEBUG_OBJECTS)' + @echo 'Debugging objects : $(DEBUG_OBJS)' + @echo 'Replaced objects : $(DEBUG_REPLACE_OBJS)' + +# List of objects included in the last build of blib. This is needed +# in order to correctly rebuild blib whenever the list of objects +# changes. +# +BLIB_LIST = $(BIN)/.blib.list +.PHONY : always_check_blib_list +$(BLIB_LIST) : always_check_blib_list + @[ "$(shell cat $@)" = "$(BLIB_OBJS)" ] || echo "$(BLIB_OBJS)" > $@ +.SECONDARY : $(BLIB_LIST) + +# Library of all objects +# +BLIB = $(BIN)/blib.a +$(BLIB) : $(BLIB_OBJS) $(BLIB_LIST) $(MAKEDEPS) + $(AR) r $@ $(BLIB_OBJS) + $(RANLIB) $@ +blib : $(BLIB) # Build an intermediate object file from the objects required for the # specified target. -# -# If it's a debugging version, force a link to take place by making -# this target depend on a phony target, and mark the resulting files -# as being older than BLIB (and prevent them from being deleted), so -# that any subsequent images will do a fresh link. Otherwise, you -# won't get what you expect when you do e.g. "make DEBUG=pci -# bin/pnic.dsk ; make bin/pnic.dsk ; make DEBUG=pci bin/pnic.dsk" -# -$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT) \ - $(DEBUG_OBJECTS) $(if $(DEBUG),force_relink) - $(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) \ - $(DEBUG_OBJECTS) $(BLIB) -o $@ -Map $(BIN)/$*.tmp.map - $(if $(DEBUG_OBJECTS),$(TOUCH) -r $(BLIB) -B 2 $@ $(BIN)/$*.tmp.map) -.PHONY : force_relink -.SECONDARY : +# +$(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT) + $(LD) $(LDFLAGS) -T $(LDSCRIPT) $(TGT_LD_FLAGS) $(BLIB) -o $@ \ + -Map $(BIN)/$*.tmp.map # Show a linker map for the specified target # -- cgit v1.2.3-55-g7522