1 # SPDX-License-Identifier: GPL-2.0 2 noarg: 3 $(MAKE) -C ../ 4 5 TEST_GEN_PROGS := count_instructions l3_bank_test per_event_excludes 6 EXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c 7 8 include ../../lib.mk 9 10 all: $(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 20 DEFAULT_RUN_TESTS := $(RUN_TESTS) 21 override define RUN_TESTS 22 $(DEFAULT_RUN_TESTS) 23 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests 24 endef 25 26 DEFAULT_EMIT_TESTS := $(EMIT_TESTS) 27 override define EMIT_TESTS 28 $(DEFAULT_EMIT_TESTS) 29 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests 30 endef 31 32 DEFAULT_INSTALL_RULE := $(INSTALL_RULE) 33 override define INSTALL_RULE 34 $(DEFAULT_INSTALL_RULE) 35 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install 36 endef 37 38 clean: 39 $(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o 40 TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean 41 42 ebb: 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