Move native os command to own file.
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 0s

This commit is contained in:
Willem Cazander 2024-07-06 00:11:54 +02:00
parent 9a545d3c3a
commit f36aae1917
9 changed files with 55 additions and 38 deletions

View file

@ -12,7 +12,8 @@ endif
PATH_BIN := bin PATH_BIN := bin
PATH_SRC := src PATH_SRC := src
include lib/make/msxbuild.mk PATH_MSXBUILD ?= .
include $(PATH_MSXBUILD)/lib/make/msxbuild.mk
$(eval $(call mb_make_call,mb_doc_flow_help)) $(eval $(call mb_make_call,mb_doc_flow_help))
$(eval $(call mb_make_call,mb_make_flow_0module,$(PATH_SRC))) $(eval $(call mb_make_call,mb_make_flow_0module,$(PATH_SRC)))

View file

@ -52,7 +52,7 @@ MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_DOC_FOR
define _mb_doc_variable_txt define _mb_doc_variable_txt
"* "$(2)=$(subst \\n,\\\n,$(4))\\n$(if $(3),\\t$(3)\\n)\\n "* "$(2)=$(subst \\n,\\\n,$(subst >,\>,$(4)))\\n$(if $(3),\\t$(3)\\n)\\n
endef endef
define _mb_doc_variable_xml define _mb_doc_variable_xml
\\n\\t$(call mb_make_xml_open,variable,$(MB_DOC_XML_ATTR_NAME),$(2),$(MB_DOC_XML_ATTR_LEVEL),$(1))\\n\\t\\t$(call mb_make_xml_tag_value,$(MB_DOC_XML_TAG_VALUE),$(4))\\n\\t\\t$(call mb_make_xml_tag_value,$(MB_DOC_XML_TAG_DESC),$(3))\\n\\t$(call mb_make_xml_close,variable) \\n\\t$(call mb_make_xml_open,variable,$(MB_DOC_XML_ATTR_NAME),$(2),$(MB_DOC_XML_ATTR_LEVEL),$(1))\\n\\t\\t$(call mb_make_xml_tag_value,$(MB_DOC_XML_TAG_VALUE),$(4))\\n\\t\\t$(call mb_make_xml_tag_value,$(MB_DOC_XML_TAG_DESC),$(3))\\n\\t$(call mb_make_xml_close,variable)

View file

