1# SPDX-License-Identifier: GPL-2.0 2noarg: 3 $(MAKE) -C ../ 4 5TEST_GEN_PROGS := count_instructions l3_bank_test per_event_excludes 6EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c 7 8include ../../lib.mk 9 10all: $(TEST_GEN_PROGS) ebb 11 12$(TEST_GEN_PROGS): $(EXTRA_SOURCES) 13 14# loop.S can only be built 64-bit 15$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES) 16 $(CC) $(CFLAGS) -m64 -o $@ $^ 17 18$(OUTPUT)/per_event_excludes: ../utils.c 19 20DEFAULT_RUN_TESTS := $(RUN_TESTS) 21override define RUN_TESTS 22 $(DEFAULT_RUN_TESTS) 23 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests 24endef 25 26DEFAULT_EMIT_TESTS := $(EMIT_TESTS) 27override define EMIT_TESTS 28 $(DEFAULT_EMIT_TESTS) 29 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests 30endef 31 32DEFAULT_INSTALL_RULE := $(INSTALL_RULE) 33override define INSTALL_RULE 34 $(DEFAULT_INSTALL_RULE) 35 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install 36endef 37 38clean: 39 $(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o 40 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean 41 42ebb: 43 TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all 44 45.PHONY: all run_tests clean ebb 46