diff --git a/Makefile.base b/Makefile.base index 5174119c09..6f6984153f 100644 --- a/Makefile.base +++ b/Makefile.base @@ -67,10 +67,12 @@ $(BINDIR)/$(MODULE)/: $(BINDIR)/$(MODULE).a $(OBJ): | $(BINDIR)/$(MODULE)/ +relpath = $(shell realpath --relative-to=$(abspath .) $(1)) + $(BINDIR)/$(MODULE).a: $(OBJ) | $(DIRS:%=ALL--%) @# Recreate archive to cleanup deleted/non selected source files objects $(Q)$(RM) $@ - $(Q)$(AR) $(ARFLAGS) $@ $^ + $(Q)$(AR) $(ARFLAGS) $(foreach f,$@ $^,$(call relpath,$f)) CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS) CCASFLAGS = $(filter-out $(CCASUWFLAGS), $(CFLAGS)) $(CCASEXFLAGS) diff --git a/makefiles/cflags.inc.mk b/makefiles/cflags.inc.mk index 4f1b163963..2f7cf22e95 100644 --- a/makefiles/cflags.inc.mk +++ b/makefiles/cflags.inc.mk @@ -65,5 +65,5 @@ CFLAGS += $(filter-out $(OPTIONAL_CFLAGS_BLACKLIST),$(OPTIONAL_CFLAGS)) # Default ARFLAGS for platforms which do not specify it. # Note: make by default provides ARFLAGS=rv which we want to override ifeq ($(origin ARFLAGS),default) - ARFLAGS = rcs + ARFLAGS = rcTs endif