xref: /linux/tools/testing/selftests/powerpc/pmu/Makefile (revision ff2632d7d08edc11e8bd0629e9fcfebab25c78b4)
1b2441318SGreg Kroah-Hartman# SPDX-License-Identifier: GPL-2.0
2cb96143dSMichael Ellermannoarg:
3cb96143dSMichael Ellerman	$(MAKE) -C ../
4cb96143dSMichael Ellerman
57481cad4SMichael EllermanTEST_GEN_PROGS := count_instructions count_stcx_fail l3_bank_test per_event_excludes
6d1301afdSMichael EllermanEXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
7cb96143dSMichael Ellerman
87e0cf1c9SMichael Ellermantop_srcdir = ../../../../..
988baa78dSbamvor.zhangjian@huawei.cominclude ../../lib.mk
105553a793SMadhavan Srinivasaninclude ../flags.mk
11cbfd7dabSMichael Ellerman
12822a0495SMichael EllermanSUB_DIRS := ebb sampling_tests event_code_tests
13822a0495SMichael Ellerman
14822a0495SMichael Ellermanall: $(TEST_GEN_PROGS) $(SUB_DIRS)
1588baa78dSbamvor.zhangjian@huawei.com
1688baa78dSbamvor.zhangjian@huawei.com$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
17cb96143dSMichael Ellerman
18cb96143dSMichael Ellerman# loop.S can only be built 64-bit
197481cad4SMichael Ellerman$(OUTPUT)/count_instructions: CFLAGS += -m64
20a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
217481cad4SMichael Ellerman
227481cad4SMichael Ellerman$(OUTPUT)/count_stcx_fail: CFLAGS += -m64
237481cad4SMichael Ellerman$(OUTPUT)/count_stcx_fail: loop.S $(EXTRA_SOURCES)
247481cad4SMichael Ellerman
25cb96143dSMichael Ellerman
26a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/per_event_excludes: ../utils.c
27fcb45ec0SMichael Ellerman
28822a0495SMichael Ellerman$(SUB_DIRS):
29822a0495SMichael Ellerman	BUILD_TARGET=$(OUTPUT)/$@; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $@ all
30822a0495SMichael Ellerman
316faeeea4SMichael EllermanDEFAULT_RUN_TESTS := $(RUN_TESTS)
326faeeea4SMichael Ellermanoverride define RUN_TESTS
336faeeea4SMichael Ellerman	$(DEFAULT_RUN_TESTS)
34822a0495SMichael Ellerman	+@for TARGET in $(SUB_DIRS); do \
35822a0495SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET; \
36822a0495SMichael Ellerman		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests; \
37822a0495SMichael Ellerman	done;
386faeeea4SMichael Ellermanendef
39cb96143dSMichael Ellerman
4058b33e78SMichael Ellermanemit_tests:
4158b33e78SMichael Ellerman	for TEST in $(TEST_GEN_PROGS); do \
4258b33e78SMichael Ellerman		BASENAME_TEST=`basename $$TEST`;	\
4358b33e78SMichael Ellerman		echo "$(COLLECTION):$$BASENAME_TEST";	\
4458b33e78SMichael Ellerman	done
45822a0495SMichael Ellerman	+@for TARGET in $(SUB_DIRS); do \
46822a0495SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET; \
47*dda32e37SMichael Ellerman		$(MAKE) OUTPUT=$$BUILD_TARGET COLLECTION=$(COLLECTION)/$$TARGET -s -C $$TARGET emit_tests; \
48822a0495SMichael Ellerman	done;
496faeeea4SMichael Ellerman
502fa30fe9SMichael EllermanDEFAULT_INSTALL_RULE := $(INSTALL_RULE)
516faeeea4SMichael Ellermanoverride define INSTALL_RULE
526faeeea4SMichael Ellerman	$(DEFAULT_INSTALL_RULE)
53822a0495SMichael Ellerman	+@for TARGET in $(SUB_DIRS); do \
54822a0495SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET; \
55*dda32e37SMichael Ellerman		$(MAKE) OUTPUT=$$BUILD_TARGET INSTALL_PATH=$$INSTALL_PATH/$$TARGET -C $$TARGET install; \
56822a0495SMichael Ellerman	done;
576faeeea4SMichael Ellermanendef
586faeeea4SMichael Ellerman
5969608683SBenjamin GrayDEFAULT_CLEAN := $(CLEAN)
6069608683SBenjamin Grayoverride define CLEAN
6169608683SBenjamin Gray	$(DEFAULT_CLEAN)
62a8ba798bSbamvor.zhangjian@huawei.com	$(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o
63822a0495SMichael Ellerman	+@for TARGET in $(SUB_DIRS); do \
64822a0495SMichael Ellerman		BUILD_TARGET=$(OUTPUT)/$$TARGET; \
65822a0495SMichael Ellerman		$(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \
66822a0495SMichael Ellerman	done;
6769608683SBenjamin Grayendef
686faeeea4SMichael Ellerman
690a110a4bSAthira Rajeev
7058b33e78SMichael Ellerman.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests
71