Skip to content

Commit 65f3e56

Browse files
Ingo Molnaracmel
authored andcommitted
perf tools: Remove auto-generated bison/flex files
These should not be in the Git history - they are auto-generated. Extend the Makefile rules of the parser files to include the generation run. Signed-off-by: Ingo Molnar <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [ committer note: Fixed up O= handling ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 64c17be commit 65f3e56

File tree

9 files changed

+30
-8476
lines changed

9 files changed

+30
-8476
lines changed

tools/perf/Makefile

Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
6161

6262
CC = $(CROSS_COMPILE)gcc
6363
AR = $(CROSS_COMPILE)ar
64-
FLEX = $(CROSS_COMPILE)flex
65-
BISON= $(CROSS_COMPILE)bison
6664

6765
# Additional ARCH settings for x86
6866
ifeq ($(ARCH),i386)
@@ -184,7 +182,7 @@ endif
184182

185183
### --- END CONFIGURATION SECTION ---
186184

187-
BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
185+
BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)/util -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
188186
BASIC_LDFLAGS =
189187

190188
# Guard against environment variables
@@ -236,6 +234,25 @@ endif
236234

237235
export PERL_PATH
238236

237+
FLEX = $(CROSS_COMPILE)flex
238+
BISON= $(CROSS_COMPILE)bison
239+
240+
event-parser:
241+
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o $(OUTPUT)util/parse-events-bison.c
242+
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/parse-events-flex.h -t util/parse-events.l > $(OUTPUT)util/parse-events-flex.c
243+
244+
$(OUTPUT)util/parse-events-flex.c: event-parser
245+
$(OUTPUT)util/parse-events-bison.c: event-parser
246+
247+
pmu-parser:
248+
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o $(OUTPUT)util/pmu-bison.c
249+
$(QUIET_FLEX)$(FLEX) --header-file=$(OUTPUT)util/pmu-flex.h -t util/pmu.l > $(OUTPUT)util/pmu-flex.c
250+
251+
$(OUTPUT)util/pmu-flex.c: pmu-parser
252+
$(OUTPUT)util/pmu-bison.c: pmu-parser
253+
254+
$(OUTPUT)util/parse-events.o: event-parser pmu-parser
255+
239256
LIB_FILE=$(OUTPUT)libperf.a
240257

241258
LIB_H += ../../include/linux/perf_event.h
@@ -754,6 +771,15 @@ $(OUTPUT)perf.o perf.spec \
754771
.SUFFIXES:
755772
.SUFFIXES: .o .c .S .s
756773

774+
# These two need to be here so that when O= is not used they take precedence
775+
# over the general rule for .o
776+
777+
$(OUTPUT)util/%-flex.o: $(OUTPUT)util/%-flex.c $(OUTPUT)PERF-CFLAGS
778+
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
779+
780+
$(OUTPUT)util/%-bison.o: $(OUTPUT)util/%-bison.c $(OUTPUT)PERF-CFLAGS
781+
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DYYENABLE_NLS=0 -DYYLTYPE_IS_TRIVIAL=0 -Iutil/ -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
782+
757783
$(OUTPUT)%.o: %.c $(OUTPUT)PERF-CFLAGS
758784
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $<
759785
$(OUTPUT)%.i: %.c $(OUTPUT)PERF-CFLAGS
@@ -790,12 +816,6 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
790816
$(OUTPUT)util/rbtree.o: ../../lib/rbtree.c $(OUTPUT)PERF-CFLAGS
791817
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $<
792818

793-
$(OUTPUT)util/parse-events-flex.o: util/parse-events-flex.c $(OUTPUT)PERF-CFLAGS
794-
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
795-
796-
$(OUTPUT)util/pmu-flex.o: util/pmu-flex.c $(OUTPUT)PERF-CFLAGS
797-
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) -Wno-redundant-decls -Wno-switch-default -Wno-unused-function $<
798-
799819
$(OUTPUT)util/scripting-engines/trace-event-perl.o: util/scripting-engines/trace-event-perl.c $(OUTPUT)PERF-CFLAGS
800820
$(QUIET_CC)$(CC) -o $@ -c $(ALL_CFLAGS) $(PERL_EMBED_CCOPTS) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
801821

@@ -883,14 +903,6 @@ cscope:
883903
$(RM) cscope*
884904
$(FIND) . -name '*.[hcS]' -print | xargs cscope -b
885905

886-
event-parser:
887-
$(QUIET_BISON)$(BISON) -v util/parse-events.y -d -o util/parse-events-bison.c
888-
$(QUIET_FLEX)$(FLEX) --header-file=util/parse-events-flex.h -t util/parse-events.l > util/parse-events-flex.c
889-
890-
pmu-parser:
891-
$(QUIET_BISON)$(BISON) -v util/pmu.y -d -o util/pmu-bison.c
892-
$(QUIET_FLEX)$(FLEX) --header-file=util/pmu-flex.h -t util/pmu.l > util/pmu-flex.c
893-
894906
### Detect prefix changes
895907
TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS)):\
896908
$(bindir_SQ):$(perfexecdir_SQ):$(template_dir_SQ):$(prefix_SQ)
@@ -978,6 +990,7 @@ clean:
978990
$(RM) *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope*
979991
$(MAKE) -C Documentation/ clean
980992
$(RM) $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)PERF-CFLAGS
993+
$(RM) $(OUTPUT)util/*-{bison,flex}*
981994
$(python-clean)
982995

983996
.PHONY: all install clean strip

0 commit comments

Comments
 (0)