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 9b777b3d2SIan RogersMETRIC_PY = pmu-events/metric.py 10b777b3d2SIan RogersMETRIC_TEST_PY = pmu-events/metric_test.py 11b777b3d2SIan RogersEMPTY_PMU_EVENTS_C = pmu-events/empty-pmu-events.c 12b777b3d2SIan RogersPMU_EVENTS_C = $(OUTPUT)pmu-events/pmu-events.c 13b777b3d2SIan 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) 26b777b3d2SIan Rogers$(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C) 2700facc76SIan Rogers $(call rule_mkdir) 2800facc76SIan Rogers $(Q)$(call echo-cmd,gen)cp $< $@ 2900facc76SIan Rogerselse 30b777b3d2SIan Rogers$(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY) 31b777b3d2SIan Rogers $(call rule_mkdir) 32b777b3d2SIan Rogers $(Q)$(call echo-cmd,test)$(PYTHON) $< 2> $@ || (cat $@ && false) 33b777b3d2SIan Rogers 34b777b3d2SIan 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*7822a891SNamhyung Kim 39*7822a891SNamhyung Kim# pmu-events.c file is generated in the OUTPUT directory so it needs a 40*7822a891SNamhyung Kim# separate rule to depend on it properly 41*7822a891SNamhyung Kim$(OUTPUT)pmu-events/pmu-events.o: $(PMU_EVENTS_C) 42*7822a891SNamhyung Kim $(call rule_mkdir) 43*7822a891SNamhyung Kim $(call if_changed_dep,cc_o_c) 44