18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_cinoarg:
38c2ecf20Sopenharmony_ci	$(MAKE) -C ../
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciTEST_GEN_PROGS := count_instructions count_stcx_fail l3_bank_test per_event_excludes
68c2ecf20Sopenharmony_ciEXTRA_SOURCES := ../harness.c event.c lib.c ../utils.c
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_citop_srcdir = ../../../../..
98c2ecf20Sopenharmony_ciinclude ../../lib.mk
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciall: $(TEST_GEN_PROGS) ebb
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci# loop.S can only be built 64-bit
168c2ecf20Sopenharmony_ci$(OUTPUT)/count_instructions: CFLAGS += -m64
178c2ecf20Sopenharmony_ci$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci$(OUTPUT)/count_stcx_fail: CFLAGS += -m64
208c2ecf20Sopenharmony_ci$(OUTPUT)/count_stcx_fail: loop.S $(EXTRA_SOURCES)
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci$(OUTPUT)/per_event_excludes: ../utils.c
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ciDEFAULT_RUN_TESTS := $(RUN_TESTS)
268c2ecf20Sopenharmony_cioverride define RUN_TESTS
278c2ecf20Sopenharmony_ci	$(DEFAULT_RUN_TESTS)
288c2ecf20Sopenharmony_ci	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
298c2ecf20Sopenharmony_ciendef
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDEFAULT_EMIT_TESTS := $(EMIT_TESTS)
328c2ecf20Sopenharmony_cioverride define EMIT_TESTS
338c2ecf20Sopenharmony_ci	$(DEFAULT_EMIT_TESTS)
348c2ecf20Sopenharmony_ci	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
358c2ecf20Sopenharmony_ciendef
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciDEFAULT_INSTALL_RULE := $(INSTALL_RULE)
388c2ecf20Sopenharmony_cioverride define INSTALL_RULE
398c2ecf20Sopenharmony_ci	$(DEFAULT_INSTALL_RULE)
408c2ecf20Sopenharmony_ci	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install
418c2ecf20Sopenharmony_ciendef
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciclean:
448c2ecf20Sopenharmony_ci	$(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o
458c2ecf20Sopenharmony_ci	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ciebb:
488c2ecf20Sopenharmony_ci	TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci.PHONY: all run_tests clean ebb
51