@@ -61,8 +61,6 @@ ARCH ?= $(shell echo $(uname_M) | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
61
61
62
62
CC = $(CROSS_COMPILE ) gcc
63
63
AR = $(CROSS_COMPILE ) ar
64
- FLEX = $(CROSS_COMPILE ) flex
65
- BISON = $(CROSS_COMPILE ) bison
66
64
67
65
# Additional ARCH settings for x86
68
66
ifeq ($(ARCH ) ,i386)
@@ -184,7 +182,7 @@ endif
184
182
185
183
# ## --- END CONFIGURATION SECTION ---
186
184
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
188
186
BASIC_LDFLAGS =
189
187
190
188
# Guard against environment variables
@@ -236,6 +234,25 @@ endif
236
234
237
235
export PERL_PATH
238
236
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
+
239
256
LIB_FILE =$(OUTPUT ) libperf.a
240
257
241
258
LIB_H += ../../include/linux/perf_event.h
@@ -754,6 +771,15 @@ $(OUTPUT)perf.o perf.spec \
754
771
.SUFFIXES :
755
772
.SUFFIXES : .o .c .S .s
756
773
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
+
757
783
$(OUTPUT ) % .o : % .c $(OUTPUT ) PERF-CFLAGS
758
784
$(QUIET_CC )$(CC ) -o $@ -c $(ALL_CFLAGS ) $<
759
785
$(OUTPUT ) % .i : % .c $(OUTPUT ) PERF-CFLAGS
@@ -790,12 +816,6 @@ $(OUTPUT)util/ui/browsers/map.o: util/ui/browsers/map.c $(OUTPUT)PERF-CFLAGS
790
816
$(OUTPUT ) util/rbtree.o : ../../lib/rbtree.c $(OUTPUT ) PERF-CFLAGS
791
817
$(QUIET_CC )$(CC ) -o $@ -c $(ALL_CFLAGS ) -DETC_PERFCONFIG=' "$(ETC_PERFCONFIG_SQ)"' $<
792
818
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
-
799
819
$(OUTPUT ) util/scripting-engines/trace-event-perl.o : util/scripting-engines/trace-event-perl.c $(OUTPUT ) PERF-CFLAGS
800
820
$(QUIET_CC )$(CC ) -o $@ -c $(ALL_CFLAGS ) $(PERL_EMBED_CCOPTS ) -Wno-redundant-decls -Wno-strict-prototypes -Wno-unused-parameter -Wno-shadow $<
801
821
@@ -883,14 +903,6 @@ cscope:
883
903
$(RM ) cscope*
884
904
$(FIND ) . -name ' *.[hcS]' -print | xargs cscope -b
885
905
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
-
894
906
# ## Detect prefix changes
895
907
TRACK_CFLAGS = $(subst ','\'',$(ALL_CFLAGS ) ) :\
896
908
$(bindir_SQ ) :$(perfexecdir_SQ ) :$(template_dir_SQ ) :$(prefix_SQ )
@@ -978,6 +990,7 @@ clean:
978
990
$(RM ) * .spec * .pyc * .pyo * /* .pyc * /* .pyo $(OUTPUT ) common-cmds.h TAGS tags cscope*
979
991
$(MAKE ) -C Documentation/ clean
980
992
$(RM ) $(OUTPUT ) PERF-VERSION-FILE $(OUTPUT ) PERF-CFLAGS
993
+ $(RM ) $(OUTPUT ) util/* -{bison,flex}*
981
994
$(python-clean )
982
995
983
996
.PHONY : all install clean strip
0 commit comments