build: fix 'clean' target
authorDiego Biurrun <diego@biurrun.de>
Thu, 3 Jan 2013 14:30:22 +0000 (15:30 +0100)
committerDiego Biurrun <diego@biurrun.de>
Thu, 3 Jan 2013 14:30:45 +0000 (15:30 +0100)
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 <diego@biurrun.de>
Makefile
common.mak
library.mak

index ff871c4..96e3a87 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -172,7 +172,6 @@ uninstall-data:
 clean::
        $(RM) $(ALLPROGS)
        $(RM) $(CLEANSUFFIXES)
-       $(RM) $(TOOLS)
        $(RM) $(CLEANSUFFIXES:%=tools/%)
 
 distclean::
index d781ced..9193455 100644 (file)
@@ -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))
index f50e8e5..8dde8f4 100644 (file)
@@ -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)%) \