qom: Use returned bool to check for failure, Coccinelle part
[qemu/ar7.git] / tests / tcg / Makefile.qemu
blob9c23aeaa2a6499f221f9add6ed50ef2f31730405
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 include $(SRC_PATH)/rules.mak
13 # The configure script fills in extra information about
14 # useful docker images or alternative compiler flags.
16 CROSS_CC_GUEST:=
17 DOCKER_IMAGE:=
18 -include $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak
20 GUEST_BUILD=
21 TCG_MAKE=../Makefile.target
23 # We also need the Docker make rules to depend on
24 SKIP_DOCKER_BUILD=1
25 include $(SRC_PATH)/tests/docker/Makefile.include
27 # Support installed Cross Compilers
29 ifdef CROSS_CC_GUEST
31 .PHONY: cross-build-guest-tests
32 cross-build-guest-tests:
33         $(call quiet-command, \
34            (mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
35             $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC="$(CROSS_CC_GUEST)" \
36                         SRC_PATH="$(SRC_PATH)" BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
37                         EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
38         "BUILD","$(TARGET) guest-tests with $(CROSS_CC_GUEST)")
40 GUEST_BUILD=cross-build-guest-tests
42 endif
44 # Support building with Docker
46 ifneq ($(DOCKER_IMAGE),)
48 DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc \
49                 --cc $(DOCKER_CROSS_CC_GUEST) \
50                 -i qemu:$(DOCKER_IMAGE) \
51                 -s $(SRC_PATH) -- "
53 .PHONY: docker-build-guest-tests
54 docker-build-guest-tests: docker-image-$(DOCKER_IMAGE)
55         $(call quiet-command, \
56           (mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
57            $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC=$(DOCKER_COMPILE_CMD) \
58                         SRC_PATH="$(SRC_PATH)" BUILD_STATIC=y \
59                         EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
60         "BUILD","$(TARGET) guest-tests with docker qemu:$(DOCKER_IMAGE)")
62 GUEST_BUILD=docker-build-guest-tests
64 endif
66 # Final targets
67 all:
68         @echo "Do not invoke this Makefile directly"; exit 1
70 .PHONY: guest-tests
72 ifneq ($(GUEST_BUILD),)
73 guest-tests: $(GUEST_BUILD)
75 run-guest-tests: guest-tests
76         $(call quiet-command, \
77         (cd tests/tcg/$(TARGET) && \
78          $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" \
79                         SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run), \
80         "RUN", "tests for $(TARGET_NAME)")
82 else
83 guest-tests:
84         $(call quiet-command, /bin/true, "BUILD", \
85                 "$(TARGET) guest-tests SKIPPED")
87 run-guest-tests:
88         $(call quiet-command, /bin/true, "RUN", \
89                 "tests for $(TARGET) SKIPPED")
90 endif
92 # It doesn't matter if these don't exits
93 .PHONY: clean-guest-tests
94 clean-guest-tests:
95         rm -rf tests/tcg/$(TARGET)