Makefile 1.3 KB
Newer Older
1
# SPDX-License-Identifier: GPL-2.0
2 3 4
noarg:
	$(MAKE) -C ../

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
top_srcdir = ../../../../..
9 10 11
include ../../lib.mk

all: $(TEST_GEN_PROGS) ebb
12

13
$(TEST_GEN_PROGS): $(EXTRA_SOURCES)
14 15

# loop.S can only be built 64-bit
16
$(OUTPUT)/count_instructions: loop.S count_instructions.c $(EXTRA_SOURCES)
17 18
	$(CC) $(CFLAGS) -m64 -o $@ $^

19
$(OUTPUT)/per_event_excludes: ../utils.c
20

21 22 23
DEFAULT_RUN_TESTS := $(RUN_TESTS)
override define RUN_TESTS
	$(DEFAULT_RUN_TESTS)
24
	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests
25
endef
26

27 28 29
DEFAULT_EMIT_TESTS := $(EMIT_TESTS)
override define EMIT_TESTS
	$(DEFAULT_EMIT_TESTS)
30
	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests
31
endef
32

33
DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
34 35
override define INSTALL_RULE
	$(DEFAULT_INSTALL_RULE)
36
	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install
37
endef
38

39
clean:
40
	$(RM) $(TEST_GEN_PROGS) $(OUTPUT)/loop.o
41
	TARGET=ebb; BUILD_TARGET=$$OUTPUT/$$TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean
42 43

ebb:
44
	TARGET=$@; BUILD_TARGET=$$OUTPUT/$$TARGET; mkdir -p $$BUILD_TARGET; $(MAKE) OUTPUT=$$BUILD_TARGET -k -C $$TARGET all
45

46
.PHONY: all run_tests clean ebb