Moved all eval over own function for argument validation.
All checks were successful
Run test asserts / Test-Asserts (push) Successful in -2s

This commit is contained in:
Willem Cazander 2024-07-07 23:26:47 +02:00
parent 183b0908aa
commit 8a07c9de8d
11 changed files with 78 additions and 42 deletions

View file

@ -100,11 +100,10 @@ endif
# Generate project flow # Generate project flow
include $(PATH_MSXBUILD)/lib/make/msxbuild.mk include $(PATH_MSXBUILD)/lib/make/msxbuild.mk
$(call mb_make_call_eval,mb_doc_flow_help,MSXBUILD-Example) $(call mb_make_call,mb_doc_flow_help,MSXBUILD-Example)
$(call mb_make_call_eval,mb_make_flow_0module,$(PATH_SRC)) $(call mb_make_call,mb_make_flow_0module,$(PATH_SRC))
$(call mb_make_call_eval,mb_proj_flow_setup,$(PATH_BIN)) $(call mb_make_call,mb_proj_flow_setup,$(PATH_BIN))
$(call mb_make_call_eval,mb_flight_proj_flow_video,$(PATH_BIN)) $(call mb_make_call,mb_flight_proj_flow_video,$(PATH_BIN))
# Add japanese support # Add japanese support
ifdef LANG_JP ifdef LANG_JP
@ -115,6 +114,6 @@ MB_PROJ_STEP_AFTER_PREFIX = "フェーズ後 "
MB_PROJ_STEP_DONE_PREFIX = "プライムパイターゲットの実行を終了しました " MB_PROJ_STEP_DONE_PREFIX = "プライムパイターゲットの実行を終了しました "
MB_OPENMSX_LOG_PREFIX = "オープンメッカシステム拡張を開始しましょう!のために" MB_OPENMSX_LOG_PREFIX = "オープンメッカシステム拡張を開始しましょう!のために"
MB_AUTOEXEC_LOG_PREFIX = "自動実行の書き込み" MB_AUTOEXEC_LOG_PREFIX = "自動実行の書き込み"
$(call mb_make_call_eval,mb_proj_flow_setup_jp) $(call mb_make_call,mb_proj_flow_setup_jp)
endif endif

View file

@ -148,11 +148,9 @@ When you want to see whats happening do a debug run;
* Add function `call_real` which exits on undefined call argument * Add function `call_real` which exits on undefined call argument
* Add -e option to make internal echo command for escaped sequences * Add -e option to make internal echo command for escaped sequences
* Add native OS functions for `os_copy,os_rmfile,rmdir,mkdir,touch,delfile,deldir` * Add native OS functions for `os_copy,os_rmfile,rmdir,mkdir,touch,delfile,deldir`
* Add string str_lenght function * Add string letters function
* Add string str_is_ascii function (death with unicode) * Add string isascii function (death with unicode)
* Add str_lowercase and str_uppercase functions (full 21bit unicode support) * Add lowercase and uppercase functions (full 21bit unicode support)
* Add `call_eval` fail on undefined argument and puts result in eval to parse flow rules
* Add `define_eval` which reverses dollar escaping so write $$(1) for $(1) and other are like normal
* Add XML output for help system for integration with IDE's * Add XML output for help system for integration with IDE's
* Add rwildcard for deeper searches * Add rwildcard for deeper searches
* Add namespace support for variables/functions/targets like: moduleX::bin/prog.o: moduleX::src/prog.c * Add namespace support for variables/functions/targets like: moduleX::bin/prog.o: moduleX::src/prog.c

View file

