xref: /linux/tools/testing/selftests/powerpc/pmu/Makefile (revision 58b33e78a31782ffe25d404d5eba9a45fe636e27)
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
10cbfd7dabSMichael Ellerman
110a110a4bSAthira Rajeevall: $(TEST_GEN_PROGS) ebb sampling_tests event_code_tests
1288baa78dSbamvor.zhangjian@huawei.com
1388baa78dSbamvor.zhangjian@huawei.com$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
14cb96143dSMichael Ellerman
15cb96143dSMichael Ellerman# loop.S can only be built 64-bit
167481cad4SMichael Ellerman$(OUTPUT)/count_instructions: CFLAGS += -m64
17a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
187481cad4SMichael Ellerman
197481cad4SMichael Ellerman$(OUTPUT)/count_stcx_fail: CFLAGS += -m64
207481cad4SMichael Ellerman$(OUTPUT)/count_stcx_fail: loop.S $(EXTRA_SOURCES)
217481cad4SMichael Ellerman
22cb96143dSMichael Ellerman
23a8ba798bSbamvor.zhangjian@huawei.com$(OUTPUT)/per_event_excludes: ../utils.c
24fcb45ec0SMichael Ellerman
256faeeea4SMichael EllermanDEFAULT_RUN_TESTS := $(RUN_TESTS)
266faeeea4SMichael Ellermanoverride define RUN_TESTS
276faeeea4SMichael Ellerman	$(DEFAULT_RUN_TESTS)
284ecd0868SBenjamin Gray	+TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
294ecd0868SBenjamin Gray	+TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
304ecd0868SBenjamin Gray	+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
316faeeea4SMichael Ellermanendef
32cb96143dSMichael Ellerman
33*58b33e78SMichael Ellermanemit_tests:
34*58b33e78SMichael Ellerman	for TEST in $(TEST_GEN_PROGS); do \
35*58b33e78SMichael Ellerman		BASENAME_TEST=`basename $$TEST`;	\
36*58b33e78SMichael Ellerman		echo "$(COLLECTION):$$BASENAME_TEST";	\
37*58b33e78SMichael Ellerman	done
384ecd0868SBenjamin Gray	+TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
394ecd0868SBenjamin Gray	+TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
404ecd0868SBenjamin Gray	+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
416faeeea4SMichael Ellerman
422fa30fe9SMichael EllermanDEFAULT_INSTALL_RULE := $(INSTALL_RULE)
436faeeea4SMichael Ellermanoverride define INSTALL_RULE
446faeeea4SMichael Ellerman	$(DEFAULT_INSTALL_RULE)
454ecd0868SBenjamin Gray	+TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install
464ecd0868SBenjamin Gray	+TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install
474ecd0868SBenjamin Gray	+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install
486faeeea4SMichael Ellermanendef
496faeeea4SMichael Ellerman
5069608683SBenjamin GrayDEFAULT_CLEAN := $(CLEAN)
5169608683SBenjamin Grayoverride define CLEAN
5269608683SBenjamin Gray	$(DEFAULT_CLEAN)
53a8ba798bSbamvor.zhangjian@huawei.com	$(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o
544ecd0868SBenjamin Gray	+TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean
554ecd0868SBenjamin Gray	+TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean
564ecd0868SBenjamin Gray	+TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean
5769608683SBenjamin Grayendef
586faeeea4SMichael Ellerman
596faeeea4SMichael Ellermanebb:
60a8ba798bSbamvor.zhangjian@huawei.com	TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
613752e453SMichael Ellerman
62c315669eSAthira Rajeevsampling_tests:
63c315669eSAthira Rajeev	TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
64c315669eSAthira Rajeev
650a110a4bSAthira Rajeevevent_code_tests:
660a110a4bSAthira Rajeev	TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
670a110a4bSAthira Rajeev
68*58b33e78SMichael Ellerman.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests
69