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