iotests: Drop readlink -f
[qemu/ar7.git] / tests / tcg / Makefile.qemu
blob0332bad10fd49cc5ef49e290979883def14538a9
1 # -*- Mode: makefile -*-
3 # TCG tests (per-target rules)
5 # This Makefile fragment is included from the build-tcg target, once
6 # for each target we build. We have two options for compiling, either
7 # using a configured guest compiler or calling one of our docker images
8 # to do it for us.
11 # The configure script fills in extra information about
12 # useful docker images or alternative compiler flags.
14 CROSS_CC_GUEST:=
15 DOCKER_IMAGE:=
16 -include $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak
18 GUEST_BUILD=
19 TCG_MAKE=../Makefile.target
21 # We also need the Docker make rules to depend on
22 SKIP_DOCKER_BUILD=1
23 include $(SRC_PATH)/tests/docker/Makefile.include
25 # Support installed Cross Compilers
27 ifdef CROSS_CC_GUEST
29 .PHONY: cross-build-guest-tests
30 cross-build-guest-tests:
31         $(call quiet-command, \
32            (mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
33             $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC="$(CROSS_CC_GUEST)" \
34                         SRC_PATH="$(SRC_PATH)" BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
35                         EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
36         "BUILD","$(TARGET) guest-tests with $(CROSS_CC_GUEST)")
38 GUEST_BUILD=cross-build-guest-tests
40 endif
42 # Support building with Docker
44 ifneq ($(DOCKER_IMAGE),)
46 DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc \
47                 --cc $(DOCKER_CROSS_CC_GUEST) \
48                 -i qemu/$(DOCKER_IMAGE) \
49                 -s $(SRC_PATH) -- "
51 .PHONY: docker-build-guest-tests
52 docker-build-guest-tests: docker-image-$(DOCKER_IMAGE)
53         $(call quiet-command, \
54           (mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
55            $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC=$(DOCKER_COMPILE_CMD) \
56                         SRC_PATH="$(SRC_PATH)" BUILD_STATIC=y \
57                         EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
58         "BUILD","$(TARGET) guest-tests with docker qemu/$(DOCKER_IMAGE)")
60 GUEST_BUILD=docker-build-guest-tests
62 endif
64 # Final targets
65 all:
66         @echo "Do not invoke this Makefile directly"; exit 1
68 .PHONY: guest-tests
70 ifneq ($(GUEST_BUILD),)
71 guest-tests: $(GUEST_BUILD)
73 run-guest-tests: guest-tests
74         $(call quiet-command, \
75         (cd tests/tcg/$(TARGET) && \
76          $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" \
77                         SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run), \
78         "RUN", "tests for $(TARGET_NAME)")
80 else
81 guest-tests:
82         $(call quiet-command, /bin/true, "BUILD", \
83                 "$(TARGET) guest-tests SKIPPED")
85 run-guest-tests:
86         $(call quiet-command, /bin/true, "RUN", \
87                 "tests for $(TARGET) SKIPPED")
88 endif
90 # It doesn't matter if these don't exits
91 .PHONY: clean-guest-tests
92 clean-guest-tests:
93         rm -rf tests/tcg/$(TARGET)