Skip to contentSkip to conversation

tools lib traceevent: Do not generate dependency for system header files

PATCH RESEND In review Namhyung Kim 4 participants 12 messages Oct 26, 2012 perf events

lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH RESEND 1/5 tools lib traceevent: Do not generate dependency for system header files

Ingo reported (again!) that 'make clean' on perf/traceevent does not work due to some reason with system header file. Quotes Ingo:

"Note that the old dependency related build failure thought to be
fixed in commit 860df5833e46 is back:

make[1]: *** No rule to make target /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h', needed by .trace-seq.d'. Stop.

'make clean' itself does not work in libtraceevent:

comet:~/tip/tools/lib/traceevent> make clean
make: *** No rule to make target /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h', needed by .trace-seq.d'. Stop.

So I had to clean it out manually:

   comet:~/tip/tools/lib/traceevent> git ls-files --others | xargs rm
   comet:~/tip/tools/lib/traceevent>

and then things build fine."

Try to fix it by excluding system headers from dependency generation.

---
 tools/lib/traceevent/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/traceevent/Makefile +1 -1
index 04d959fa0226..a20e32033431 100644
@@ -253,7 +253,7 @@ all_deps := $(all_objs:%.o=.%.d)
 # let .d file also depends on the source and header files
 define check_deps
 		@set -e; $(RM) $@; \
-		$(CC) -M $(CFLAGS) $< > $@.$$$$; \
+		$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
 		sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
 		$(RM) $@.$$$$
 endef
Signature · 1 line
1.7.11.7
author maintainer
#1 lore raw

PATCH 2/5 perf tools: Cleanup doc related targets

From: Namhyung Kim <[email protected]>

Documentation targets handling rules are duplicate. Consolidate them with DOC_TARGETS and INSTALL_DOC_TARGETS.

Cc Borislav Petkov <[email protected]>
---
 tools/perf/Makefile | 46 +++++++++-------------------------------------
 1 file changed, 9 insertions(+), 37 deletions(-)
tools/perf/Makefile +9 -37
index b14eeb86d8d7..5cf40cbdaaf9 100644
@@ -977,20 +977,15 @@ help:
 	@echo 'Perf maintainer targets:'
 	@echo '  clean			- clean all binary objects and build output'
 
-doc:
-	$(MAKE) -C Documentation all
 
-man:
-	$(MAKE) -C Documentation man
+DOC_TARGETS := doc man html info pdf
 
-html:
-	$(MAKE) -C Documentation html
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
 
-info:
-	$(MAKE) -C Documentation info
-
-pdf:
-	$(MAKE) -C Documentation pdf
+# 'make doc' should call 'make -C Documentation all'
+$(DOC_TARGETS):
+	$(MAKE) -C Documentation $(@:doc=all)
 
 TAGS:
 	$(RM) TAGS
@@ -1061,32 +1056,9 @@ install: all try-install-man
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
 
-install-doc:
-	$(MAKE) -C Documentation install
-
-install-man:
-	$(MAKE) -C Documentation install-man
-
-try-install-man:
-	$(MAKE) -C Documentation try-install-man
-
-install-html:
-	$(MAKE) -C Documentation install-html
-
-install-info:
-	$(MAKE) -C Documentation install-info
-
-install-pdf:
-	$(MAKE) -C Documentation install-pdf
-
-quick-install-doc:
-	$(MAKE) -C Documentation quick-install
-
-quick-install-man:
-	$(MAKE) -C Documentation quick-install-man
-
-quick-install-html:
-	$(MAKE) -C Documentation quick-install-html
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+	$(MAKE) -C Documentation $(@:-doc=)
 
 ### Cleaning rules
 
Signature · 1 line
1.7.11.7
#2 lore raw

[tip:perf/core] perf tools: Cleanup doc related targets

Commit-ID:  536e2b0fc2af42a464ea6eb6b67a2c754e14f2e2
Gitweb:     http://git.kernel.org/tip/536e2b0fc2af42a464ea6eb6b67a2c754e14f2e2
Author:     Namhyung Kim <[email protected]>
AuthorDate: Fri, 26 Oct 2012 17:55:49 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 26 Oct 2012 11:22:24 -0200

perf tools: Cleanup doc related targets

Documentation targets handling rules are duplicate. Consolidate them with DOC_TARGETS and INSTALL_DOC_TARGETS.

---
 tools/perf/Makefile |   46 +++++++++-------------------------------------
 1 files changed, 9 insertions(+), 37 deletions(-)
