1b1fb9a63SFam Zheng# Makefile for VM tests 2b1fb9a63SFam Zheng 3ebe95fa0SFam Zheng.PHONY: vm-build-all vm-clean-all 4b1fb9a63SFam Zheng 51bd26988SFam ZhengIMAGES := ubuntu.i386 freebsd netbsd openbsd centos 6bd1497dcSGerd HoffmannIMAGES_DIR := $(HOME)/.cache/qemu-vm/images 7bd1497dcSGerd HoffmannIMAGE_FILES := $(patsubst %, $(IMAGES_DIR)/%.img, $(IMAGES)) 8b1fb9a63SFam Zheng 9b1fb9a63SFam Zheng.PRECIOUS: $(IMAGE_FILES) 10b1fb9a63SFam Zheng 11b1fb9a63SFam Zhengvm-test: 12b1fb9a63SFam Zheng @echo "vm-test: Test QEMU in preconfigured virtual machines" 13b1fb9a63SFam Zheng @echo 14b1fb9a63SFam Zheng @echo " vm-build-ubuntu.i386 - Build QEMU in ubuntu i386 VM" 15b1fb9a63SFam Zheng @echo " vm-build-freebsd - Build QEMU in FreeBSD VM" 16b1fb9a63SFam Zheng @echo " vm-build-netbsd - Build QEMU in NetBSD VM" 17b1fb9a63SFam Zheng @echo " vm-build-openbsd - Build QEMU in OpenBSD VM" 181bd26988SFam Zheng @echo " vm-build-centos - Build QEMU in CentOS VM, with Docker" 19af7e9168SFam Zheng @echo "" 20af7e9168SFam Zheng @echo " vm-build-all - Build QEMU in all VMs" 21af7e9168SFam Zheng @echo " vm-clean-all - Clean up VM images" 22ddafa31fSAlex Bennée @echo 23ddafa31fSAlex Bennée @echo "Special variables:" 24ddafa31fSAlex Bennée @echo " BUILD_TARGET=foo - override the build target" 25ddafa31fSAlex Bennée @echo " TARGET_LIST=a,b,c - Override target list in builds." 26ddafa31fSAlex Bennée @echo ' EXTRA_CONFIGURE_OPTS="..."' 27b1fb9a63SFam Zheng 28b1fb9a63SFam Zhengvm-build-all: $(addprefix vm-build-, $(IMAGES)) 29b1fb9a63SFam Zheng 30ebe95fa0SFam Zhengvm-clean-all: 31ebe95fa0SFam Zheng rm -f $(IMAGE_FILES) 32ebe95fa0SFam Zheng 33bd1497dcSGerd Hoffmann$(IMAGES_DIR)/%.img: $(SRC_PATH)/tests/vm/% \ 34b1fb9a63SFam Zheng $(SRC_PATH)/tests/vm/basevm.py \ 35b1fb9a63SFam Zheng $(SRC_PATH)/tests/vm/Makefile.include 36bd1497dcSGerd Hoffmann @mkdir -p $(IMAGES_DIR) 37b1fb9a63SFam Zheng $(call quiet-command, \ 38*b0040fa1SWainer dos Santos Moschetta $(PYTHON) $< \ 39b1fb9a63SFam Zheng $(if $(V)$(DEBUG), --debug) \ 40b1fb9a63SFam Zheng --image "$@" \ 41b1fb9a63SFam Zheng --force \ 42b1fb9a63SFam Zheng --build-image $@, \ 43b1fb9a63SFam Zheng " VM-IMAGE $*") 44b1fb9a63SFam Zheng 45b1fb9a63SFam Zheng 46b1fb9a63SFam Zheng# Build in VM $(IMAGE) 47bd1497dcSGerd Hoffmannvm-build-%: $(IMAGES_DIR)/%.img 48b1fb9a63SFam Zheng $(call quiet-command, \ 49*b0040fa1SWainer dos Santos Moschetta $(PYTHON) $(SRC_PATH)/tests/vm/$* \ 50b1fb9a63SFam Zheng $(if $(V)$(DEBUG), --debug) \ 51b1fb9a63SFam Zheng $(if $(DEBUG), --interactive) \ 52b1fb9a63SFam Zheng $(if $(J),--jobs $(J)) \ 5341e3340aSPeter Maydell $(if $(V),--verbose) \ 54b1fb9a63SFam Zheng --image "$<" \ 55ddafa31fSAlex Bennée $(if $(BUILD_TARGET),--build-target $(BUILD_TARGET)) \ 56ddafa31fSAlex Bennée --build-qemu $(SRC_PATH) -- \ 57ddafa31fSAlex Bennée $(if $(TARGET_LIST),--target-list=$(TARGET_LIST)) \ 58ddafa31fSAlex Bennée $(if $(EXTRA_CONFIGURE_OPTS),$(EXTRA_CONFIGURE_OPTS)), \ 59b1fb9a63SFam Zheng " VM-BUILD $*") 60b1fb9a63SFam Zheng 61