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