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