xref: /openbmc/linux/tools/perf/pmu-events/Build (revision 2455f0e1)
1pmu-events-y	+= pmu-events.o
2JDIR		=  pmu-events/arch/$(SRCARCH)
3JSON		=  $(shell [ -d $(JDIR) ] &&				\
4			find $(JDIR) -name '*.json' -o -name 'mapfile.csv')
5JDIR_TEST	=  pmu-events/arch/test
6JSON_TEST	=  $(shell [ -d $(JDIR_TEST) ] &&			\
7			find $(JDIR_TEST) -name '*.json')
8JEVENTS_PY	=  pmu-events/jevents.py
9
10ifeq ($(JEVENTS_ARCH),)
11JEVENTS_ARCH=$(SRCARCH)
12endif
13
14#
15# Locate/process JSON files in pmu-events/arch/
16# directory and create tables in pmu-events.c.
17#
18
19ifeq ($(NO_JEVENTS),1)
20$(OUTPUT)pmu-events/pmu-events.c: pmu-events/empty-pmu-events.c
21	$(call rule_mkdir)
22	$(Q)$(call echo-cmd,gen)cp $< $@
23else
24$(OUTPUT)pmu-events/pmu-events.c: $(JSON) $(JSON_TEST) $(JEVENTS_PY) pmu-events/metric.py
25	$(call rule_mkdir)
26	$(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) pmu-events/arch $@
27endif
28