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