diff --git a/Makefile.include b/Makefile.include index 6094e89a4..4767d4a04 100644 --- a/Makefile.include +++ b/Makefile.include @@ -109,10 +109,6 @@ $(foreach t, $(TARGETS_WITH_ROM_VARS), $(eval $(call build_elf_rule,$(t)))) $Q$(CC) $(AFLAGS) -MMD -c -o $@ $< @$(FINALIZE_DEPENDENCY) -(%): % - $(call pretty,AR,$@($<)) - @$(AR) $(ARFLAGS) $@ $< - # Fix the dependencies generated for a particular target .o # See http://make.paulandlesley.org/autodep.html#advanced define FINALIZE_DEPENDENCY diff --git a/board/Makefile.board b/board/Makefile.board index 9c747813c..c5114a678 100644 --- a/board/Makefile.board +++ b/board/Makefile.board @@ -5,6 +5,8 @@ ALL_BOARDS = redbee-dev redbee-r1 redbee-usb redbee-econotag quahogcon freescale OBJDIR = obj_$(BOARD) CFLAGS += -I. -I$(OBJDIR) -I$(MC1322X)/board -DBOARD=$(BOARD) +OBJDIR_COBJS = $(addprefix $(OBJDIR)/, $(COBJS)) + # Create directory and board.h include $(OBJDIR)/board.h: $(call pretty,GEN,$@) @@ -14,10 +16,14 @@ $(OBJDIR)/board.h: # $(OBJDIR)/board.a contains all the objects defined in 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 $(OBJDIR)/board.a: $(OBJDIR)/board.h $(call pretty,AR (empty),$@) + @rm -f $@ $Q$(AR) $(ARFLAGS) $@ endif diff --git a/lib/Makefile.lib b/lib/Makefile.lib index bcba895ea..276ca0c58 100644 --- a/lib/Makefile.lib +++ b/lib/Makefile.lib @@ -5,7 +5,10 @@ CFLAGS += -I$(MC1322X)/lib/include # By default, link all objects 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 diff --git a/src/Makefile.src b/src/Makefile.src index 573dd0e38..258620ac8 100644 --- a/src/Makefile.src +++ b/src/Makefile.src @@ -8,11 +8,17 @@ SRC_OBJS += $(MC1322X)/src/default_lowlevel.o $(ISR) # Two libraries, one with ROM variable space reserved, one without START_ROMVARS ?= $(MC1322X)/src/start-romvars.o 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 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): $(ISR:.o=.c)