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
11 # The configure script fills in extra information about
12 # useful docker images or alternative compiler flags.
16 -include $(BUILD_DIR)/tests/tcg/config-$(TARGET).mak
19 TCG_MAKE=../Makefile.target
21 # We also need the Docker make rules to depend on
23 include $(SRC_PATH)/tests/docker/Makefile.include
25 # Support installed Cross Compilers
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
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) \
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
66 @echo "Do not invoke this Makefile directly"; exit 1
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)")
82 $(call quiet-command, /bin/true, "BUILD", \
83 "$(TARGET) guest-tests SKIPPED")
86 $(call quiet-command, /bin/true, "RUN", \
87 "tests for $(TARGET) SKIPPED")
90 # It doesn't matter if these don't exits
91 .PHONY: clean-guest-tests
93 rm -rf tests/tcg/$(TARGET)