Skip to contentSkip to conversation

perf, tool: Fix parsers' rules to dependencies

PATCH In review Jiri Olsa 3 participants 5 messages Apr 11, 2012 – Apr 15, 2012 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

PATCH 1/1 perf, tool: Fix parsers' rules to dependencies

Currently the parsers objects (bison/flex related) are each time perf is built. No matter the generated files are already in place, the parser generation is executed every time.

Changing the rules to have proper flex/bison objects generation dependencies.

The parsers code is not rebuilt until the flex/bison source files are touched. Also when flex/bison source is changed, only dependent objects are rebuilt.

---
 tools/perf/Makefile |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
tools/perf/Makefile +8 -11
index 820371f..733336c 100644
@@ -237,21 +237,20 @@ export PERL_PATH
 FLEX = $(CROSS_COMPILE)flex
 BISON= $(CROSS_COMPILE)bison
 
-event-parser:
-	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
 
-$(OUTPUT)util/parse-events-flex.c: event-parser
-$(OUTPUT)util/parse-events-bison.c: event-parser
+$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
+	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
 
-pmu-parser:
-	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
+$(OUTPUT)util/pmu-flex.c: util/pmu.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
 
-$(OUTPUT)util/pmu-flex.c: pmu-parser
-$(OUTPUT)util/pmu-bison.c: pmu-parser
+$(OUTPUT)util/pmu-bison.c: util/pmu.y
+	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
 
-$(OUTPUT)util/parse-events.o: event-parser pmu-parser
+$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
 
 LIB_FILE=$(OUTPUT)libperf.a
 
@@ -852,8 +851,6 @@ help:
 	@echo '  html		- make html documentation'
 	@echo '  info		- make GNU info documentation (access with info <foo>)'
 	@echo '  pdf		- make pdf documentation'
-	@echo '  event-parser	- make event parser code'
-	@echo '  pmu-parser	- make pmu format parser code'
 	@echo '  TAGS		- use etags to make tag information for source browsing'
 	@echo '  tags		- use ctags to make tag information for source browsing'
 	@echo '  cscope	- use cscope to make interactive browsing database'
Signature · 1 line
1.7.7.6
#1 lore raw

[tip:perf/core] perf tools: Fix parsers' rules to dependencies

Commit-ID:  024e6c9747bb274c9d744ad52a987a0ebec528a6
Gitweb:     http://git.kernel.org/tip/024e6c9747bb274c9d744ad52a987a0ebec528a6
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 11 Apr 2012 12:39:51 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 11 Apr 2012 16:57:09 -0300

perf tools: Fix parsers' rules to dependencies

Currently the parsers objects (bison/flex related) are each time perf is built. No matter the generated files are already in place, the parser generation is executed every time.

Changing the rules to have proper flex/bison objects generation dependencies.

The parsers code is not rebuilt until the flex/bison source files are touched. Also when flex/bison source is changed, only dependent objects are rebuilt.

---
 tools/perf/Makefile |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
tools/perf/Makefile +8 -11
index 4ca77cc..b28b610 100644
@@ -204,21 +204,20 @@ export PERL_PATH
 FLEX = $(CROSS_COMPILE)flex
 BISON= $(CROSS_COMPILE)bison
 
-event-parser:
-	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
 
-$(OUTPUT)util/parse-events-flex.c: event-parser
-$(OUTPUT)util/parse-events-bison.c: event-parser
+$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
+	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
 
-pmu-parser:
-	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
+$(OUTPUT)util/pmu-flex.c: util/pmu.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
 
-$(OUTPUT)util/pmu-flex.c: pmu-parser
-$(OUTPUT)util/pmu-bison.c: pmu-parser
+$(OUTPUT)util/pmu-bison.c: util/pmu.y
+	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
 
-$(OUTPUT)util/parse-events.o: event-parser pmu-parser
+$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
 
 LIB_FILE=$(OUTPUT)libperf.a
 
@@ -807,8 +806,6 @@ help:
 	@echo '  html		- make html documentation'
 	@echo '  info		- make GNU info documentation (access with info <foo>)'
 	@echo '  pdf		- make pdf documentation'
-	@echo '  event-parser	- make event parser code'
-	@echo '  pmu-parser	- make pmu format parser code'
 	@echo '  TAGS		- use etags to make tag information for source browsing'
 	@echo '  tags		- use ctags to make tag information for source browsing'
 	@echo '  cscope	- use cscope to make interactive browsing database'
#2 lore raw

Re: [tip:perf/core] perf tools: Fix parsers' rules to dependencies

Quoted 13 lines · tip-bot for Jiri Olsa
Commit-ID:  024e6c9747bb274c9d744ad52a987a0ebec528a6
Gitweb:     http://git.kernel.org/tip/024e6c9747bb274c9d744ad52a987a0ebec528a6
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 11 Apr 2012 12:39:51 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 11 Apr 2012 16:57:09 -0300

