From 26b177b8f7abb2058fdd3a9142e26f118eaad294 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 3 Jan 2013 15:30:22 +0100 Subject: [PATCH] build: fix 'clean' target This fixes removal of TOOLS as well as HOSTPROGS declared in the top-level Makefile. The clean target in common.mak needs to be eval'd since the variables used within are reset for each library. (cherry picked from commit 395c3feb3bb165af5760d287a9a64344b6269fe2) Conflicts: common.mak library.mak Signed-off-by: Diego Biurrun --- Makefile | 1 - common.mak | 9 +++++++++ library.mak | 3 +-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index ff871c4373..96e3a874bf 100644 --- a/Makefile +++ b/Makefile @@ -172,7 +172,6 @@ uninstall-data: clean:: $(RM) $(ALLPROGS) $(RM) $(CLEANSUFFIXES) - $(RM) $(TOOLS) $(RM) $(CLEANSUFFIXES:%=tools/%) distclean:: diff --git a/common.mak b/common.mak index d781ced09e..9193455c56 100644 --- a/common.mak +++ b/common.mak @@ -49,4 +49,13 @@ CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver DISTCLEANSUFFIXES = *.pc LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp +define RULES +clean:: + $(RM) $(OBJS) $(OBJS:.o=.d) + $(RM) $(HOSTPROGS) + $(RM) $(TOOLS) +endef + +$(eval $(RULES)) + -include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d)) diff --git a/library.mak b/library.mak index f50e8e59ee..8dde8f47da 100644 --- a/library.mak +++ b/library.mak @@ -47,8 +47,7 @@ $(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) $(SUBDIR)lib$(NAME).ver $(DEP_LIBS) clean:: $(RM) $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \ - $(foreach dir,$(DIRS),$(CLEANSUFFIXES:%=$(SUBDIR)$(dir)/%)) \ - $(HOSTOBJS) $(HOSTPROGS) + $(foreach dir,$(DIRS),$(CLEANSUFFIXES:%=$(SUBDIR)$(dir)/%)) distclean:: clean $(RM) $(DISTCLEANSUFFIXES:%=$(SUBDIR)%) \