@ -1,5 +1,5 @@
define mb_assert_flow_grep_binary define __mb_assert_flow_grep_binary
$(1)/@assert-$(2): $(1)/@build $(1)/@assert-$(2): $(1)/@build
grep -q -U $(4) $(1)/$(3) grep -q -U $(4) $(1)/$(3)
$$(call mb_make_call,mb_make_echo_assert,Assert succesfully @assert-$(2)) $$(call mb_make_call,mb_make_echo_assert,Assert succesfully @assert-$(2))
@ -7,10 +7,17 @@ $$(call mb_make_call,mb_doc_target,$(1)/@assert-$(2),"Asserts that $(3) output m
MB_PROJ_PHASE_TEST_DEPS += $(1)/@assert-$(2) MB_PROJ_PHASE_TEST_DEPS += $(1)/@assert-$(2)
.PHONY: $(1)/@assert-$(2) .PHONY: $(1)/@assert-$(2)
endef endef
define mb_assert_flow_grep_binary
$(if $(1),,$(error Argument 1 missing))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(if $(4),,$(error Argument 4 missing))
$(eval $(call mb_make_call,__mb_assert_flow_grep_binary,$(1),$(2),$(3),$(4)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_assert_flow_grep_binary,"Prints flow of single binary grep assert.","<build-dir> <test-id> <file> <grep-match>") $(call mb_make_call,mb_doc_function_flow,mb_assert_flow_grep_binary,"Prints flow of single binary grep assert.","<build-dir> <test-id> <file> <grep-match>")
#$$(call mb_delete,$(1)/$(3).out) #$$(call mb_delete,$(1)/$(3).out)
define mb_assert_flow_bdos_grep define __mb_assert_flow_bdos_grep
$(1)-test-$(2)/@assert: $(1)/@build $(1)-test-$(2)/@assert: $(1)/@build
$$(call mb_make_call,mb_os_dir_create,$(1)-test-$(2)) $$(call mb_make_call,mb_os_dir_create,$(1)-test-$(2))
$$(call mb_make_call,mb_os_file_copy,$(1)/$(3).com,$(1)-test-$(2)) $$(call mb_make_call,mb_os_file_copy,$(1)/$(3).com,$(1)-test-$(2))
@ -21,4 +28,11 @@ $$(call mb_make_call,mb_doc_target,$(1)-test-$(2)/@assert,"Asserts that $(3) out
MB_PROJ_PHASE_TEST_DEPS += $(1)-test-$(2)/@assert MB_PROJ_PHASE_TEST_DEPS += $(1)-test-$(2)/@assert
.PHONY: $(1)-test-$(2)/@assert .PHONY: $(1)-test-$(2)/@assert
endef endef
define mb_assert_flow_bdos_grep
$(if $(1),,$(error mb_assert_flow_bdos_grep: Argument 1 missing))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(if $(4),,$(error Argument 4 missing))
$(eval $(call mb_make_call,__mb_assert_flow_bdos_grep,$(1),$(2),$(3),$(4)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_assert_flow_bdos_grep,"Prints flow of single grep assert.","<build-dir> <test-id> <cmd-name> <grep-match>") $(call mb_make_call,mb_doc_function_flow,mb_assert_flow_bdos_grep,"Prints flow of single grep assert.","<build-dir> <test-id> <cmd-name> <grep-match>")

View file

@ -137,7 +137,7 @@ endef
MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,_mb_doc_function4u_deep,mb_doc_target_run,"Prints formatted documention of an run target.","<name> [desc]") MB_DOC_FIRE_FUNCTION_DEEP += $(call mb_make_call,_mb_doc_function4u_deep,mb_doc_target_run,"Prints formatted documention of an run target.","<name> [desc]")
define mb_doc_flow_help define __mb_doc_flow_help
@help: @help:
$$(if $$(filter txt,$$(MB_DOC_FORMAT)),@echo "Welcome to the $$(if $(1),$(1),MSXBUILD) help system.\\n\\nFor detailed fire help use one of the following targets;\\n") $$(if $$(filter txt,$$(MB_DOC_FORMAT)),@echo "Welcome to the $$(if $(1),$(1),MSXBUILD) help system.\\n\\nFor detailed fire help use one of the following targets;\\n")
$$(if $$(filter xml,$$(MB_DOC_FORMAT)),@echo $$(call mb_make_xml_open,$$(MB_DOC_XML_ROOT))) $$(if $$(filter xml,$$(MB_DOC_FORMAT)),@echo $$(call mb_make_xml_open,$$(MB_DOC_XML_ROOT)))
@ -272,5 +272,9 @@ $$(call mb_make_call,mb_doc_target_help,@help-all,"Lists all documented informat
$$(call mb_make_call,mb_doc_target_help,@help-firemake,"Output all documention in XML for IDE integration.") $$(call mb_make_call,mb_doc_target_help,@help-firemake,"Output all documention in XML for IDE integration.")
.PHONY: @help-firemake .PHONY: @help-firemake
endef endef
define mb_doc_flow_help
$(if $(1),,$(error $(1) missing))
$(eval $(call mb_make_call,__mb_doc_flow_help,$(1)))
endef
MB_DOC_FIRE_FUNCTION_FLOW += $(call mb_make_call,_mb_doc_function4u_flow,mb_doc_flow_help,"Prints flow of fire help target.","[project-name]") MB_DOC_FIRE_FUNCTION_FLOW += $(call mb_make_call,_mb_doc_function4u_flow,mb_doc_flow_help,"Prints flow of fire help target.","[project-name]")

View file

@ -27,7 +27,7 @@ endef
$(call mb_make_call,mb_doc_function,mb_flight_video_merge,"Merged all flight videos to one.","<dir>") $(call mb_make_call,mb_doc_function,mb_flight_video_merge,"Merged all flight videos to one.","<dir>")
define mb_flight_proj_flow_video define __mb_flight_proj_flow_video
@@flight-video-build: @build @@flight-video-build: @build
$$(if $$(filter on,$$(MB_FLIGHT_VIDEO)),$$(call mb_make_call,mb_flight_video_merge,$(1))) $$(if $$(filter on,$$(MB_FLIGHT_VIDEO)),$$(call mb_make_call,mb_flight_video_merge,$(1)))
@ -63,5 +63,9 @@ $$(call mb_make_call,mb_doc_target_help,@flight-video-test,"Runs @clean and @tes
$$(call mb_make_call,mb_doc_target_help,@flight-video-package-qa,"Runs @clean and @package-qa with recorder and merges flight videos to one.") $$(call mb_make_call,mb_doc_target_help,@flight-video-package-qa,"Runs @clean and @package-qa with recorder and merges flight videos to one.")
.PHONY: @flight-video-package-qa .PHONY: @flight-video-package-qa
endef endef
define mb_flight_proj_flow_video
$(if $(1),,$(error $(1) missing))
$(eval $(call mb_make_call,__mb_flight_proj_flow_video,$(1)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_flight_proj_flow_video,"Prints flow for adding flight video targets in project build cycle.","<path-bin>") $(call mb_make_call,mb_doc_function_flow,mb_flight_proj_flow_video,"Prints flow for adding flight video targets in project build cycle.","<path-bin>")

View file

@ -54,12 +54,6 @@ endef
$(call mb_make_call,mb_doc_function_deep,mb_make_call,"Checked origin call function wrapper.","<function> [args...]") $(call mb_make_call,mb_doc_function_deep,mb_make_call,"Checked origin call function wrapper.","<function> [args...]")
define mb_make_call_eval
$(eval $(call mb_make_call,$(1),$(2),$(3),$(4),$(5),$(6),$(7),$(8),$(9)))
endef
$(call mb_make_call,mb_doc_function_deep,mb_make_call_eval,"Eval and origin checked flow injector.","<function> [args...]")
define mb_make_lowercase define mb_make_lowercase
$(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(1))))))))))))))))))))))))))) $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$(1)))))))))))))))))))))))))))
endef endef
@ -96,9 +90,13 @@ endef
$(call mb_make_call,mb_doc_function_deep,mb_make_xml_tag_value,"Print xml tag with value inside.","<tag> [value]") $(call mb_make_call,mb_doc_function_deep,mb_make_xml_tag_value,"Print xml tag with value inside.","<tag> [value]")
define mb_make_flow_0module define __mb_make_flow_0module
include $$(call mb_make_call,mb_make_rwildcard,$(1),*/0module.mk) include $$(call mb_make_call,mb_make_rwildcard,$(1),*/0module.mk)
endef endef
define mb_make_flow_0module
$(if $(1),,$(error $(1) missing))
$(eval $(call mb_make_call,__mb_make_flow_0module,$(1)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_make_flow_0module,"Prints flow of recursive 0module.mk include.","<dir>") $(call mb_make_call,mb_doc_function_flow,mb_make_flow_0module,"Prints flow of recursive 0module.mk include.","<dir>")

View file

@ -80,7 +80,7 @@ endef
define mb_proj_flow_setup define __mb_proj_flow_setup
@@clean: @@clean:
$$(call mb_make_call,_mb_proj_flow_step_before) $$(call mb_make_call,_mb_proj_flow_step_before)
.PHONY: @@clean .PHONY: @@clean
@ -188,14 +188,18 @@ $$(call mb_make_call,mb_doc_target_help,@package-qa,"Run all packages QA of proj
@package-deploy: @@package-deploy $$(MB_PROJ_PHASE_PACKAGE_DEPLOY_DEPS) @package-deploy: @@package-deploy $$(MB_PROJ_PHASE_PACKAGE_DEPLOY_DEPS)
$$(call mb_make_call,_mb_proj_flow_step_done) $$(call mb_make_call,__mb_proj_flow_step_done)
$$(call mb_make_call,mb_doc_target_help,@package-deploy,"Deploy all the packages.") $$(call mb_make_call,mb_doc_target_help,@package-deploy,"Deploy all the packages.")
.PHONY: @package-deploy .PHONY: @package-deploy
endef endef
define mb_proj_flow_setup
$(if $(1),,$(error $(1) missing))
$(eval $(call mb_make_call,__mb_proj_flow_setup,$(1)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_proj_flow_setup,"Prints flow of abstract project build cycle.","<build-dirs>") $(call mb_make_call,mb_doc_function_flow,mb_proj_flow_setup,"Prints flow of abstract project build cycle.","<build-dirs>")
define mb_proj_flow_setup_jp define __mb_proj_flow_setup_jp
@クリーン: @clean @クリーン: @clean
$$(call mb_make_call,_mb_proj_flow_step_done) $$(call mb_make_call,_mb_proj_flow_step_done)
$$(call mb_make_call,mb_doc_target_help,@,"プロジェクトのビルドフォルダーをクリーンアップします。") $$(call mb_make_call,mb_doc_target_help,@,"プロジェクトのビルドフォルダーをクリーンアップします。")
@ -246,5 +250,8 @@ $$(call mb_make_call,mb_doc_target_help,@パッケージの品質保証,"すべ
$$(call mb_make_call,mb_doc_target_help,@,"パッケージをデプロイします。") $$(call mb_make_call,mb_doc_target_help,@,"パッケージをデプロイします。")
.PHONY: @パッケージのデプロイ .PHONY: @パッケージのデプロイ
endef endef
define mb_proj_flow_setup_jp
$(eval $(call mb_make_call,__mb_proj_flow_setup_jp))
endef
$(call mb_make_call,mb_doc_function_flow,mb_proj_flow_setup_jp,"Prints flow for japanese wrapper of project build cycle.") $(call mb_make_call,mb_doc_function_flow,mb_proj_flow_setup_jp,"Prints flow for japanese wrapper of project build cycle.")

View file

@ -1,5 +1,5 @@
define mb_tool_m80_flow_bdos_mono define __mb_tool_m80_flow_bdos_mono
$(1): | @init $(1): | @init
$$(call mb_make_call,mb_os_dir_create,$(1)) $$(call mb_make_call,mb_os_dir_create,$(1))
$$(call mb_make_call,mb_os_dir_create,$(1)/utils) $$(call mb_make_call,mb_os_dir_create,$(1)/utils)
@ -43,10 +43,16 @@ $(1)/@run: $(1)/@build
$$(call mb_make_call,mb_doc_target_run,$(1)/@run,"Run $(3).com manually with gui.") $$(call mb_make_call,mb_doc_target_run,$(1)/@run,"Run $(3).com manually with gui.")
.PHONY: $(1)/@run .PHONY: $(1)/@run
endef endef
define mb_tool_m80_flow_bdos_mono
$(if $(1),,$(error Argument 1 missing))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(eval $(call mb_make_call,__mb_tool_m80_flow_bdos_mono,$(1),$(2),$(3)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_tool_m80_flow_bdos_mono,"Prints flow of m80 toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>") $(call mb_make_call,mb_doc_function_flow,mb_tool_m80_flow_bdos_mono,"Prints flow of m80 toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>")
define mb_tool_sdcc_flow_bdos_mono define __mb_tool_sdcc_flow_bdos_mono
$(1): | @init $(1): | @init
$$(call mb_make_call,mb_os_dir_create,$(1)) $$(call mb_make_call,mb_os_dir_create,$(1))
$$(call mb_make_call,mb_doc_target_deep,$(1)) $$(call mb_make_call,mb_doc_target_deep,$(1))
@ -81,5 +87,11 @@ $(1)/@run: $(1)/@build
$$(call mb_make_call,mb_doc_target_run,$(1)/@run,"Run $(3).com manually with gui.") $$(call mb_make_call,mb_doc_target_run,$(1)/@run,"Run $(3).com manually with gui.")
.PHONY: $(1)/@run .PHONY: $(1)/@run
endef endef
define mb_tool_sdcc_flow_bdos_mono
$(if $(1),,$(error Argument 1 missing))
$(if $(2),,$(error Argument 2 missing))
$(if $(3),,$(error Argument 3 missing))
$(eval $(call mb_make_call,__mb_tool_sdcc_flow_bdos_mono,$(1),$(2),$(3)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_tool_sdcc_flow_bdos_mono,"Prints flow of sdcc toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>") $(call mb_make_call,mb_doc_function_flow,mb_tool_sdcc_flow_bdos_mono,"Prints flow of sdcc toolchain bdos mono file module.","<bin-dir> <src-dir> <objname>")

View file

@ -3,7 +3,7 @@ AHELLO_M80_SRC := $(call mb_make_call,mb_proj_module_path_src,$(PATH_SRC))
AHELLO_M80_BIN := $(call mb_make_call,mb_proj_module_path_bin,$(PATH_SRC),$(PATH_BIN)) AHELLO_M80_BIN := $(call mb_make_call,mb_proj_module_path_bin,$(PATH_SRC),$(PATH_BIN))
$(call mb_make_call_eval,mb_tool_m80_flow_bdos_mono,$(AHELLO_M80_BIN),$(AHELLO_M80_SRC),ahello) $(call mb_make_call,mb_tool_m80_flow_bdos_mono,$(AHELLO_M80_BIN),$(AHELLO_M80_SRC),ahello)
$(call mb_make_call_eval,mb_assert_flow_bdos_grep,$(AHELLO_M80_BIN),check-m80,ahello,M80) $(call mb_make_call,mb_assert_flow_bdos_grep,$(AHELLO_M80_BIN),check-m80,ahello,M80)
$(call mb_make_call_eval,mb_assert_flow_bdos_grep,$(AHELLO_M80_BIN),check-txt,ahello,"o world...") $(call mb_make_call,mb_assert_flow_bdos_grep,$(AHELLO_M80_BIN),check-txt,ahello,"o world...")

View file

@ -3,7 +3,7 @@ AHELLO_SDCC_SRC := $(call mb_make_call,mb_proj_module_path_src,$(PATH_SRC))
AHELLO_SDCC_BIN := $(call mb_make_call,mb_proj_module_path_bin,$(PATH_SRC),$(PATH_BIN)) AHELLO_SDCC_BIN := $(call mb_make_call,mb_proj_module_path_bin,$(PATH_SRC),$(PATH_BIN))
$(call mb_make_call_eval,mb_tool_sdcc_flow_bdos_mono,$(AHELLO_SDCC_BIN),$(AHELLO_SDCC_SRC),ahello) $(call mb_make_call,mb_tool_sdcc_flow_bdos_mono,$(AHELLO_SDCC_BIN),$(AHELLO_SDCC_SRC),ahello)
$(call mb_make_call_eval,mb_assert_flow_bdos_grep,$(AHELLO_SDCC_BIN),check-sdcc,ahello,SDCC) $(call mb_make_call,mb_assert_flow_bdos_grep,$(AHELLO_SDCC_BIN),check-sdcc,ahello,SDCC)
$(call mb_make_call_eval,mb_assert_flow_bdos_grep,$(AHELLO_SDCC_BIN),check-hell,ahello,Hell) $(call mb_make_call,mb_assert_flow_bdos_grep,$(AHELLO_SDCC_BIN),check-hell,ahello,Hell)

View file

@ -3,8 +3,8 @@ MBBOOT80_SRC := $(call mb_make_call,mb_proj_module_path_src,$(PATH_SRC))
MBBOOT80_BIN := $(call mb_make_call,mb_proj_module_path_bin,$(PATH_SRC),$(PATH_BIN)) MBBOOT80_BIN := $(call mb_make_call,mb_proj_module_path_bin,$(PATH_SRC),$(PATH_BIN))
$(call mb_make_call_eval,mb_tool_sdcc_flow_bdos_mono,$(MBBOOT80_BIN),$(MBBOOT80_SRC),mbboot80) $(call mb_make_call,mb_tool_sdcc_flow_bdos_mono,$(MBBOOT80_BIN),$(MBBOOT80_SRC),mbboot80)
$(call mb_make_call_eval,mb_assert_flow_bdos_grep,$(MBBOOT80_BIN),check-boot80,mbboot80,"mb::boot mode 80") $(call mb_make_call,mb_assert_flow_bdos_grep,$(MBBOOT80_BIN),check-boot80,mbboot80,"mb::boot mode 80")
$(MBBOOT80_BIN)/@release-local: | $(MBBOOT80_BIN)/@build $(MBBOOT80_BIN)/@release-local: | $(MBBOOT80_BIN)/@build