]> git.proxmox.com Git - mirror_qemu.git/blame - tests/tcg/Makefile
tests/tcg/Makefile: update to be called from Makefile.target
[mirror_qemu.git] / tests / tcg / Makefile
CommitLineData
7e97017e
AB
1# -*- Mode: makefile -*-
2#
3# TCG tests
4#
5# These are complicated by the fact we want to build them for guest
6# systems. This requires knowing what guests we are building and which
7# ones we have cross-compilers for or docker images with
8# cross-compilers.
9#
10# The tests themselves should be as minimal as possible as
11# cross-compilers don't always have a large amount of libraries
12# available.
13#
14# We only include the host build system for SRC_PATH and we don't
15# bother with the common rules.mk. We expect the following:
16#
17# CC - the C compiler command
18# EXTRA_CFLAGS - any extra CFLAGS
19# BUILD_STATIC - are we building static binaries
20#
21# By default all tests are statically compiled but some host systems
22# may not package static libraries by default. If an external
23# cross-compiler can only build dynamic libraries the user might need
24# to make extra efforts to ensure ld.so can link at runtime when the
25# tests are run.
26#
27# We also accept SPEED=slow to enable slower running tests
28#
29# We also expect to be in the tests build dir for the FOO-linux-user.
30#
31
f62cb1b6 32-include ../../config-host.mak
7e97017e 33-include ../config-target.mak
076d2471 34
7e97017e 35quiet-command = $(if $(V),$1,$(if $(2),@printf " %-7s %s\n" $2 $3 && $1, @$1))
7d13299d 36
7e97017e
AB
37# Tests we are building
38TESTS=
2b2e59e6 39
7e97017e
AB
40# Start with a blank slate, the build targets get to add stuff first
41CFLAGS=
42QEMU_CFLAGS=
4d1135e4
FB
43LDFLAGS=
44
7e97017e
AB
45# The QEMU for this TARGET
46QEMU=../qemu-$(TARGET_NAME)
2b2e59e6 47
7e97017e
AB
48# If TCG debugging is enabled things are a lot slower
49ifeq ($(CONFIG_DEBUG_TCG),y)
50TIMEOUT=45
51else
52TIMEOUT=15
7d13299d 53endif
2b2e59e6 54
7e97017e
AB
55# The order we include is important. We include multiarch, base arch
56# and finally arch if it's not the same as base arch.
57-include $(SRC_PATH)/tests/tcg/multiarch/Makefile.target
58-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.target
59ifneq ($(TARGET_BASE_ARCH),$(TARGET_NAME))
60-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.target
776f2227 61endif
367e86e8 62
7e97017e
AB
63# Add the common build options
64CFLAGS+=-Wall -O0 -g -fno-strict-aliasing
65ifeq ($(BUILD_STATIC),y)
66LDFLAGS+=-static
67endif
394411ac 68
7e97017e
AB
69%: %.c
70 $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
394411ac 71
7e97017e 72all: $(TESTS)
18c9b560 73
7e97017e
AB
74#
75# Test Runners
76#
77# By default we just run the test with the appropriate QEMU for the
78# target. More advanced tests may want to override the runner in their
79# specific make rules. Additional runners for the same binary should
80# be added to EXTRA_RUNS.
81#
e4630047 82
7e97017e
AB
83RUN_TESTS=$(patsubst %,run-%, $(TESTS))
84RUN_TESTS+=$(EXTRA_RUNS)
e4630047 85
7e97017e
AB
86run-%: %
87 $(call quiet-command, \
88 timeout $(TIMEOUT) $(QEMU) $< > $<.out, \
89 "TEST", "$< on $(TARGET_NAME)")
e7daa605 90
7e97017e
AB
91.PHONY: run
92run: $(RUN_TESTS)
d65f0831 93
7e97017e 94# There is no clean target, the calling make just rm's the tests build dir