msxbuild/lib/make/𓃬 𓍄 𓋹𓀭/mb_flow_proj.mk

289 lines
16 KiB
Makefile
Raw Normal View History

2024-07-12 15:59:26 +00:00
MB_PROJ_META_GROUP_ID ?=
$(call mb_make_call,mb_doc_variable,MB_PROJ_META_GROUP_ID,"The project group id.")
MB_PROJ_META_ARTIFACT_ID ?=
$(call mb_make_call,mb_doc_variable,MB_PROJ_META_ARTIFACT_ID,"The project artifact id.")
MB_PROJ_META_VERSION ?=
$(call mb_make_call,mb_doc_variable,MB_PROJ_META_VERSION,"The project version.")
MB_PROJ_META_NAME ?=
$(call mb_make_call,mb_doc_variable,MB_PROJ_META_NAME,"The project name.")
MB_PROJ_META_DESCRIPTION ?=
$(call mb_make_call,mb_doc_variable,MB_PROJ_META_DESCRIPTION,"The project description.")
MB_PROJ_META_WEBSITE ?=
$(call mb_make_call,mb_doc_variable,MB_PROJ_META_WEBSITE,"The project website location.")
2024-07-12 17:03:09 +00:00
MB_PROJ_PHASE_ALL = @clean @init @prepare @process @compile @link @build @test @package @package-qa @package-deploy @all
2024-07-12 15:59:26 +00:00
$(call mb_make_call,mb_doc_variable_rock,MB_PROJ_PHASE_ALL,"All the phases of an project with flow steps.")
define mb_proj_module_path_src
$(MB_   )$(1)/$(subst /,,$(subst $(1),,$(dir $(lastword $(MAKEFILE_LIST)))))
endef
$(call mb_make_call,mb_doc_function_deep,mb_proj_module_path_src,"Convert current location folder as src folder.","<path-src>")
define mb_proj_module_path_bin
$(MB_   )$(2)/$(subst /,,$(subst $(1),,$(dir $(lastword $(MAKEFILE_LIST)))))
endef
$(call mb_make_call,mb_doc_function_deep,mb_proj_module_path_src,"Convert current location folder as bin folder.","<path-src> <path-bin>")
define mb_proj_module_local_deps
$(MB_   )$(foreach _dep,$(2),$(1)/$(notdir $(_dep)))
endef
$(call mb_make_call,mb_doc_function_deep,mb_proj_module_deps,"Convert other files to local deps.","<mod-bin> <deps>")
define mb_proj_grow_deps_phase
$(MB_   )$(call mb_make_call,mb_make_check_arg2,$(0),$(1),$(2))
$(MB_   )$(call mb_make_call,mb_make_check_value_valid,$(0),$(1),$(MB_PROJ_PHASE_ALL))
$(MB_   )$(eval @$(1)-deps:: $(2))
endef
$(call mb_make_call,mb_doc_function_deep,mb_proj_grow_deps_phase_clean,"Grow the deps of the selected phase..","<phase> <slave-target>")
define _mb_proj_flow_step_before
$(MB_   )$(call mb_make_call,mb_os_echo_phase,$(MB_I18N_PROJ_STEP_BEFORE) $@)
endef
define _mb_proj_flow_step_done
$(MB_   )$(call mb_make_call,mb_os_echo_phase,$(MB_I18N_PROJ_STEP_AFTER) $@)
$(MB_   )$(if $(value MAKECMDGOALS),$(if $(filter $@,$(MAKECMDGOALS)),$(call mb_make_call,mb_os_echo_good,$(MB_I18N_PROJ_STEP_DONE) $@)))
endef
define _mb_proj_run_clean
$(MB_   )$(foreach folder,$(1),$(if $(wildcard $(folder)),$(call mb_make_call,mb_os_echo_command,$(MB_I18N_PROJ_DIR_DELETE) $(folder));))
$(MB_   )$(foreach folder,$(1),$(if $(wildcard $(folder)),$(call mb_make_call,mb_os_dir_delete,$(folder))))
endef
define _mb_proj_run_init
$(MB_   )$(foreach folder,$(1),$(if $(wildcard $(folder)),,$(call mb_make_call,mb_os_echo_command,$(MB_I18N_PROJ_DIR_CREATE) $(folder));))
$(MB_   )$(foreach folder,$(1),$(if $(wildcard $(folder)),,$(call mb_make_call,mb_os_dir_create,$(folder))))
endef
define __mb_flow_proj_setup
.RECIPEPREFIX := $(MB_@RECIPE)
@@clean: @include
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@clean)
@@clean-deps:: @include
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@clean-deps)
@clean: @@clean @@clean-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_run_clean,$(1))
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@clean,"Clean's the project build folders.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@clean)
@@init: @include
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@init)
@@init-deps:: @include
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@init-deps)
@init: @@init @@init-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_run_init,$(1))
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@init,"Create the project output folders.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@init)
@@prepare: @init
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@prepare)
@@prepare-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@prepare-deps)
@prepare: @@prepare @@prepare-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@prepare,"Prepare sources before processing.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@prepare)
@@process: @prepare
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@process)
@@process-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@process-deps)
@process: @@process @@process-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@process,"Process sources before compiling.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@process)
@@compile: @process
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@compile)
@@compile-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@compile-deps)
@compile: @@compile @@compile-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@compile,"Compiles all project sources.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@compile)
@@link: @compile
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@link)
@@link-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@link-deps)
@link: @@link @@link-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@link,"Link all project intermediate files.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@link)
@@build: @link
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@build)
@@build-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@build-deps)
@build: @@build @@build-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@build,"Build all project artifacts.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@build)
@@test: @build
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@test)
@@test-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@test-deps)
@test: @@test @@test-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@test,"Run all assertion tests.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@test)
@@package: @test
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@package)
@@package-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@package-deps)
@package: @@package @@package-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@package,"Create all packages of project.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@package)
@@package-qa: @package
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@package-qa)
@@package-qa-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@package-qa-deps)
@package-qa: @@package-qa @@package-qa-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@package-qa,"Run all packages QA of project.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@package-qa)
@@package-deploy: @package-qa
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@package-deploy)
@@package-deploy-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@package-deploy-deps)
@package-deploy: @@package-deploy @@package-deploy-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@package-deploy,"Deploy all the packages.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@package-deploy)
@@all: @package-qa
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_before)
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@all)
@@all-deps::
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@@all-deps)
@all: @@all @@all-deps
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@all,"Run full build and package QA tests.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@all)
.RECIPEPREFIX := $(MB_@RECIPEPREFIX)
endef
define mb_flow_proj_setup
$(MB_   )$(call mb_make_call,mb_make_check_arg1,$(0),$(1))
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_PROJ_META_GROUP_ID)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_PROJ_META_ARTIFACT_ID)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_PROJ_META_VERSION)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_PROJ_META_NAME)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_PROJ_META_DESCRIPTION)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_PROJ_META_WEBSITE)
$(MB_   )$(eval $(call mb_make_call,__$(0),$(1)))
$(MB_   )$(if $(MB_I18N),$(if $(filter off,$(MB_I18N)),,$(call mb_make_call,_$(0)_i18n)))
endef
2024-07-12 17:03:09 +00:00
$(call mb_make_call,mb_doc_function_flow,mb_flow_proj_setup,"Inject flow of abstract project build cycle.","<build-dirs>")
2024-07-12 15:59:26 +00:00
define __mb_flow_proj_setup_i18n
.RECIPEPREFIX := $(MB_@RECIPE)
@$$(MB_I18N_PROJ_PHASEID_CLEAN): @clean
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_CLEAN),$$(MB_I18N_PROJ_PHASEDOC_CLEAN))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_CLEAN))
@$$(MB_I18N_PROJ_PHASEID_INIT): @init
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_INIT),$$(MB_I18N_PROJ_PHASEDOC_INIT))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_INIT))
2024-07-12 17:11:32 +00:00
@$$(MB_I18N_PROJ_PHASEID_PREPARE): @$$(MB_I18N_PROJ_PHASEID_INIT) @prepare
2024-07-12 15:59:26 +00:00
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_PREPARE),$$(MB_I18N_PROJ_PHASEDOC_PREPARE))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_PREPARE))
2024-07-12 17:11:32 +00:00
@$$(MB_I18N_PROJ_PHASEID_PROCESS): @$$(MB_I18N_PROJ_PHASEID_PREPARE) @process
2024-07-12 15:59:26 +00:00
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_PROCESS),$$(MB_I18N_PROJ_PHASEDOC_PROCESS))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_PROCESS))
@$$(MB_I18N_PROJ_PHASEID_COMPILE): @$$(MB_I18N_PROJ_PHASEID_PROCESS) @compile
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_COMPILE),$$(MB_I18N_PROJ_PHASEDOC_COMPILE))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_COMPILE))
@$$(MB_I18N_PROJ_PHASEID_LINK): @$$(MB_I18N_PROJ_PHASEID_COMPILE) @link
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_LINK),$$(MB_I18N_PROJ_PHASEDOC_LINK))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_LINK))
@$$(MB_I18N_PROJ_PHASEID_BUILD): @$$(MB_I18N_PROJ_PHASEID_LINK) @build
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_BUILD),$$(MB_I18N_PROJ_PHASEDOC_BUILD))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_BUILD))
@$$(MB_I18N_PROJ_PHASEID_TEST): @$$(MB_I18N_PROJ_PHASEID_BUILD) @test
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_TEST),$$(MB_I18N_PROJ_PHASEDOC_TEST))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_TEST))
@$$(MB_I18N_PROJ_PHASEID_PACKAGE): @$$(MB_I18N_PROJ_PHASEID_TEST) @package
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_PACKAGE),$$(MB_I18N_PROJ_PHASEDOC_PACKAGE))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_PACKAGE))
@$$(MB_I18N_PROJ_PHASEID_PACKAGE_QA): @$$(MB_I18N_PROJ_PHASEID_PACKAGE) @package-qa
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_PACKAGE_QA),$$(MB_I18N_PROJ_PHASEDOC_PACKAGE_QA))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_PACKAGE_QA))
@$$(MB_I18N_PROJ_PHASEID_PACKAGE_DEPLOY): @$$(MB_I18N_PROJ_PHASEID_PACKAGE_QA) @package-deploy
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_PACKAGE_DEPLOY),$$(MB_I18N_PROJ_PHASEDOC_PACKAGE_DEPLOY))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_PACKAGE_DEPLOY))
2024-07-12 16:37:44 +00:00
@$$(MB_I18N_PROJ_PHASEID_ALL): @$$(MB_I18N_PROJ_PHASEID_PACKAGE_QA) @all
2024-07-12 15:59:26 +00:00
$(MB_@RECIPE)$$(call mb_make_call,_mb_proj_flow_step_done)
$(MB_   )$$(call mb_make_call,mb_doc_target_help,@$$(MB_I18N_PROJ_PHASEID_ALL),$$(MB_I18N_PROJ_PHASEDOC_ALL))
$(MB_   )$$(call mb_make_call,mb_make_target_phony,@$$(MB_I18N_PROJ_PHASEID_ALL))
.RECIPEPREFIX := $(MB_@RECIPEPREFIX)
endef
define _mb_flow_proj_setup_i18n
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_CLEAN)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_INIT)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_PREPARE)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_PROCESS)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_COMPILE)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_LINK)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_BUILD)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_TEST)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_PACKAGE)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_PACKAGE_QA)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_PACKAGE_DEPLOY)
$(MB_   )$(call mb_make_call,mb_make_check_variable,MB_I18N_PROJ_PHASEID_ALL)
$(MB_   )$(eval $(call mb_make_call,_$(0)))
endef