summaryrefslogtreecommitdiff
path: root/tools/perf/pmu-events/Build
blob: 150765f2baeeaf157b12d4d22a0de53c07542df4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
pmu-events-y	+= pmu-events.o
JDIR		=  pmu-events/arch/$(SRCARCH)
JSON		=  $(shell [ -d $(JDIR) ] &&				\
			find $(JDIR) -name '*.json' -o -name 'mapfile.csv')
JDIR_TEST	=  pmu-events/arch/test
JSON_TEST	=  $(shell [ -d $(JDIR_TEST) ] &&			\
			find $(JDIR_TEST) -name '*.json')
JEVENTS_PY	=  pmu-events/jevents.py
METRIC_PY	=  pmu-events/metric.py
METRIC_TEST_PY	=  pmu-events/metric_test.py
EMPTY_PMU_EVENTS_C = pmu-events/empty-pmu-events.c
PMU_EVENTS_C	=  $(OUTPUT)pmu-events/pmu-events.c
METRIC_TEST_LOG	=  $(OUTPUT)pmu-events/metric_test.log

ifeq ($(JEVENTS_ARCH),)
JEVENTS_ARCH=$(SRCARCH)
endif
JEVENTS_MODEL ?= all

#
# Locate/process JSON files in pmu-events/arch/
# directory and create tables in pmu-events.c.
#

ifeq ($(NO_JEVENTS),1)
$(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,gen)cp $< $@
else
$(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,test)$(PYTHON) $< 2> $@ || (cat $@ && false)

$(PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG)
	$(call rule_mkdir)
	$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@
endif