Skip to content

Commit

Permalink
Makefile.base: cleanup non selected source object files
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrolanzieri committed Oct 5, 2021
1 parent 96eb2c5 commit 5bcd138
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Makefile.base
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,16 @@ include $(RIOTMAKE)/tools/fixdep.inc.mk
$(BINDIR)/$(MODULE)/:
$(Q)mkdir -p $@

OLD_OBJECTS = $(wildcard $(BINDIR)/$(MODULE)/*.o)
OBJECTS_TO_REMOVE = $(filter-out $(OBJ),$(OLD_OBJECTS))

$(MODULE).module compile-commands $(OBJ): | $(BINDIR)/$(MODULE)/

$(MODULE).module: $(OBJ) | $(DIRS:%=ALL--%)
$(MODULE).module: $(OBJ) $(if $(OBJECTS_TO_REMOVE),$(MODULE).cleanup) | $(DIRS:%=ALL--%)

$(MODULE).cleanup:
$(Q)# cleanup non selected source files objects
$(Q)$(RM) $(OBJECTS_TO_REMOVE)

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

0 comments on commit 5bcd138

Please sign in to comment.