perf tools: Fix parsers' rules to dependencies

Currently the parsers objects (bison/flex related) are each time perf is built. No matter the generated files are already in place, the parser generation is executed every time.

Quoted 6 lines

Changing the rules to have proper flex/bison objects generation dependencies.

The parsers code is not rebuilt until the flex/bison source files are touched. Also when flex/bison source is changed, only dependent objects are rebuilt.

Hm, can I cherry-pick this over into perf/urgent? I see no good reason why we should leave the v3.4 version half-broken.

Thanks,

Ingo

#3 lore raw

Re: [tip:perf/core] perf tools: Fix parsers' rules to dependencies

Em Sat, Apr 14, 2012 at 01:41:29PM +0200, Ingo Molnar escreveu:

Quoted 19 lines · tip-bot for Jiri Olsa
Quoted 17 lines
Commit-ID:  024e6c9747bb274c9d744ad52a987a0ebec528a6
Gitweb:     http://git.kernel.org/tip/024e6c9747bb274c9d744ad52a987a0ebec528a6
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 11 Apr 2012 12:39:51 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Wed, 11 Apr 2012 16:57:09 -0300

perf tools: Fix parsers' rules to dependencies

Currently the parsers objects (bison/flex related) are each time perf is built. No matter the generated files are already in place, the parser generation is executed every time.

Changing the rules to have proper flex/bison objects generation dependencies.

Quoted 6 lines
Quoted 3 lines

The parsers code is not rebuilt until the flex/bison source files are touched. Also when flex/bison source is changed, only dependent objects are rebuilt.

Hm, can I cherry-pick this over into perf/urgent? I see no good reason why we should leave the v3.4 version half-broken.

Feel free! Overcautious me, wanting to push just only strict bug fixes there, this one I found just a minor annoyance, so left for perf/core.

Quoted 3 lines

Thanks,

Ingo

#4 lore raw

[tip:perf/urgent] perf tools: Fix parsers' rules to dependencies

In reply to Jiri Olsa
Commit-ID:  2a5204fed0f313f9b55a7b4d5f48ca484446d095
Gitweb:     http://git.kernel.org/tip/2a5204fed0f313f9b55a7b4d5f48ca484446d095
Author:     Jiri Olsa <[email protected]>
AuthorDate: Wed, 11 Apr 2012 12:39:51 +0200
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Sat, 14 Apr 2012 13:49:43 -0300

perf tools: Fix parsers' rules to dependencies

Currently the parsers objects (bison/flex related) are each time perf is built. No matter the generated files are already in place, the parser generation is executed every time.

Changing the rules to have proper flex/bison objects generation dependencies.

The parsers code is not rebuilt until the flex/bison source files are touched. Also when flex/bison source is changed, only dependent objects are rebuilt.

---
 tools/perf/Makefile |   19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)
tools/perf/Makefile +8 -11
index a20d0c5..03059e7 100644
@@ -237,21 +237,20 @@ export PERL_PATH
 FLEX = $(CROSS_COMPILE)flex
 BISON= $(CROSS_COMPILE)bison
 
-event-parser:
-	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/parse-events-flex.c: util/parse-events.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
 
-$(OUTPUT)util/parse-events-flex.c: event-parser
-$(OUTPUT)util/parse-events-bison.c: event-parser
+$(OUTPUT)util/parse-events-bison.c: util/parse-events.y
+	$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
 
-pmu-parser:
-	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
+$(OUTPUT)util/pmu-flex.c: util/pmu.l
 	$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
 
-$(OUTPUT)util/pmu-flex.c: pmu-parser
-$(OUTPUT)util/pmu-bison.c: pmu-parser
+$(OUTPUT)util/pmu-bison.c: util/pmu.y
+	$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
 
-$(OUTPUT)util/parse-events.o: event-parser pmu-parser
+$(OUTPUT)util/parse-events.o: $(OUTPUT)util/parse-events-flex.c $(OUTPUT)util/parse-events-bison.c
+$(OUTPUT)util/pmu.o: $(OUTPUT)util/pmu-flex.c $(OUTPUT)util/pmu-bison.c
 
 LIB_FILE=$(OUTPUT)libperf.a
 
@@ -852,8 +851,6 @@ help:
 	@echo '  html		- make html documentation'
 	@echo '  info		- make GNU info documentation (access with info <foo>)'
 	@echo '  pdf		- make pdf documentation'
-	@echo '  event-parser	- make event parser code'
-	@echo '  pmu-parser	- make pmu format parser code'
 	@echo '  TAGS		- use etags to make tag information for source browsing'
 	@echo '  tags		- use ctags to make tag information for source browsing'
 	@echo '  cscope	- use cscope to make interactive browsing database'