Skip to content

Commit

Permalink
Makefile.base: fix AR keeping removed source files objects
Browse files Browse the repository at this point in the history
AR incrementally adds file without removing files.
If a c file is deleted or disabled(submodule removal) it is not removed from
archive and still ends up in the final elf file.

This fix removes the need to do 'make clean' for this case.

However it will break cases where an APPLICATION and a MODULE or two modules
have the same name and only worked because source files names where different.
  • Loading branch information
cladmi committed Mar 14, 2018
1 parent b378bd4 commit 7c85e6e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ $(BINDIR)/$(MODULE)/:
$(BINDIR)/$(MODULE).a $(OBJ): | $(BINDIR)/$(MODULE)/

$(BINDIR)/$(MODULE).a: $(OBJ) | ${DIRS:%=ALL--%}
$(Q)$(AR) $(ARFLAGS) $@ $?
@# Recreate archive to cleanup deleted/non selected source files objects
$(Q)$(RM) $@
$(Q)$(AR) $(ARFLAGS) $@ $^

CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
CCASFLAGS = $(filter-out $(CCASUWFLAGS), $(CFLAGS)) $(CCASEXFLAGS)
Expand Down

0 comments on commit 7c85e6e

Please sign in to comment.