1 pmu-events-y += pmu-events.o
2 JDIR = pmu-events/arch/$(SRCARCH)
3 JSON = $(shell [ -d $(JDIR) ] && \
4 find $(JDIR) -name '*.json' -o -name 'mapfile.csv')
5 JDIR_TEST = pmu-events/arch/test
6 JSON_TEST = $(shell [ -d $(JDIR_TEST) ] && \
7 find $(JDIR_TEST) -name '*.json')
8 JEVENTS_PY = pmu-events/jevents.py
9 METRIC_PY = pmu-events/metric.py
10 METRIC_TEST_PY = pmu-events/metric_test.py
11 EMPTY_PMU_EVENTS_C = pmu-events/empty-pmu-events.c
12 PMU_EVENTS_C = $(OUTPUT)pmu-events/pmu-events.c
13 METRIC_TEST_LOG = $(OUTPUT)pmu-events/metric_test.log
14 TEST_EMPTY_PMU_EVENTS_C = $(OUTPUT)pmu-events/test-empty-pmu-events.c
15 EMPTY_PMU_EVENTS_TEST_LOG = $(OUTPUT)pmu-events/empty-pmu-events.log
17 ifeq ($(JEVENTS_ARCH),)
18 JEVENTS_ARCH=$(SRCARCH)
23 # Locate/process JSON files in pmu-events/arch/
24 # directory and create tables in pmu-events.c.
27 ifeq ($(NO_JEVENTS),1)
28 $(PMU_EVENTS_C): $(EMPTY_PMU_EVENTS_C)
30 $(Q)$(call echo-cmd,gen)cp $< $@
32 $(METRIC_TEST_LOG): $(METRIC_TEST_PY) $(METRIC_PY)
34 $(Q)$(call echo-cmd,test)$(PYTHON) $< 2> $@ || (cat $@ && false)
36 $(TEST_EMPTY_PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG)
38 $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) none none pmu-events/arch $@
40 $(EMPTY_PMU_EVENTS_TEST_LOG): $(EMPTY_PMU_EVENTS_C) $(TEST_EMPTY_PMU_EVENTS_C)
42 $(Q)$(call echo-cmd,test)diff -u $^ 2> $@ || (cat $@ && false)
44 $(PMU_EVENTS_C): $(JSON) $(JSON_TEST) $(JEVENTS_PY) $(METRIC_PY) $(METRIC_TEST_LOG) $(EMPTY_PMU_EVENTS_TEST_LOG)
46 $(Q)$(call echo-cmd,gen)$(PYTHON) $(JEVENTS_PY) $(JEVENTS_ARCH) $(JEVENTS_MODEL) pmu-events/arch $@
49 # pmu-events.c file is generated in the OUTPUT directory so it needs a
50 # separate rule to depend on it properly
51 $(OUTPUT)pmu-events/pmu-events.o: $(PMU_EVENTS_C)
53 $(call if_changed_dep,cc_o_c)