]>
Commit | Line | Data |
---|---|---|
c722a9e4 AB |
1 | # -*- Mode: makefile -*- |
2 | # | |
3 | # TCG tests (per-target rules) | |
4 | # | |
fc76c56d PB |
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. | |
c722a9e4 AB |
9 | # |
10 | ||
11 | # The per ARCH makefile, if it exists, holds extra information about | |
12 | # useful docker images or alternative compiler flags. | |
13 | ||
fc76c56d PB |
14 | include $(TARGET_DIR)config-target.mak |
15 | include $(SRC_PATH)/rules.mak | |
16 | include $(wildcard \ | |
17 | $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include \ | |
18 | $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include) | |
c722a9e4 AB |
19 | |
20 | GUEST_BUILD= | |
fc76c56d | 21 | TCG_MAKE=../Makefile.target |
c722a9e4 AB |
22 | # Support installed Cross Compilers |
23 | ||
24 | ifdef CROSS_CC_GUEST | |
25 | ||
26 | .PHONY: cross-build-guest-tests | |
27 | cross-build-guest-tests: | |
28 | $(call quiet-command, \ | |
fc76c56d PB |
29 | (mkdir -p tests/tcg/$(TARGET_DIR) && cd tests/tcg/$(TARGET_DIR) && \ |
30 | $(MAKE) -f $(TCG_MAKE) TARGET_DIR="$(TARGET_DIR)" CC="$(CROSS_CC_GUEST)" \ | |
31 | SRC_PATH="$(SRC_PATH)" BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \ | |
c722a9e4 AB |
32 | EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \ |
33 | "BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)") | |
34 | ||
35 | GUEST_BUILD=cross-build-guest-tests | |
36 | ||
37 | endif | |
38 | ||
39 | # Support building with Docker | |
40 | ||
41 | ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y) | |
42 | ifneq ($(DOCKER_IMAGE),) | |
43 | ||
44 | # We also need the Docker make rules to depend on | |
fc76c56d | 45 | SKIP_DOCKER_BUILD=1 |
c722a9e4 AB |
46 | include $(SRC_PATH)/tests/docker/Makefile.include |
47 | ||
71ebbe09 | 48 | DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc \ |
c722a9e4 AB |
49 | --cc $(DOCKER_CROSS_COMPILER) \ |
50 | -i qemu:$(DOCKER_IMAGE) \ | |
51 | -s $(SRC_PATH) -- " | |
c722a9e4 AB |
52 | |
53 | .PHONY: docker-build-guest-tests | |
fc76c56d | 54 | docker-build-guest-tests: docker-image-$(DOCKER_IMAGE) |
c722a9e4 | 55 | $(call quiet-command, \ |
fc76c56d PB |
56 | (mkdir -p tests/tcg/$(TARGET_DIR) && cd tests/tcg/$(TARGET_DIR) && \ |
57 | $(MAKE) -f $(TCG_MAKE) TARGET_DIR="$(TARGET_DIR)" CC=$(DOCKER_COMPILE_CMD) \ | |
58 | SRC_PATH="$(SRC_PATH)" BUILD_STATIC=y \ | |
c722a9e4 AB |
59 | EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \ |
60 | "BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)") | |
61 | ||
62 | GUEST_BUILD=docker-build-guest-tests | |
63 | ||
64 | endif | |
65 | endif | |
66 | ||
67 | # Final targets | |
fc76c56d PB |
68 | all: |
69 | @echo "Do not invoke this Makefile directly"; exit 1 | |
70 | ||
c722a9e4 AB |
71 | .PHONY: guest-tests |
72 | ||
73 | ifneq ($(GUEST_BUILD),) | |
74 | guest-tests: $(GUEST_BUILD) | |
75 | ||
fc76c56d | 76 | run-guest-tests: guest-tests |
c722a9e4 | 77 | $(call quiet-command, \ |
fc76c56d PB |
78 | (cd tests/tcg/$(TARGET_DIR) && \ |
79 | $(MAKE) -f $(TCG_MAKE) TARGET_DIR="$(TARGET_DIR)" \ | |
80 | SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run), \ | |
c722a9e4 AB |
81 | "RUN", "tests for $(TARGET_NAME)") |
82 | ||
83 | else | |
84 | guest-tests: | |
85 | $(call quiet-command, /bin/true, "BUILD", \ | |
fc76c56d | 86 | "$(TARGET_DIR) guest-tests SKIPPED") |
c722a9e4 AB |
87 | |
88 | run-guest-tests: | |
89 | $(call quiet-command, /bin/true, "RUN", \ | |
fc76c56d | 90 | "tests for $(TARGET_DIR) SKIPPED") |
c722a9e4 AB |
91 | endif |
92 | ||
93 | # It doesn't matter if these don't exits | |
94 | .PHONY: clean-guest-tests | |
95 | clean-guest-tests: | |
fc76c56d | 96 | rm -rf tests/tcg/$(TARGET_DIR) |