Use a macro to make virtualbox stuff easier to manage

This commit is contained in:
K. Lange 2018-07-17 23:49:37 +09:00
parent 57b92af84c
commit 1241011833

View File

@ -263,32 +263,19 @@ efi64: image.iso
VMNAME=ToaruOS-NIH CD
.PHONY: virtualbox
virtualbox: image.iso
define virtualbox-runner =
.PHONY: $1
$1: image.iso
-VBoxManage unregistervm "$(VMNAME)" --delete
VBoxManage createvm --name "$(VMNAME)" --ostype "Other" --register
VBoxManage modifyvm "$(VMNAME)" --memory 1024 --vram 32 --audio pulse --audiocontroller ac97 --bioslogodisplaytime 1 --bioslogofadeout off --bioslogofadein off --biosbootmenu disabled
VBoxManage createvm --name "$(VMNAME)" --ostype $2 --register
VBoxManage modifyvm "$(VMNAME)" --memory 1024 --vram 32 --audio pulse --audiocontroller ac97 --bioslogodisplaytime 1 --bioslogofadeout off --bioslogofadein off --biosbootmenu disabled $3
VBoxManage storagectl "$(VMNAME)" --add ide --name "IDE"
VBoxManage storageattach "$(VMNAME)" --storagectl "IDE" --port 0 --device 0 --medium $(shell pwd)/image.iso --type dvddrive
VBoxManage storageattach "$(VMNAME)" --storagectl "IDE" --port 0 --device 0 --medium $$(shell pwd)/image.iso --type dvddrive
VBoxManage setextradata "$(VMNAME)" GUI/DefaultCloseAction PowerOff
VBoxManage startvm "$(VMNAME)" --type separate
endef
.PHONY: virtualbox-efi
virtualbox-efi: image.iso
-VBoxManage unregistervm "$(VMNAME)" --delete
VBoxManage createvm --name "$(VMNAME)" --ostype "Other" --register
VBoxManage modifyvm "$(VMNAME)" --memory 1024 --vram 32 --audio pulse --audiocontroller ac97 --bioslogodisplaytime 1 --bioslogofadeout off --bioslogofadein off --biosbootmenu disabled --firmware efi
VBoxManage storagectl "$(VMNAME)" --add ide --name "IDE"
VBoxManage storageattach "$(VMNAME)" --storagectl "IDE" --port 0 --device 0 --medium $(shell pwd)/image.iso --type dvddrive
VBoxManage setextradata "$(VMNAME)" GUI/DefaultCloseAction PowerOff
VBoxManage startvm "$(VMNAME)" --type separate
$(eval $(call virtualbox-runner,virtualbox,"Other",))
$(eval $(call virtualbox-runner,virtualbox-efi,"Other",--firmware efi))
$(eval $(call virtualbox-runner,virtualbox-efi64,"Other_64",--firmware efi))
.PHONY: virtualbox-efi64
virtualbox-efi64: image.iso
-VBoxManage unregistervm "$(VMNAME)" --delete
VBoxManage createvm --name "$(VMNAME)" --ostype "Other_64" --register
VBoxManage modifyvm "$(VMNAME)" --memory 1024 --vram 32 --audio pulse --audiocontroller ac97 --bioslogodisplaytime 1 --bioslogofadeout off --bioslogofadein off --biosbootmenu disabled --firmware efi
VBoxManage storagectl "$(VMNAME)" --add ide --name "IDE"
VBoxManage storageattach "$(VMNAME)" --storagectl "IDE" --port 0 --device 0 --medium $(shell pwd)/image.iso --type dvddrive
VBoxManage setextradata "$(VMNAME)" GUI/DefaultCloseAction PowerOff
VBoxManage startvm "$(VMNAME)" --type separate