qemu/tests/tcg/Makefile.include
<<
>>
Prefs
   1# -*- Mode: makefile -*-
   2#
   3# TCG tests (per-target rules)
   4#
   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.
   9#
  10
  11# The per ARCH makefile, if it exists, holds extra information about
  12# useful docker images or alternative compiler flags.
  13
  14-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
  15-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
  16
  17GUEST_BUILD=
  18TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile
  19# Support installed Cross Compilers
  20
  21ifdef CROSS_CC_GUEST
  22
  23.PHONY: cross-build-guest-tests
  24cross-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)")
  31
  32GUEST_BUILD=cross-build-guest-tests
  33
  34endif
  35
  36# Support building with Docker
  37
  38ifeq ($(HAVE_USER_DOCKER)$(GUEST_BUILD),y)
  39ifneq ($(DOCKER_IMAGE),)
  40
  41# We also need the Docker make rules to depend on
  42include $(SRC_PATH)/tests/docker/Makefile.include
  43
  44DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc --user $(shell id -u) \
  45                --cc $(DOCKER_CROSS_COMPILER) \
  46                -i qemu:$(DOCKER_IMAGE) \
  47                -s $(SRC_PATH) -- "
  48DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
  49
  50.PHONY: docker-build-guest-tests
  51docker-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)")
  58
  59GUEST_BUILD=docker-build-guest-tests
  60
  61endif
  62endif
  63
  64# Final targets
  65.PHONY: guest-tests
  66
  67ifneq ($(GUEST_BUILD),)
  68guest-tests: $(GUEST_BUILD)
  69
  70run-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)")
  74
  75else
  76guest-tests:
  77        $(call quiet-command, /bin/true, "BUILD", \
  78                "$(TARGET_NAME) guest-tests SKIPPED")
  79
  80run-guest-tests:
  81        $(call quiet-command, /bin/true, "RUN", \
  82                "tests for $(TARGET_NAME) SKIPPED")
  83endif
  84
  85# It doesn't matter if these don't exits
  86.PHONY: clean-guest-tests
  87clean-guest-tests:
  88        rm -rf tests || echo "no $(TARGET_NAME) tests to remove"
  89