build: Link user-only with crypto random number objects
[qemu/ar7.git] / tests / tcg / Makefile.include
blob73b5626fc5f955fb717f78287e425f5295dbfca4
1 # -*- Mode: makefile -*-
3 # TCG tests (per-target rules)
5 # This Makefile fragment is included from the per-target
6 # Makefile.target so will be invoked for each linux-user program we
7 # build. We have two options for compiling, either using a configured
8 # guest compiler or calling one of our docker images to do it for us.
11 # The per ARCH makefile, if it exists, holds extra information about
12 # useful docker images or alternative compiler flags.
14 -include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
15 -include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
17 GUEST_BUILD=
18 TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile
19 # Support installed Cross Compilers
21 ifdef CROSS_CC_GUEST
23 .PHONY: cross-build-guest-tests
24 cross-build-guest-tests:
25         $(call quiet-command, \
26            (mkdir -p tests && cd tests && \
27             $(MAKE) -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
28                         BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
29                         EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
30         "BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
32 GUEST_BUILD=cross-build-guest-tests
34 endif
36 # Support building with Docker
38 ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y)
39 ifneq ($(DOCKER_IMAGE),)
41 # We also need the Docker make rules to depend on
42 include $(SRC_PATH)/tests/docker/Makefile.include
44 DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
45                 --cc $(DOCKER_CROSS_COMPILER) \
46                 -i qemu:$(DOCKER_IMAGE) \
47                 -s $(SRC_PATH) -- "
48 DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
50 .PHONY: docker-build-guest-tests
51 docker-build-guest-tests: $(DOCKER_PREREQ)
52         $(call quiet-command, \
53           (mkdir -p tests && cd tests && \
54            $(MAKE) -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
55                         BUILD_STATIC=y \
56                         EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
57         "BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
59 GUEST_BUILD=docker-build-guest-tests
61 endif
62 endif
64 # Final targets
65 .PHONY: guest-tests
67 ifneq ($(GUEST_BUILD),)
68 guest-tests: $(GUEST_BUILD)
70 run-guest-tests: guest-tests qemu-$(subst y,system-,$(CONFIG_SOFTMMU))$(TARGET_NAME)
71         $(call quiet-command, \
72         (cd tests && $(MAKE) -f $(TCG_MAKE) SPEED=$(SPEED) run), \
73         "RUN", "tests for $(TARGET_NAME)")
75 else
76 guest-tests:
77         $(call quiet-command, /bin/true, "BUILD", \
78                 "$(TARGET_NAME) guest-tests SKIPPED")
80 run-guest-tests:
81         $(call quiet-command, /bin/true, "RUN", \
82                 "tests for $(TARGET_NAME) SKIPPED")
83 endif
85 # It doesn't matter if these don't exits
86 .PHONY: clean-guest-tests
87 clean-guest-tests:
88         rm -rf tests || echo "no $(TARGET_NAME) tests to remove"