@ -19,9 +19,9 @@ MB_DOC_FIRE_VARIABLE += $(call mb_make_call,mb_doc_variable,MB_FLIGHT_VIDEO_NAME
define mb_flight_video_merge define mb_flight_video_merge
@echo === Indexing flight videos $(call mb_make_call,mb_make_echo_good,Indexing flight videos)
ls -1tr $(1)/*-omsx/videos/*.avi | awk -F "$(1)/" -v s="file '" -v e="'" '{print s$$2e}' > $(1)/$(MB_FLIGHT_VIDEO_NAME).lst ls -1tr $(1)/*-omsx/videos/*.avi | awk -F "$(1)/" -v s="file '" -v e="'" '{print s$$2e}' > $(1)/$(MB_FLIGHT_VIDEO_NAME).lst
ffmpeg -v quiet -y -f concat -i $(1)/$(MB_FLIGHT_VIDEO_NAME).lst -c copy $(1)/$(MB_FLIGHT_VIDEO_NAME).avi ffmpeg -v quiet -y -f concat -i $(1)/$(MB_FLIGHT_VIDEO_NAME).lst -c copy $(1)/$(MB_FLIGHT_VIDEO_NAME).avi
@echo === Flight video completed $(call mb_make_call,mb_make_echo_good,Flight video completed)
endef endef
MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_flight_video_merge,"Merged all flight videos to one.","<dir>") MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_flight_video_merge,"Merged all flight videos to one.","<dir>")

View file

@ -79,13 +79,13 @@ MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,mb_doc_function_deep,mb_make_xm
define mb_make_echo_good define mb_make_echo_good
$(if $(filter -1,$(MB_COLORS)),@echo $(MB_MAKE_ECHO_CRAYON) $(1),/usr/bin/echo -e "\x1B[32m$(MB_MAKE_ECHO_CRAYON)$$1\x1B[39m $(1)") $(if $(filter -1,$(MB_OS_COLORS)),@echo $(MB_MAKE_ECHO_CRAYON) $(1),/usr/bin/echo -e "\x1B[32m$(MB_MAKE_ECHO_CRAYON)$$1\x1B[39m $(1)")
endef endef
MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,mb_doc_function_deep,mb_make_echo_good,"Echo's an message to stdout with 'green' crayon.","<message>") MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,mb_doc_function_deep,mb_make_echo_good,"Echo's an message to stdout with 'green' crayon.","<message>")
define mb_make_echo_fail define mb_make_echo_fail
$(if $(filter -1,$(MB_COLORS)),@echo $(MB_MAKE_ECHO_CRAYON) $(1),/usr/bin/echo -e "\x1B[31m$(MB_MAKE_ECHO_CRAYON)$$1\x1B[39m $(1)") $(if $(filter -1,$(MB_OS_COLORS)),@echo $(MB_MAKE_ECHO_CRAYON) $(1),/usr/bin/echo -e "\x1B[31m$(MB_MAKE_ECHO_CRAYON)$$1\x1B[39m $(1)")
endef endef
MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,mb_doc_function_deep,mb_make_echo_fail,"Echo's an message to stdout with 'red' crayon.","<message>") MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,mb_doc_function_deep,mb_make_echo_fail,"Echo's an message to stdout with 'red' crayon.","<message>")

View file

@ -2,7 +2,7 @@
MB_MSXHUB_API ?= https://msxhub.com/api MB_MSXHUB_API ?= https://msxhub.com/api
MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXHUB_API,"Resource identifier for msxhub package rest api.") MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXHUB_API,"Resource identifier for msxhub package rest api.")
MB_MSXHUB_CACHE ?= $(MB_CACHE)/msxbuild/msxhub MB_MSXHUB_CACHE ?= $(MB_OS_CACHE)/msxbuild/msxhub
MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXHUB_CACHE,"Cache storage location.") MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXHUB_CACHE,"Cache storage location.")

View file

@ -3,7 +3,7 @@
MB_MSXROM_API ?= https://msxrom.distributedrebirth.love/calc-pi/v19.1 MB_MSXROM_API ?= https://msxrom.distributedrebirth.love/calc-pi/v19.1
MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXROM_API,"Resource identifier for msxrom pi pie named slices data.") MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXROM_API,"Resource identifier for msxrom pi pie named slices data.")
MB_MSXROM_CACHE ?= $(MB_CACHE)/msxbuild/msxrom MB_MSXROM_CACHE ?= $(MB_OS_CACHE)/msxbuild/msxrom
MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXROM_CACHE,"Cache storage location.") MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,MB_MSXROM_CACHE,"Cache storage location.")

View file

@ -53,6 +53,7 @@ define mb_openmsx_setup
endef endef
MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,mb_doc_function_deep,mb_openmsx_setup,"Setup openMSX local build home folder for machine.","<dir> <machine>") MB_DOC_FIRE_FUNCTION_DEEP += $(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 define _mb_openmsx_run
$(call mb_make_call,mb_make_echo_good,Start openMSX! for $@ on $(2)) $(call mb_make_call,mb_make_echo_good,Start openMSX! for $@ on $(2))
$(if $(wildcard $(1)-omsx/persistent/fire-hdd/untitled1/sync),,$(call mb_make_call,mb_mkdir,$(1)-omsx/persistent/fire-hdd/untitled1/sync)) $(if $(wildcard $(1)-omsx/persistent/fire-hdd/untitled1/sync),,$(call mb_make_call,mb_mkdir,$(1)-omsx/persistent/fire-hdd/untitled1/sync))

32
lib/make/mb_os.mk Normal file
View file

@ -0,0 +1,32 @@
# OS cmds
ifeq ($(OS),Windows_NT)
MB_OS_RM = del /F /Q
MB_OS_RMDIR = RMDIR /S /Q
MB_OS_MKDIR = mkdir
MB_OS_COPY = copy
MB_OS_ERRIGNORE = 2>NUL || true
MB_OS_SEP = "\"
MB_OS_CACHE ?= %LOCALAPPDATA%
MB_OS_COLORS ?= -1
else
MB_OS_RM = rm -f
MB_OS_RMDIR = rm -rf
MB_OS_MKDIR = mkdir -p
MB_OS_COPY = cp
MB_OS_ERRIGNORE = 2>/dev/null
MB_OS_SEP = "/"
MB_OS_CACHE ?= ~/.cache
MB_OS_COLORS ?= $(shell tput colors 2> /dev/null;test $$? -eq 0 || echo "-1")
endif
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_RM,"Native OS delete command.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_RMDIR,"Native OS remove folder command.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_MKDIR,"Native OS create folder command.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_COPY,"Native OS copy command.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_ERRIGNORE,"Native OS error to ignore redirect.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_SEP,"Native OS path seperator.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_CACHE,"Native OS application cache folder.")
MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,MB_OS_COLORS,"Native OS terminal color count support.")

View file

@ -18,53 +18,36 @@ include $(PATH_MSXBUILD)/lib/make/mb_msxhub.mk
include $(PATH_MSXBUILD)/lib/make/mb_msxpipe.mk include $(PATH_MSXBUILD)/lib/make/mb_msxpipe.mk
include $(PATH_MSXBUILD)/lib/make/mb_openmsx.mk include $(PATH_MSXBUILD)/lib/make/mb_openmsx.mk
include $(PATH_MSXBUILD)/lib/make/mb_autoexec.mk include $(PATH_MSXBUILD)/lib/make/mb_autoexec.mk
include $(PATH_MSXBUILD)/lib/make/mb_os.mk
# OS cmds # Below mb_doc.mk for white space...
ifeq ($(OS),Windows_NT) MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,PATH_SDCC,"Path where SDCC binaries are located.")
MB_RM = del /F /Q MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,PATH_OPENMSX,"Path where openMSX binary is located.")
MB_RMDIR = RMDIR /S /Q MB_DOC_FIRE_VARIABLE_DEEP += $(call mb_make_call,mb_doc_variable_deep,PATH_MSXBUILD,"Path where msxbuild lib folder is located.")
MB_MKDIR = mkdir MB_DOC_FIRE_VARIABLE_ROCK += $(call mb_make_call,mb_doc_variable_rock,PATH_MSXBUILD_REAL,"Resolved real path of msxbuild.")
MB_COPY = copy
MB_ERRIGNORE = 2>NUL || true
MB_SEP=\\
MB_CACHE ?= %LOCALAPPDATA%
MB_COLORS ?= -1
else
MB_RM = rm -f
MB_RMDIR = rm -rf
MB_MKDIR = mkdir -p
MB_COPY = cp
MB_ERRIGNORE = 2>/dev/null
MB_SEP=/
MB_CACHE ?= ~/.cache
MB_COLORS ?= $(shell tput colors 2> /dev/null;test $$? -eq 0 || echo "-1")
endif
# Remove space after separator
MB_PSEP = $(strip $(MB_SEP))
define mb_clean define mb_clean
$(call mb_make_call,mb_make_echo_good,Cleaning build folder $(1)) $(call mb_make_call,mb_make_echo_good,Cleaning build folder $(1))
$(MB_RMDIR) $(1) $(MB_OS_RMDIR) $(1)
endef endef
MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_clean,"Removed the full folder.","<dir>") MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_clean,"Removed the full folder.","<dir>")
define mb_mkdir define mb_mkdir
$(MB_MKDIR) $(1) $(MB_OS_MKDIR) $(1)
endef endef
MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_mkdir,"Creates an folder.","<dir>") MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_mkdir,"Creates an folder.","<dir>")
define mb_delete define mb_delete
$(MB_RM) $(1) $(MB_OS_RM) $(1)
endef endef
MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_delete,"Deletes an file.","<file>") MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_delete,"Deletes an file.","<file>")
define mb_copy define mb_copy
$(MB_COPY) $(1) $(2) $(MB_OS_COPY) $(1) $(2)
endef endef
MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_copy,"Copy an file.","<in> <out>") MB_DOC_FIRE_FUNCTION += $(call mb_make_call,mb_doc_function,mb_copy,"Copy an file.","<in> <out>")