msxbuild/lib/make/麥加系統擴大/mb_openmsx.mk
Willem Cazander ded142d36e
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -6s
Fixed autoexec boot and found bug in make in splitting folders.
2024-07-10 17:03:28 +02:00

118 lines
8.1 KiB
Makefile
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

MB_OPENMSX_PATH ?= /usr/bin
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_PATH,"Path where openMSX binary is located.")
MB_OPENMSX_BOOT_TIMEOUT ?= 25
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_BOOT_TIMEOUT,"Timeout in seconds to guard for boot failures.")
MB_OPENMSX_BOOT_OS ?= nextor
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_BOOT_OS,"The default OS to run$$(MB_MAKE_COMMA) valid values are; nextor$$(MB_MAKE_COMMA)msxdos1$$(MB_MAKE_COMMA)msxdos2")
MB_OPENMSX_MACHINE ?= Philips_NMS_8250
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_MACHINE,"The default MSX machine to use.",$(MB_OPENMSX_MACHINE))
MB_OPENMSX_MACHINE_RAM ?= ram1mb
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_MACHINE_RAM,"Extra ram extension for machine allowed: off$$(MB_MAKE_COMMA)ram16k$$(MB_MAKE_COMMA)ram64k$$(MB_MAKE_COMMA)ram512k$$(MB_MAKE_COMMA)ram1mb$$(MB_MAKE_COMMA)ram2mb$$(MB_MAKE_COMMA)ram4mb")
MB_OPENMSX_SPEED ?= $(if $(findstring turboR,$(MB_OPENMSX_MACHINE)),100,333)
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_SPEED,"The throttled MSX emulation speed.")
MB_OPENMSX_ARGS ?=
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_ARGS,"Extra arguments to invoke openMSX with.")
MB_OPENMSX_HDD_SIZE ?= 4m
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_HDD_SIZE,"The default fire-hdd disk image size.")
MB_OPENMSX_SCALE_FACTOR ?= 3
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_SCALE_FACTOR,"The gui scale factor to display the emulation.")
MB_OPENMSX_THROTTLE ?= off
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_THROTTLE,"An on/off flag to control throttling globally.")
MB_OPENMSX_HEADLESS ?= on
$(call mb_make_call,mb_doc_variable,MB_OPENMSX_HEADLESS,"Controls if openMSX starts headless.")
MB_OPENMSX_RENDERER ?= SDLGL-PP
$(call mb_make_call,mb_doc_variable_deep,MB_OPENMSX_RENDERER,"The gui renderer used to display the window head with.")
MB_OPENMSX_STDOUT_IGNORE ?= off
$(call mb_make_call,mb_doc_variable_deep,MB_OPENMSX_STDOUT_IGNORE,"Kills logging...rm after issues openMSX are solved.")
MB_OPENMSX_STDERR_IGNORE ?= off
$(call mb_make_call,mb_doc_variable_deep,MB_OPENMSX_STDERR_IGNORE,"Kills logging...rm after issues openMSX are solved.")
define mb_openmsx_setup
$(MB__    )$(if $(wildcard $(1)-omsx),,$(call mb_make_call,mb_os_dir_create,$(1)-omsx))
$(MB__    )$(if $(wildcard $(1)-omsx/stdio.xml),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/stdio.xml,$(1)-omsx))
$(MB__    )$(if $(wildcard $(1)-omsx/share),,$(call mb_make_call,mb_os_dir_create,$(1)-omsx/share))
$(MB__    )$(if $(wildcard $(1)-omsx/share/settings.xml),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/settings.xml,$(1)-omsx/share))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts),,$(call mb_make_call,mb_os_dir_create,$(1)-omsx/share/scripts))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts/boot_exec.tcl),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/scripts/boot_exec.tcl,$(1)-omsx/share/scripts))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts/fail_after.tcl),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/scripts/fail_after.tcl,$(1)-omsx/share/scripts))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts/fire_hdd.tcl),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/scripts/fire_hdd.tcl,$(1)-omsx/share/scripts))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts/headless.tcl),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/scripts/headless.tcl,$(1)-omsx/share/scripts))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts/night_flight.tcl),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/scripts/night_flight.tcl,$(1)-omsx/share/scripts))
$(MB__    )$(if $(wildcard $(1)-omsx/share/scripts/omsxctl.tcl),,$(call mb_msxhub_file,$(1)-omsx/share/scripts,OMSXCTL/1.0-1/get/OMSXCTL/omsxctl.tcl))
$(MB__    )$(if $(wildcard $(1)-omsx/share/extensions),,$(call mb_make_call,mb_os_dir_create,$(1)-omsx/share/extensions))
$(MB__    )$(if $(wildcard $(1)-omsx/share/extensions/fire-hdd.xml),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/openmsx/share/extensions/fire-hdd.xml,$(1)-omsx/share/extensions))
$(MB__    )$(call mb_make_call,mb_msxrom_setup,$(1))
$(MB__    )$(call mb_make_call,mb_msxrom_extension_ide_nextor,$(1))
$(MB__    )$(call mb_make_call,mb_msxrom_machine_$(2),$(1))
endef
$(call mb_make_call,mb_doc_function_deep,mb_openmsx_setup,"Setup openMSX local build home folder for machine.","<dir> <machine>")
define _mb_openmsx_run
$(MB__    )$(call mb_make_call,mb_os_echo_command,$(MB_I18N_OPENMSX_STARTUP) $@ - $(2))
$(MB__    )$(if $(wildcard $(1)-omsx/persistent/fire-hdd/untitled1/sync),,$(call mb_make_call,mb_os_dir_create,$(1)-omsx/persistent/fire-hdd/untitled1/sync))
$(MB__    )BOOT_WATCHDOG=$(MB_OPENMSX_BOOT_TIMEOUT) \
$(MB__    )FIRE_HDD_PATH="$(1)" \
$(MB__    )FIRE_HDD_SIZE=$(MB_OPENMSX_HDD_SIZE) \
$(MB__    )FIRE_HDD_IMAGE="$(1)-omsx/persistent/fire-hdd/untitled1/image-hda.dsk" \
$(MB__    )FIRE_HDD_PATH_EXPORT="$(1)-omsx/persistent/fire-hdd/untitled1/sync" \
$(MB__    )SCALE_FACTOR=$(MB_OPENMSX_SCALE_FACTOR) \
$(MB__    )SPEED=$(MB_OPENMSX_SPEED) \
$(MB__    )HEADLESS=$(MB_OPENMSX_HEADLESS) \
$(MB__    )RENDERER=$(MB_OPENMSX_RENDERER) \
$(MB__    )THROTTLE=$(MB_OPENMSX_THROTTLE) \
$(MB__    )NF_PREFIX=$(MB_FLIGHT_PREFIX) \
$(MB__    )NF_SEPERATOR=$(MB_FLIGHT_SEPERATOR) \
$(MB__    )NF_RECORD_FLAG=$(MB_FLIGHT_RECORD_FLAG) \
$(MB__    )OPENMSX_HOME="$(1)-omsx" \
$(MB__    )$(MB_OPENMSX_PATH)/openmsx \
$(MB__        )-machine $(2) \
$(MB__        )-ext slotexpander \
$(MB__        )-ext fire-hdd \
$(MB__        )$(if $(filter ram16k,$(3)),-ext ram16k) \
$(MB__        )$(if $(filter ram64k,$(3)),-ext ram64k) \
$(MB__        )$(if $(filter ram512k,$(3)),-ext ram512k) \
$(MB__        )$(if $(filter ram1mb,$(3)),-ext ram1mb) \
$(MB__        )$(if $(filter ram4mb,$(3)),-ext ram2mb) \
$(MB__        )$(if $(filter ram4mb,$(3)),-ext ram4mb) \
$(MB__        )$(MB_OPENMSX_ARGS) \
$(MB__        )-control stdio < $(1)-omsx/stdio.xml \
$(MB__        )$(if $(filter on,$(MB_OPENMSX_STDOUT_IGNORE)),$(MB_OS_STDOUT_IGNORE)) \
$(MB__        )$(if $(filter on,$(MB_OPENMSX_STDERR_IGNORE)),$(MB_OS_STDERR_IGNORE))
$(MB__    )rsync --checksum --recursive "$(1)-omsx/persistent/fire-hdd/untitled1/sync/" "$(1)/"
endef
define _mb_openmsx_dosctl_bat
$(MB__    )$(if $(wildcard $(1)/z80.bat),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/emuctl/z80.bat,$(1)))
$(MB__    )$(if $(wildcard $(1)/reboot.bat),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/emuctl/reboot.bat,$(1)))
$(MB__    )$(if $(wildcard $(1)/shutdown.bat),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/emuctl/shutdown.bat,$(1)))
$(MB__    )$(if $(wildcard $(1)/mbboot80.com),,$(call mb_make_call,mb_os_file_copy,$(MB__BASEPATH_REAL)/lib/emuctl/mbboot80.com,$(1)))
$(MB__    )$(if $(wildcard $(1)/omsxctl.com),,$(call mb_make_call,mb_msxhub_file,$(1),OMSXCTL/1.0-1/get/OMSXCTL/omsxctl.com))
endef
define mb_openmsx_dosctl
$(MB__    )$(call mb_make_call,mb_openmsx_setup,$(1),$(if $(2),$(2),$(MB_OPENMSX_MACHINE)))
$(MB__    )$(if $(wildcard $(1)/utils),$(call mb_make_call,_mb_openmsx_dosctl_bat,$(1)/utils),$(call mb_make_call,_mb_openmsx_dosctl_bat,$(1)))
$(MB__    )$(if $(wildcard $(1)/command.com),,$(if $(wildcard $(1)/command2.com),,$(call mb_make_call,mb_msxhub_get_$(MB_OPENMSX_BOOT_OS)_boot,$(1))))
$(MB__    )$(call mb_make_call,_mb_openmsx_run,$(1),$(if $(2),$(2),$(MB_OPENMSX_MACHINE)),$(if $(3),$(3),$(MB_OPENMSX_MACHINE_RAM)))
endef
$(call mb_make_call,mb_doc_function,mb_openmsx_dosctl,"Starts openMSX with dos controller.","<dir> [machine] [mem-ext]")