Skip to contentSkip to conversation

Perf: Fix Makefile to clean all object files

PATCH Superseded chenggang 2 participants 2 messages Mar 14, 2013 perf events

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

chenggang

author
#0 lore raw

PATCH v3 1/1 Perf: Fix Makefile to clean all object files

From: Chenggang Qin <[email protected]>

If we execute "make clean" in perf's directory, many object files cannot be cleaned in the current version.
For example:
While we run "make clean" in perf's directory, and run the command:
"fine ./ -name "*.o""
we will get:
------------------------------------
./arch/x86/util/unwind.o
./arch/x86/util/header.o
./arch/x86/util/dwarf-regs.o ./util/scripting-engines/trace-event-python.o ./util/scripting-engines/trace-event-perl.o ./util/probe-finder.o
./util/dwarf-aux.o
./util/unwind.o
... ...
------------------------------------
These ".o" files are not cleaned.

The reason is:
These object files are added into "BUILTIN_OBJS" while "make" process check the environment. If the make command is "clean", the environment check process is not executed. So, these object files will not be added into "BUILTIN_OBJS" while we execute "make clean".

This patch fixed this problem.
We only add a command:
"find . -name "*.o" -exec rm -f {} \;"

Cc David Ahern <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Yanmin Zhang <[email protected]>
Cc Wu Fengguang <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Andrew Morton <[email protected]>
---
 tools/perf/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/Makefile +1 -0
index a2108ca..dec08ba 100644
@@ -1174,6 +1174,7 @@ clean: $(LIBTRACEEVENT)-clean
 	$(RM) $(OUTPUT)util/*-bison*
 	$(RM) $(OUTPUT)util/*-flex*
 	$(python-clean)
+	$(FIND) . -name "*.o" -exec rm -f {} \;
 
 .PHONY: all install clean strip $(LIBTRACEEVENT)
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell
Signature · 1 line
1.7.8.rc2.5.g815b
maintainer
#1 lore raw

Hi again,

Quoted 21 lines · chenggang

From: Chenggang Qin <[email protected]>

If we execute "make clean" in perf's directory, many object files cannot be cleaned in the current version.
For example:
While we run "make clean" in perf's directory, and run the command:
"fine ./ -name "*.o""
we will get:
------------------------------------
./arch/x86/util/unwind.o
./arch/x86/util/header.o
./arch/x86/util/dwarf-regs.o ./util/scripting-engines/trace-event-python.o ./util/scripting-engines/trace-event-perl.o ./util/probe-finder.o
./util/dwarf-aux.o
./util/unwind.o
... ...
------------------------------------
These ".o" files are not cleaned.

Quoted 4 lines

The reason is:
These object files are added into "BUILTIN_OBJS" while "make" process check the environment. If the make command is "clean", the environment check process is not executed. So, these object files will not be added into "BUILTIN_OBJS" while we execute "make clean".

s/BUILTIN/LIB/g

Quoted 4 lines

This patch fixed this problem.
We only add a command:
"find . -name "*.o" -exec rm -f {} \;"

I think the path should be $(OUTPUT) rather than ".". How about this?

  find $(OUTPUT) -name "*.o" -delete

Thanks,
Namhyung

Quoted 30 lines
Cc David Ahern <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
Cc Arjan van de Ven <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Yanmin Zhang <[email protected]>
Cc Wu Fengguang <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Andrew Morton <[email protected]>
---
 tools/perf/Makefile |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
tools/perf/Makefile +1 -0
index a2108ca..dec08ba 100644
@@ -1174,6 +1174,7 @@ clean: $(LIBTRACEEVENT)-clean
 	$(RM) $(OUTPUT)util/*-bison*
 	$(RM) $(OUTPUT)util/*-flex*
 	$(python-clean)
+	$(FIND) . -name "*.o" -exec rm -f {} \;
 
 .PHONY: all install clean strip $(LIBTRACEEVENT)
 .PHONY: shell_compatibility_test please_set_SHELL_PATH_to_a_more_modern_shell