Willem Cazander
5562fe0d7a
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 1s
81 lines
3.5 KiB
Makefile
81 lines
3.5 KiB
Makefile
|
|
MB_AUTOEXEC_BYSELF ?= true
|
|
MB_AUTOEXEC_BYSELF_MSG ?= Generated by msxbuild Makefile
|
|
MB_AUTOEXEC_TEXTMODE ?= 80
|
|
MB_AUTOEXEC_TEXTCOLOR ?= 15,0,0
|
|
MB_AUTOEXEC_VERSION ?= true
|
|
MB_AUTOEXEC_STARTUP_TIMEOUT ?= 60
|
|
MB_AUTOEXEC_STARTUP_EXITCODE ?= 124
|
|
MB_AUTOEXEC_TEST_TIMEOUT ?= 120
|
|
MB_AUTOEXEC_TEST_EXITCODE ?= 1
|
|
MB_AUTOEXEC_CMD_TIMEOUT ?= 300
|
|
MB_AUTOEXEC_CMD_EXITCODE ?= 1
|
|
|
|
define mb_autoexec_append_cmd
|
|
echo "$(2)\r" >> $(1)/autoexec.bat
|
|
endef
|
|
define mb_autoexec_append_echo
|
|
$(call mb_autoexec_append_cmd,$(1),echo $(2))
|
|
endef
|
|
define mb_autoexec_append_rem
|
|
$(call mb_autoexec_append_cmd,$(1),rem $(2))
|
|
endef
|
|
define mb_autoexec_append_gui_mode
|
|
$(call mb_autoexec_append_echo,$(1),Enabling SDL renderer.)
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl set renderer SDL > NUL)
|
|
$(call mb_autoexec_append_echo,$(1),Enabling CPU throttling.)
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl set throttle on > NUL)
|
|
endef
|
|
define mb_autoexec_append_stop_fail
|
|
$(call mb_autoexec_append_echo,$(1),Disabling automatic failure.)
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after 0)
|
|
endef
|
|
define mb_autoexec_append_exit
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl exit 0)
|
|
endef
|
|
define mb_autoexec_append_cmd_test
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_TEST_TIMEOUT) seconds failed_test $(MB_AUTOEXEC_TEST_EXITCODE))
|
|
$(call mb_autoexec_append_echo,$(1),Running test '$(2)')
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
endef
|
|
define mb_autoexec_write_default
|
|
echo -n "" > $(1)/autoexec.bat
|
|
$(if $(filter true,$(MB_AUTOEXEC_BYSELF)),$(call mb_autoexec_append_rem,$(1),$(MB_AUTOEXEC_BYSELF_MSG)))
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_STARTUP_TIMEOUT) seconds failed_autoexec $(MB_AUTOEXEC_STARTUP_EXITCODE))
|
|
$(if $(filter 40,$(MB_AUTOEXEC_TEXTMODE)),$(call mb_autoexec_append_cmd,$(1),mode 40))
|
|
$(if $(filter 40,$(MB_AUTOEXEC_TEXTMODE)),$(call mb_autoexec_append_echo,$(1),Enabled mode 40.))
|
|
$(if $(filter 80,$(MB_AUTOEXEC_TEXTMODE)),$(call mb_autoexec_append_cmd,$(1),mode 80))
|
|
$(if $(filter 80,$(MB_AUTOEXEC_TEXTMODE)),$(call mb_autoexec_append_echo,$(1),Enabled mode 80.))
|
|
$(call mb_autoexec_append_cmd,$(1),COLOR $(MB_AUTOEXEC_TEXTCOLOR))
|
|
$(if $(filter true,$(MB_AUTOEXEC_VERSION)),$(call mb_autoexec_append_cmd,$(1),ver))
|
|
endef
|
|
|
|
define mb_autoexec_open_gui
|
|
@echo === Generating autoexec.bat for command with gui
|
|
$(call mb_autoexec_write_default,$(1))
|
|
$(call mb_autoexec_append_stop_fail,$(1))
|
|
$(call mb_autoexec_append_gui_mode,$(1))
|
|
$(call mb_autoexec_append_echo,$(1),Type shutdown to stop emulation.)
|
|
endef
|
|
define mb_autoexec_open_gui_cmd
|
|
$(call mb_autoexec_open_gui,$(1))
|
|
$(call mb_autoexec_append_echo,$(1),Running command '$(2)')
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
endef
|
|
define mb_autoexec_cmd
|
|
@echo === Generating autoexec.bat for command
|
|
$(call mb_autoexec_write_default,$(1))
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_CMD_TIMEOUT) seconds failed_cmd $(MB_AUTOEXEC_CMD_EXITCODE))
|
|
$(call mb_autoexec_append_echo,$(1),Running command '$(2)')
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
$(call mb_autoexec_append_exit,$(1))
|
|
endef
|
|
define mb_autoexec_cmd_test
|
|
@echo === Generating autoexec.bat for command test
|
|
$(call mb_autoexec_write_default,$(1))
|
|
$(call mb_autoexec_append_cmd,$(1),omsxctl fail_after $(MB_AUTOEXEC_TEST_TIMEOUT) seconds failed_test $(MB_AUTOEXEC_TEST_EXITCODE))
|
|
$(call mb_autoexec_append_echo,$(1),Running test '$(2)')
|
|
$(call mb_autoexec_append_cmd,$(1),$(2))
|
|
$(call mb_autoexec_append_exit,$(1))
|
|
endef
|