1# SPDX-License-Identifier: GPL-2.0 2noarg: 3 $(MAKE) -C ../ 4 5TEST_GEN_PROGS := count_instructions count_stcx_fail l3_bank_test per_event_excludes 6EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c 7 8top_srcdir = ../../../../.. 9include ../../lib.mk 10 11all: $(TEST_GEN_PROGS) ebb sampling_tests event_code_tests 12 13$(TEST_GEN_PROGS): $(EXTRA_SOURCES) 14 15# loop.S can only be built 64-bit 16$(OUTPUT)/count_instructions: CFLAGS += -m64 17$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES) 18 19$(OUTPUT)/count_stcx_fail: CFLAGS += -m64 20$(OUTPUT)/count_stcx_fail: loop.S $(EXTRA_SOURCES) 21 22 23$(OUTPUT)/per_event_excludes: ../utils.c 24 25DEFAULT_RUN_TESTS := $(RUN_TESTS) 26override define RUN_TESTS 27 $(DEFAULT_RUN_TESTS) 28 +TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests 29 +TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests 30 +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests 31endef 32 33emit_tests: 34 for TEST in $(TEST_GEN_PROGS); do \ 35 BASENAME_TEST=`basename $$TEST`; \ 36 echo "$(COLLECTION):$$BASENAME_TEST"; \ 37 done 38 +TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests 39 +TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests 40 +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests 41 42DEFAULT_INSTALL_RULE := $(INSTALL_RULE) 43override define INSTALL_RULE 44 $(DEFAULT_INSTALL_RULE) 45 +TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install 46 +TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install 47 +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install 48endef 49 50DEFAULT_CLEAN := $(CLEAN) 51override define CLEAN 52 $(DEFAULT_CLEAN) 53 $(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o 54 +TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean 55 +TARGET=sampling_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean 56 +TARGET=event_code_tests; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean 57endef 58 59ebb: 60 TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all 61 62sampling_tests: 63 TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all 64 65event_code_tests: 66 TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all 67 68.PHONY: all run_tests ebb sampling_tests event_code_tests emit_tests 69