Fix a makefile dependency with libraries
Using the implicit rules for libraries leads to problems if one of the objects fails to build, but the others are still OK. Just make all library rules explicit to avoid this.
This commit is contained in:
parent
6b4d6a9ade
commit
03293b60ad
4 changed files with 19 additions and 8 deletions
|
@ -109,10 +109,6 @@ $(foreach t, $(TARGETS_WITH_ROM_VARS), $(eval $(call build_elf_rule,$(t))))
|
||||||
$Q$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
$Q$(CC) $(AFLAGS) -MMD -c -o $@ $<
|
||||||
@$(FINALIZE_DEPENDENCY)
|
@$(FINALIZE_DEPENDENCY)
|
||||||
|
|
||||||
(%): %
|
|
||||||
$(call pretty,AR,$@($<))
|
|
||||||
@$(AR) $(ARFLAGS) $@ $<
|
|
||||||
|
|
||||||
# Fix the dependencies generated for a particular target .o
|
# Fix the dependencies generated for a particular target .o
|
||||||
# See http://make.paulandlesley.org/autodep.html#advanced
|
# See http://make.paulandlesley.org/autodep.html#advanced
|
||||||
define FINALIZE_DEPENDENCY
|
define FINALIZE_DEPENDENCY
|
||||||
|
|
|
@ -5,6 +5,8 @@ ALL_BOARDS = redbee-dev redbee-r1 redbee-usb redbee-econotag quahogcon freescale
|
||||||
OBJDIR = obj_$(BOARD)
|
OBJDIR = obj_$(BOARD)
|
||||||
CFLAGS += -I. -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
|
CFLAGS += -I. -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD)
|
||||||
|
|
||||||
|
OBJDIR_COBJS = $(addprefix $(OBJDIR)/, $(COBJS))
|
||||||
|
|
||||||
# Create directory and board.h include
|
# Create directory and board.h include
|
||||||
$(OBJDIR)/board.h:
|
$(OBJDIR)/board.h:
|
||||||
$(call pretty,GEN,$@)
|
$(call pretty,GEN,$@)
|
||||||
|
@ -14,10 +16,14 @@ $(OBJDIR)/board.h:
|
||||||
|
|
||||||
# $(OBJDIR)/board.a contains all the objects defined in COBJS
|
# $(OBJDIR)/board.a contains all the objects defined in COBJS
|
||||||
ifdef COBJS
|
ifdef COBJS
|
||||||
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR)/board.a($(addprefix $(OBJDIR)/, $(COBJS)))
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h $(OBJDIR_COBJS)
|
||||||
|
$(call pretty,AR,$@)
|
||||||
|
@rm -f $@
|
||||||
|
$Q$(AR) $(ARFLAGS) $@ $(OBJDIR_COBJS)
|
||||||
else
|
else
|
||||||
$(OBJDIR)/board.a: $(OBJDIR)/board.h
|
$(OBJDIR)/board.a: $(OBJDIR)/board.h
|
||||||
$(call pretty,AR (empty),$@)
|
$(call pretty,AR (empty),$@)
|
||||||
|
@rm -f $@
|
||||||
$Q$(AR) $(ARFLAGS) $@
|
$Q$(AR) $(ARFLAGS) $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,10 @@ CFLAGS += -I$(MC1322X)/lib/include
|
||||||
# By default, link all objects
|
# By default, link all objects
|
||||||
LIBOBJS ?= $(patsubst %.c,%.o,$(wildcard $(MC1322X)/lib/*.c))
|
LIBOBJS ?= $(patsubst %.c,%.o,$(wildcard $(MC1322X)/lib/*.c))
|
||||||
|
|
||||||
$(MC1322X)/lib/libmc1322x.a: $(MC1322X)/lib/libmc1322x.a($(LIBOBJS))
|
$(MC1322X)/lib/libmc1322x.a: $(LIBOBJS)
|
||||||
|
$(call pretty,AR,$@)
|
||||||
|
@rm -f $@
|
||||||
|
$Q$(AR) $(ARFLAGS) $@ $^
|
||||||
|
|
||||||
TARGET_OBJ += $(MC1322X)/lib/libmc1322x.a
|
TARGET_OBJ += $(MC1322X)/lib/libmc1322x.a
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,17 @@ SRC_OBJS += $(MC1322X)/src/default_lowlevel.o $(ISR)
|
||||||
# Two libraries, one with ROM variable space reserved, one without
|
# Two libraries, one with ROM variable space reserved, one without
|
||||||
START_ROMVARS ?= $(MC1322X)/src/start-romvars.o
|
START_ROMVARS ?= $(MC1322X)/src/start-romvars.o
|
||||||
SRCLIB_ROMVARS = $(MC1322X)/src/src-romvars.a
|
SRCLIB_ROMVARS = $(MC1322X)/src/src-romvars.a
|
||||||
$(SRCLIB_ROMVARS): $(SRCLIB_ROMVARS)($(SRC_OBJS) $(START_ROMVARS))
|
$(SRCLIB_ROMVARS): $(SRC_OBJS) $(START_ROMVARS)
|
||||||
|
$(call pretty,AR,$@)
|
||||||
|
@rm -f $@
|
||||||
|
$Q$(AR) $(ARFLAGS) $@ $^
|
||||||
|
|
||||||
START ?= $(MC1322X)/src/start.o
|
START ?= $(MC1322X)/src/start.o
|
||||||
SRCLIB = $(MC1322X)/src/src.a
|
SRCLIB = $(MC1322X)/src/src.a
|
||||||
$(SRCLIB): $(SRCLIB)($(SRC_OBJS) $(START))
|
$(SRCLIB): $(SRC_OBJS) $(START)
|
||||||
|
$(call pretty,AR,$@)
|
||||||
|
@rm -f $@
|
||||||
|
$Q$(AR) $(ARFLAGS) $@ $^
|
||||||
|
|
||||||
# ISR is built without thumb
|
# ISR is built without thumb
|
||||||
$(ISR): $(ISR:.o=.c)
|
$(ISR): $(ISR:.o=.c)
|
||||||
|
|
Loading…
Add table
Reference in a new issue