tools/perf/Makefile +9 -37
index b14eeb8..5cf40cb 100644
@@ -977,20 +977,15 @@ help:
 	@echo 'Perf maintainer targets:'
 	@echo '  clean			- clean all binary objects and build output'
 
-doc:
-	$(MAKE) -C Documentation all
 
-man:
-	$(MAKE) -C Documentation man
+DOC_TARGETS := doc man html info pdf
 
-html:
-	$(MAKE) -C Documentation html
+INSTALL_DOC_TARGETS := $(patsubst %,install-%,$(DOC_TARGETS)) try-install-man
+INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
 
-info:
-	$(MAKE) -C Documentation info
-
-pdf:
-	$(MAKE) -C Documentation pdf
+# 'make doc' should call 'make -C Documentation all'
+$(DOC_TARGETS):
+	$(MAKE) -C Documentation $(@:doc=all)
 
 TAGS:
 	$(RM) TAGS
@@ -1061,32 +1056,9 @@ install: all try-install-man
 install-python_ext:
 	$(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
 
-install-doc:
-	$(MAKE) -C Documentation install
-
-install-man:
-	$(MAKE) -C Documentation install-man
-
-try-install-man:
-	$(MAKE) -C Documentation try-install-man
-
-install-html:
-	$(MAKE) -C Documentation install-html
-
-install-info:
-	$(MAKE) -C Documentation install-info
-
-install-pdf:
-	$(MAKE) -C Documentation install-pdf
-
-quick-install-doc:
-	$(MAKE) -C Documentation quick-install
-
-quick-install-man:
-	$(MAKE) -C Documentation quick-install-man
-
-quick-install-html:
-	$(MAKE) -C Documentation quick-install-html
+# 'make install-doc' should call 'make -C Documentation install'
+$(INSTALL_DOC_TARGETS):
+	$(MAKE) -C Documentation $(@:-doc=)
 
 ### Cleaning rules
 
author maintainer
#3 lore raw

PATCH 3/5 perf tools: Convert invocation of MAKE into SUBDIR

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

This will show directory change info in a consistent form. Also it can be converted again into David Howell's descend command.

Cc Borislav Petkov <[email protected]>
Cc David Howells <[email protected]>
---
 tools/perf/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Makefile +3 -3
index 5cf40cbdaaf9..2d0c09ab58b8 100644
@@ -985,7 +985,7 @@ INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
 
 # 'make doc' should call 'make -C Documentation all'
 $(DOC_TARGETS):
-	$(MAKE) -C Documentation $(@:doc=all)
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
 
 TAGS:
 	$(RM) TAGS
@@ -1058,7 +1058,7 @@ install-python_ext:
 
 # 'make install-doc' should call 'make -C Documentation install'
 $(INSTALL_DOC_TARGETS):
-	$(MAKE) -C Documentation $(@:-doc=)
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
 
 ### Cleaning rules
 
@@ -1066,7 +1066,7 @@ clean: $(LIBTRACEEVENT)-clean
 	$(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
 	$(RM) $(ALL_PROGRAMS) perf
 	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
-	$(MAKE) -C Documentation/ clean
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
 	$(RM) $(OUTPUT)util/*-bison*
 	$(RM) $(OUTPUT)util/*-flex*
Signature · 1 line
1.7.11.7
#4 lore raw

[tip:perf/core] perf tools: Convert invocation of MAKE into SUBDIR

Commit-ID:  615d774d69031357a1bfed57fd383c6fe6f90a69
Gitweb:     http://git.kernel.org/tip/615d774d69031357a1bfed57fd383c6fe6f90a69
Author:     Namhyung Kim <[email protected]>
AuthorDate: Fri, 26 Oct 2012 17:55:50 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 26 Oct 2012 11:22:24 -0200

perf tools: Convert invocation of MAKE into SUBDIR

This will show directory change info in a consistent form. Also it can be converted again into David Howell's descend command.

---
 tools/perf/Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
tools/perf/Makefile +3 -3
index 5cf40cb..2d0c09a 100644
@@ -985,7 +985,7 @@ INSTALL_DOC_TARGETS += quick-install-doc quick-install-man quick-install-html
 
 # 'make doc' should call 'make -C Documentation all'
 $(DOC_TARGETS):
-	$(MAKE) -C Documentation $(@:doc=all)
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:doc=all)
 
 TAGS:
 	$(RM) TAGS
@@ -1058,7 +1058,7 @@ install-python_ext:
 
 # 'make install-doc' should call 'make -C Documentation install'
 $(INSTALL_DOC_TARGETS):
-	$(MAKE) -C Documentation $(@:-doc=)
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) $(@:-doc=)
 
 ### Cleaning rules
 
@@ -1066,7 +1066,7 @@ clean: $(LIBTRACEEVENT)-clean
 	$(RM) $(LIB_OBJS) $(BUILTIN_OBJS) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf.o $(LANG_BINDINGS)
 	$(RM) $(ALL_PROGRAMS) perf
 	$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
-	$(MAKE) -C Documentation/ clean
+	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
 	$(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
 	$(RM) $(OUTPUT)util/*-bison*
 	$(RM) $(OUTPUT)util/*-flex*
author maintainer
#5 lore raw

PATCH 4/5 perf tools: Always show CHK message when doing try-cc

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

It might be useful to see what's happening behind us rather than just waiting few seconds during the config checking.

Also align the CHK message with other ones.

Cc Jiri Olsa <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 tools/perf/config/utilities.mak | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/perf/config/utilities.mak +1 -2
index ea853c279b31..e5413125e6bb 100644
@@ -183,9 +183,8 @@ _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
 # Usage: option = $(call try-cc, source-to-build, cc-options, msg)
 ifndef V
 TRY_CC_OUTPUT= > /dev/null 2>&1
-else
-TRY_CC_MSG=echo "CHK $(3)" 1>&2;
 endif
+TRY_CC_MSG=echo "    CHK $(3)" 1>&2;
 
 try-cc = $(shell sh -c						  \
 	'TMP="$(OUTPUT)$(TMPOUT).$$$$";				  \
Signature · 1 line
1.7.11.7
#6 lore raw

Re: [PATCH 4/5] perf tools: Always show CHK message when doing try-cc

Em Fri, Oct 26, 2012 at 05:55:51PM +0900, Namhyung Kim escreveu:

Quoted 4 lines

From: Namhyung Kim <[email protected]>

It might be useful to see what's happening behind us rather than just waiting few seconds during the config checking.

Which shows that we're calling it even for Documentation! :-\ Would be good to have just one set of feature checks made...

- Arnaldo

#7 lore raw

Re: [PATCH 4/5] perf tools: Always show CHK message when doing try-cc

In reply to Namhyung Kim
Quoted 4 lines · Namhyung Kim

From: Namhyung Kim <[email protected]>

It might be useful to see what's happening behind us rather than just waiting few seconds during the config checking.

Do we want to see all that within just simple 'make' also in case nothing gets rebuilt? It seems noisy..

[jolsa@krava perf]$ make
CHK -fstack-protector-all
CHK -Wstack-protector
CHK -Wvolatile-register-var
CHK bionic
CHK libelf
CHK libdw
CHK libunwind
CHK -DLIBELF_MMAP
CHK libaudit
CHK libnewt
CHK gtk2
Makefile:608: GTK2 not found, disables GTK2 support. Please install gtk2-devel or libgtk2.0-dev
CHK perl
CHK python
CHK python version
CHK libbfd
CHK -DHAVE_STRLCPY
CHK -DHAVE_ON_EXIT
CHK -DBACKTRACE_SUPPORT
SUBDIR ../lib/traceevent/
LINK perf

hum, also not sure why's there ^^^ the final LINK for no change rebuild..

jirka

#8 lore raw

[tip:perf/core] perf tools: Always show CHK message when doing try-cc

In reply to Namhyung Kim
Commit-ID:  cf3aa103555136c04894058152b129c133ebf350
Gitweb:     http://git.kernel.org/tip/cf3aa103555136c04894058152b129c133ebf350
Author:     Namhyung Kim <[email protected]>
AuthorDate: Fri, 26 Oct 2012 17:55:51 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 26 Oct 2012 11:22:24 -0200

perf tools: Always show CHK message when doing try-cc

It might be useful to see what's happening behind us rather than just waiting few seconds during the config checking.

Also align the CHK message with other ones.

---
 tools/perf/config/utilities.mak |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
tools/perf/config/utilities.mak +1 -2
index ea853c2..e541312 100644
@@ -183,9 +183,8 @@ _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
 # Usage: option = $(call try-cc, source-to-build, cc-options, msg)
 ifndef V
 TRY_CC_OUTPUT= > /dev/null 2>&1
-else
-TRY_CC_MSG=echo "CHK $(3)" 1>&2;
 endif
+TRY_CC_MSG=echo "    CHK $(3)" 1>&2;
 
 try-cc = $(shell sh -c						  \
 	'TMP="$(OUTPUT)$(TMPOUT).$$$$";				  \
author maintainer
#9 lore raw

PATCH 5/5 perf tools: Fix LIBELF_MMAP checking

In reply to Namhyung Kim

From: Namhyung Kim <[email protected]>

Currently checking mmap support in libelf failed due to wrong flags.

CHK libelf
CHK libdw
CHK libunwind
CHK -DLIBELF_MMAP
/tmp/ccYJwdR0.o: In function `main':
:(.text+0x18): undefined reference to `elf_begin'
collect2: error: ld returned 1 exit status

This cannot happen since we checked the elf_begin() when checking libelf and it succeeded.

Fix it by using a same flag with libelf checking.

Cc Jiri Olsa <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 tools/perf/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/Makefile +2 -1
index 2d0c09ab58b8..629fc6a4b0df 100644
@@ -541,7 +541,8 @@ LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 else # NO_LIBELF
 BASIC_CFLAGS += -DLIBELF_SUPPORT
 
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON),-DLIBELF_MMAP),y)
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	BASIC_CFLAGS += -DLIBELF_MMAP
 endif
 
Signature · 1 line
1.7.11.7
#10 lore raw

[tip:perf/core] perf tools: Fix LIBELF_MMAP checking

Commit-ID:  fcc328032e7382bf413517ee4dddf1eca7970fe4
Gitweb:     http://git.kernel.org/tip/fcc328032e7382bf413517ee4dddf1eca7970fe4
Author:     Namhyung Kim <[email protected]>
AuthorDate: Fri, 26 Oct 2012 17:55:52 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 26 Oct 2012 11:22:24 -0200

perf tools: Fix LIBELF_MMAP checking

Currently checking mmap support in libelf failed due to wrong flags.

CHK libelf
CHK libdw
CHK libunwind
CHK -DLIBELF_MMAP
/tmp/ccYJwdR0.o: In function `main':
:(.text+0x18): undefined reference to `elf_begin'
collect2: error: ld returned 1 exit status

This cannot happen since we checked the elf_begin() when checking libelf and it succeeded.

Fix it by using a same flag with libelf checking.

---
 tools/perf/Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
tools/perf/Makefile +2 -1
index 2d0c09a..629fc6a 100644
@@ -541,7 +541,8 @@ LIB_OBJS += $(OUTPUT)util/symbol-minimal.o
 else # NO_LIBELF
 BASIC_CFLAGS += -DLIBELF_SUPPORT
 
-ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_COMMON),-DLIBELF_MMAP),y)
+FLAGS_LIBELF=$(ALL_CFLAGS) $(ALL_LDFLAGS) $(EXTLIBS)
+ifeq ($(call try-cc,$(SOURCE_ELF_MMAP),$(FLAGS_LIBELF),-DLIBELF_MMAP),y)
 	BASIC_CFLAGS += -DLIBELF_MMAP
 endif
 
author maintainer
#11 lore raw
In reply to Namhyung Kim
Commit-ID:  b6f4f804108bd563070ab95199cbddcf7650cbf4
Gitweb:     http://git.kernel.org/tip/b6f4f804108bd563070ab95199cbddcf7650cbf4
Author:     Namhyung Kim <[email protected]>
AuthorDate: Fri, 26 Oct 2012 17:55:48 +0900
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Fri, 26 Oct 2012 11:22:23 -0200

tools lib traceevent: Do not generate dependency for system header files

Ingo reported (again!) that 'make clean' on perf/traceevent does not work due to some reason with system header file. Quotes Ingo:

"Note that the old dependency related build failure thought to be
fixed in commit 860df5833e46 is back:

make[1]: *** No rule to make target /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h', needed by .trace-seq.d'. Stop.

'make clean' itself does not work in libtraceevent:

comet:~/tip/tools/lib/traceevent> make clean
make: *** No rule to make target /usr/lib/gcc/x86_64-redhat-linux/4.7.0/include/stddef.h', needed by .trace-seq.d'. Stop.

So I had to clean it out manually:

   comet:~/tip/tools/lib/traceevent> git ls-files --others | xargs rm
   comet:~/tip/tools/lib/traceevent>

and then things build fine."

Try to fix it by excluding system headers from dependency generation.

---
 tools/lib/traceevent/Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
tools/lib/traceevent/Makefile +1 -1
index 04d959f..a20e320 100644
@@ -253,7 +253,7 @@ all_deps := $(all_objs:%.o=.%.d)
 # let .d file also depends on the source and header files
 define check_deps
 		@set -e; $(RM) $@; \
-		$(CC) -M $(CFLAGS) $< > $@.$$$$; \
+		$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
 		sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
 		$(RM) $@.$$$$
 endef