cachepc-qemu

Fork of AMDESE/qemu with changes for cachepc side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-qemu
Log | Files | Refs | Submodules | LICENSE | sfeed.txt

Makefile.qemu (3530B)


      1# -*- Mode: makefile -*-
      2#
      3# TCG tests (per-target rules)
      4#
      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.
      9#
     10
     11# The configure script fills in extra information about
     12# useful docker images or alternative compiler flags.
     13
     14# Usage: $(call quiet-command,command and args,"NAME","args to print")
     15# This will run "command and args", and either:
     16#  if V=1 just print the whole command and args
     17#  otherwise print the 'quiet' output in the format "  NAME     args to print"
     18# NAME should be a short name of the command, 7 letters or fewer.
     19# If called with only a single argument, will print nothing in quiet mode.
     20quiet-command-run = $(if $(V),,$(if $2,printf "  %-7s %s\n" $2 $3 && ))$1
     21quiet-@ = $(if $(V),,@)
     22quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
     23
     24CROSS_CC_GUEST:=
     25CROSS_AS_GUEST:=
     26CROSS_LD_GUEST:=
     27DOCKER_IMAGE:=
     28
     29-include tests/tcg/config-$(TARGET).mak
     30
     31GUEST_BUILD=
     32TCG_MAKE=../Makefile.target
     33
     34# We also need the Docker make rules to depend on
     35SKIP_DOCKER_BUILD=1
     36include $(SRC_PATH)/tests/docker/Makefile.include
     37
     38# Support installed Cross Compilers
     39
     40ifdef CROSS_CC_GUEST
     41
     42.PHONY: cross-build-guest-tests
     43cross-build-guest-tests:
     44	$(call quiet-command, \
     45	   (mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
     46	    $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC="$(CROSS_CC_GUEST)" \
     47			$(if $(CROSS_AS_GUEST),AS="$(CROSS_AS_GUEST)") \
     48			$(if $(CROSS_LD_GUEST),LD="$(CROSS_LD_GUEST)") \
     49			SRC_PATH="$(SRC_PATH)" BUILD_STATIC=$(CROSS_CC_GUEST_STATIC) \
     50			EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
     51	"BUILD","$(TARGET) guest-tests with $(CROSS_CC_GUEST)")
     52
     53GUEST_BUILD=cross-build-guest-tests
     54
     55endif
     56
     57# Support building with Docker
     58
     59ifneq ($(DOCKER_IMAGE),)
     60
     61DOCKER_COMPILE_CMD="$(DOCKER_SCRIPT) cc \
     62		--cc $(DOCKER_CROSS_CC_GUEST) \
     63		-i qemu/$(DOCKER_IMAGE) \
     64		-s $(SRC_PATH) -- "
     65
     66DOCKER_AS_CMD=$(if $(DOCKER_CROSS_AS_GUEST),"$(DOCKER_SCRIPT) cc \
     67		--cc $(DOCKER_CROSS_AS_GUEST) \
     68		-i qemu/$(DOCKER_IMAGE) \
     69		-s $(SRC_PATH) -- ")
     70
     71DOCKER_LD_CMD=$(if $(DOCKER_CROSS_LD_GUEST),"$(DOCKER_SCRIPT) cc \
     72		--cc $(DOCKER_CROSS_LD_GUEST) \
     73		-i qemu/$(DOCKER_IMAGE) \
     74		-s $(SRC_PATH) -- ")
     75
     76
     77.PHONY: docker-build-guest-tests
     78docker-build-guest-tests: docker-image-$(DOCKER_IMAGE)
     79	$(call quiet-command, \
     80	  (mkdir -p tests/tcg/$(TARGET) && cd tests/tcg/$(TARGET) && \
     81	   $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" CC=$(DOCKER_COMPILE_CMD) \
     82			$(if $(DOCKER_AS_CMD),AS=$(DOCKER_AS_CMD)) \
     83			$(if $(DOCKER_LD_CMD),LD=$(DOCKER_LD_CMD)) \
     84			SRC_PATH="$(SRC_PATH)" BUILD_STATIC=y \
     85			EXTRA_CFLAGS="$(CROSS_CC_GUEST_CFLAGS)"), \
     86	"BUILD","$(TARGET) guest-tests with docker qemu/$(DOCKER_IMAGE)")
     87
     88GUEST_BUILD=docker-build-guest-tests
     89
     90endif
     91
     92# Final targets
     93all:
     94	@echo "Do not invoke this Makefile directly"; exit 1
     95
     96.PHONY: guest-tests
     97
     98ifneq ($(GUEST_BUILD),)
     99guest-tests: $(GUEST_BUILD)
    100
    101run-guest-tests: guest-tests
    102	$(call quiet-command, \
    103	(cd tests/tcg/$(TARGET) && \
    104	 $(MAKE) -f $(TCG_MAKE) TARGET="$(TARGET)" \
    105	 		SRC_PATH="$(SRC_PATH)" SPEED=$(SPEED) run), \
    106	"RUN", "tests for $(TARGET_NAME)")
    107
    108else
    109guest-tests:
    110	$(call quiet-command, true, "BUILD", \
    111		"$(TARGET) guest-tests SKIPPED")
    112
    113run-guest-tests:
    114	$(call quiet-command, true, "RUN", \
    115		"tests for $(TARGET) SKIPPED")
    116endif
    117
    118# It doesn't matter if these don't exits
    119.PHONY: clean-guest-tests
    120clean-guest-tests:
    121	rm -rf tests/tcg/$(TARGET)