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