180eeb67fSAndi Kleenpmu-events-y += pmu-events.o 27a759cd8SJiada WangJDIR = pmu-events/arch/$(SRCARCH) 380eeb67fSAndi KleenJSON = $(shell [ -d $(JDIR) ] && \ 480eeb67fSAndi Kleen find $(JDIR) -name '*.json' -o -name 'mapfile.csv') 5517db3b5SJohn GarryJDIR_TEST = pmu-events/arch/test 6517db3b5SJohn GarryJSON_TEST = $(shell [ -d $(JDIR_TEST) ] && \ 7517db3b5SJohn Garry find $(JDIR_TEST) -name '*.json') 800facc76SIan RogersJEVENTS_PY = pmu-events/jevents.py 9*b777b3d2SIan RogersMETRIC_PY = pmu-events/metric.py 10*b777b3d2SIan RogersMETRIC_TEST_PY = pmu-events/metric_test.py 11*b777b3d2SIan RogersEMPTY_PMU_EVENTS_C = pmu-events/empty-pmu-events.c 12*b777b3d2SIan RogersPMU_EVENTS_C = $(OUTPUT)pmu-events/pmu-events.c 13*b777b3d2SIan RogersMETRIC_TEST_LOG = $(OUTPUT)pmu-events/metric_test.log 14e9d32c1bSJohn Garry 15b4f04660SIan Rogersifeq ($(JEVENTS_ARCH),) 16b4f04660SIan RogersJEVENTS_ARCH=$(SRCARCH) 17b4f04660SIan Rogersendif 185a09b1fdSIan RogersJEVENTS_MODEL ?= all 19b4f04660SIan Rogers 2080eeb67fSAndi Kleen# 2180eeb67fSAndi Kleen# Locate/process JSON files in pmu-events/arch/ 2280eeb67fSAndi Kleen# directory and create tables in pmu-events.c. 2380eeb67fSAndi Kleen# 2400facc76SIan Rogers 2500facc76SIan Rogersifeq ($(NO_JEVENTS),1) 26*b777b3d2SIan Rogers$(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C) 2700facc76SIan Rogers $(call rule_mkdir) 2800facc76SIan Rogers $(Q)$(call echo-cmd,gen)cp $< $@ 2900facc76SIan Rogerselse 30*b777b3d2SIan Rogers$(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY) 31*b777b3d2SIan Rogers $(call rule_mkdir) 32*b777b3d2SIan Rogers $(Q)$(call echo-cmd,test)$(PYTHON) $< 2> $@ || (cat $@ && false) 33*b777b3d2SIan Rogers 34*b777b3d2SIan Rogers$(PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) 3500facc76SIan Rogers $(call rule_mkdir) 365a09b1fdSIan Rogers $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@ 3700facc76SIan Rogersendif 38