From 1e26b3651b33db2ed4a2acab23e52ab2e21d7cd0 Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Mon, 15 Jun 2020 17:28:45 -0400 Subject: [PATCH 1/5] tarball: use make's --no-print-directory flag. fix make's (sometimes like in artix linux) default behavior of always printing entering and leaving directory messages. we only want them when we specify V=1 for verbose builds. --- crossplatform.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crossplatform.mk b/crossplatform.mk index be269c837d..ee53accad7 100644 --- a/crossplatform.mk +++ b/crossplatform.mk @@ -3,6 +3,10 @@ $(info Using config.mk configuration file.) include config.mk endif +ifndef VERBOSE +MAKEFLAGS += --no-print-directory +endif + # HOST PLATFORM DETECTION ifeq ($(OS),Windows_NT) HOST_PLATFORM := win32 From 4a6577b531f2a40b087368b25fec3185b98519fa Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Mon, 16 Sep 2019 23:39:25 -0400 Subject: [PATCH 2/5] tarball/Cleanfile: fix empty recipes as Cleanfile is a little different and some old recipies were left behind. { please squash with d3ded8f52e502a300d4ad7848df09dc6b4836f4a } --- Cleanfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Cleanfile b/Cleanfile index 77d4011ff3..f31008e0e8 100644 --- a/Cleanfile +++ b/Cleanfile @@ -21,9 +21,6 @@ ifeq ($(wildcard $(_SDK_SRC_ROOT)Cleanfile),) _SDK_SRC_ROOT = $(find_sdk_src_root) endif -$(_SDK_SRC_ROOT)Cleanfile: ; -$(_SDK_SRC_ROOT)crossplatform.mk: ; - include $(_SDK_SRC_ROOT)crossplatform.mk subdirs := $(sort $(filter-out .configs obj __pycache__,$(hs_ls_dir))) @@ -64,5 +61,3 @@ ifdef _SDK_SRC_ROOT endif $(MAKEFILE_LIST): ; -$(SOURCES): ; -$(RESOURCES): ; From 71d9ba87b46c939f7a81eeff22b865ff1ded36fe Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Mon, 14 Oct 2019 04:09:12 -0400 Subject: [PATCH 3/5] crossplatform.mk: add include guard variable CROSSPLATFORM_MK := defined. --- crossplatform.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crossplatform.mk b/crossplatform.mk index ee53accad7..b00021c53c 100644 --- a/crossplatform.mk +++ b/crossplatform.mk @@ -3,6 +3,8 @@ $(info Using config.mk configuration file.) include config.mk endif +CROSSPLATFORM_MK := defined + ifndef VERBOSE MAKEFLAGS += --no-print-directory endif @@ -316,7 +318,7 @@ endif ifeq ($(D),1) DEBUG_IS_ON := defined endif -addtolistfile = $(if $(1),@$(call echo,$(1)) >> $(2),) +addtolistfile = $(if $(1),@$(call echo,$(1))>> $(2),) ifdef WIN_SHELL_COMMANDS cd = @cd nullerror = 2>NUL From f7008d1d23488ced2f23cb6c2240d75337295a68 Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Sat, 25 Apr 2020 02:37:33 -0400 Subject: [PATCH 4/5] tarball: use .NOTPARALLEL to allow 'make wipeclean all -j9' and 'make wipeclean all install -j9' to work properly instead of targets (especially wipeclean and all) interfering with eachother. note: use of .NOTPARALLEL should be expanded to other tarball makefiles and makefile generation. --- Makefile | 2 ++ crossplatform.mk | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 78a0bcc538..86156d64d8 100644 --- a/Makefile +++ b/Makefile @@ -1114,3 +1114,5 @@ troubleshoot: @$(call echo,OPENSSL_BIN_DIR=$(OPENSSL_BIN_DIR)) @$(call echo,ROOT_ABSPATH=$(ROOT_ABSPATH)) @$(call echo,DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH)) + +.NOTPARALLEL: $(NOT_PARALLEL_TARGETS) diff --git a/crossplatform.mk b/crossplatform.mk index b00021c53c..3e9c9e1f14 100644 --- a/crossplatform.mk +++ b/crossplatform.mk @@ -9,6 +9,8 @@ ifndef VERBOSE MAKEFLAGS += --no-print-directory endif +NOT_PARALLEL_TARGETS += clean realclean wipeclean distclean install + # HOST PLATFORM DETECTION ifeq ($(OS),Windows_NT) HOST_PLATFORM := win32 From 6f14f15785f43a526efb4abfc105707c055c2793 Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Sat, 15 Aug 2020 01:45:13 -0400 Subject: [PATCH 5/5] tarball: build system: add variables printing and troubleshooting targets. --- Makefile | 53 -------------------- crossplatform.mk | 124 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 124 insertions(+), 53 deletions(-) diff --git a/Makefile b/Makefile index 86156d64d8..655b7eb8ad 100644 --- a/Makefile +++ b/Makefile @@ -1062,57 +1062,4 @@ update_ecs: +cd compiler/ecs && $(_MAKE) -f Makefile.bootstrap clean +cd compiler/ecs && $(_MAKE) -f Makefile.bootstrap -troubleshoot: - @$(call echo,Printing values of some variables.) - @$(call echo,_CF_DIR=$(_CF_DIR)) - @$(call echo,HOST_PLATFORM=$(HOST_PLATFORM)) - @$(call echo,TARGET_PLATFORM=$(TARGET_PLATFORM)) - @$(call echo,PLATFORM=$(PLATFORM)) - @$(call echo,LINUX_HOST=$(LINUX_HOST)) - @$(call echo,LINUX_TARGET=$(LINUX_TARGET)) - @$(call echo,OSX_HOST=$(OSX_HOST)) - @$(call echo,OSX_TARGET=$(OSX_TARGET)) - @$(call echo,WINDOWS_HOST=$(WINDOWS_HOST)) - @$(call echo,WINDOWS_TARGET=$(WINDOWS_TARGET)) - @$(call echo,BSD_HOST=$(BSD_HOST)) - @$(call echo,BSD_TARGET=$(BSD_TARGET)) - @$(call echo,OS=$(OS)) - @$(call echo,OSTYPE=$(OSTYPE)) - @$(call echo,BASH=$(BASH)) - @$(call echo,TERM=$(TERM)) - @$(call echo,SHELL=$(SHELL)) - @$(call echo,WIN_SHELL_COMMANDS=$(WIN_SHELL_COMMANDS)) - @$(call echo,WIN_PS_TOOLS=$(WIN_PS_TOOLS)) - @$(call echo,CCACHE=$(CCACHE)) - @$(call echo,CCACHE_COMPILE=$(CCACHE_COMPILE)) - @$(call echo,CCACHE_PREFIX=$(CCACHE_PREFIX)) - @$(call echo,DISTCC=$(DISTCC)) - @$(call echo,GCC_PREFIX=$(GCC_PREFIX)) - @$(call echo,CC=$(CC)) - @$(call echo,CPP=$(CPP)) - @$(call echo,ECP=$(ECP)) - @$(call echo,ECC=$(ECC)) - @$(call echo,ECS=$(ECS)) - @$(call echo,EAR=$(EAR)) - @$(call echo,AS=$(AS)) - @$(call echo,LD=$(LD)) - @$(call echo,AR=$(AR)) - @$(call echo,STRIP=$(STRIP)) - @$(call echo,UPX=$(UPX)) - @$(call echo,TARGET_ARCH=$(TARGET_ARCH)) - @$(call echo,DESTDIR=$(DESTDIR)) - @$(call echo,PREFIXLIBDIR=$(PREFIXLIBDIR)) - @$(call echo,ARCH=$(ARCH)) - @$(call echo,ARCH_FLAGS=$(ARCH_FLAGS)) - @$(call echo,GIT_REPOSITORY=$(GIT_REPOSITORY)) - @$(call echo,DIR_VER=$(DIR_VER)) - @$(call echo,REPOSITORY_VER=$(REPOSITORY_VER)) - @$(call echo,CPPFLAGS=$(CPPFLAGS)) - @$(call echo,OPENSSL_CONF=$(OPENSSL_CONF)) - @$(call echo,OPENSSL_INCLUDE_DIR=$(OPENSSL_INCLUDE_DIR)) - @$(call echo,OPENSSL_LIB_DIR=$(OPENSSL_LIB_DIR)) - @$(call echo,OPENSSL_BIN_DIR=$(OPENSSL_BIN_DIR)) - @$(call echo,ROOT_ABSPATH=$(ROOT_ABSPATH)) - @$(call echo,DYLD_LIBRARY_PATH=$(DYLD_LIBRARY_PATH)) - .NOTPARALLEL: $(NOT_PARALLEL_TARGETS) diff --git a/crossplatform.mk b/crossplatform.mk index 3e9c9e1f14..2510ca182d 100644 --- a/crossplatform.mk +++ b/crossplatform.mk @@ -1,5 +1,13 @@ +empty := +space := $(empty) $(empty) +str_is = $(if $(subst $2,,$1),,true) +single_goal = $(if $(word 2,$(MAKECMDGOALS)),,$(word 1,$(MAKECMDGOALS))) +single_goal_split = $(subst -,$(space),$1) +goals_is_single_print_target = $(if $(single_goal),$(if $(call str_is,$(word 1,$(single_goal_split)),print),$(if $(call str_is,$(word 2,$(single_goal_split)),var),true,$(if $(call str_is,$(word 2,$(single_goal_split)),substr),$(if $(call str_is,$(word 3,$(single_goal_split)),vars),true,),)),),) ifneq ($(wildcard config.mk),) +ifeq ($(goals_is_single_print_target),) $(info Using config.mk configuration file.) +endif include config.mk endif @@ -445,3 +453,119 @@ ifdef WINDOWS_TARGET endif endif endif + +var_info = $(if $(value $1),$1 = $(value $1),$1 is defined as an empty value) +var_eval = $(if $(value $1),$(if $($1),$1 = $($1),$1 evaluates to an empty value),$1 is defined as an empty value) +var_both = $(if $(value $1),$1 = $(value $1) $(if $($1),$(if $(call str_is,$($1),$(value $1)),(equal to definition),= $($1)),= (empty value)),$1 is defined as an empty value) +var_stat = $(call var_info,$1) [$(origin $1) $(flavor $1)] +var_full = $(call var_both,$1) [$(origin $1) $(flavor $1)] +info_var = $(info $(call $(if $2,$2,var_info),$1)) +info_check_var_defined = $(info $(if $(subst $(space),,$(foreach var,$(.VARIABLES),$(if $(subst $1,,$(var)),,1))),$(call $(if $2,$2,var_info),$1),$1 is not defined)) +info_all_vars = $(foreach var,$(sort $(.VARIABLES)),$(call info_var,$(var),$2)) +info_all_substr_vars = $(foreach var,$(sort $(.VARIABLES)),$(if $(findstring $1,$(var)),$(call info_var,$(var),$2),)) +msg_var_eval_crash = is not provided since evaluating variables that use control flow functions will crash + +NOT_PARALLEL_TARGETS += print-all-vars-info print-all-vars-eval print-all-vars-both print-all-vars-stat print-all-vars-full +.PHONY: print-all-vars-info print-all-vars-eval print-all-vars-both print-all-vars-stat print-all-vars-full +print-all-vars-info: ; @$(call info_all_vars) +print-all-vars-eval: ; @$(info note: print-all-vars-eval $(msg_var_eval_crash)) +print-all-vars-both: ; @$(info note: print-all-vars-both $(msg_var_eval_crash)) +print-all-vars-stat: ; @$(if $(subst all,,$*),$(call info_check_var_defined,$*,var_stat),$(call info_all_vars,var_stat)) +print-all-vars-full: ; @$(info note: print-all-vars-full $(msg_var_eval_crash)) + +NOT_PARALLEL_TARGETS += print-var-info-% print-var-eval-% print-var-both-% print-var-stat-% print-var-full-% +.PHONY: print-var-info-% print-var-eval-% print-var-both-% print-var-stat-% print-var-full-% +print-var-info-%: ; @$(call info_check_var_defined,$*) +print-var-eval-%: ; @$(call info_check_var_defined,$*,var_eval) +print-var-both-%: ; @$(call info_check_var_defined,$*,var_both) +print-var-stat-%: ; @$(call info_check_var_defined,$*,var_stat) +print-var-full-%: ; @$(call info_check_var_defined,$*,var_full) + +NOT_PARALLEL_TARGETS += print-substr-vars-info-% print-substr-vars-eval-% print-substr-vars-both-% print-substr-vars-stat-% print-substr-vars-full-% +.PHONY: print-substr-vars-info-% print-substr-vars-eval-% print-substr-vars-both-% print-substr-vars-stat-% print-substr-vars-full-% +print-substr-vars-info-%: ; @$(call info_all_substr_vars,$*) +print-substr-vars-eval-%: ; @$(call info_all_substr_vars,$*,var_eval) +print-substr-vars-both-%: ; @$(call info_all_substr_vars,$*,var_both) +print-substr-vars-stat-%: ; @$(call info_all_substr_vars,$*,var_stat) +print-substr-vars-full-%: ; @$(call info_all_substr_vars,$*,var_full) + +NOT_PARALLEL_TARGETS += troubleshoot +.PHONY: troubleshoot +troubleshoot: troubleshoot-core troubleshoot-toolchain troubleshoot-openssl troubleshoot-version + +NOT_PARALLEL_TARGETS += troubleshoot-core +.PHONY: troubleshoot-core +troubleshoot-core: + @$(info -- core variables --) + @$(call info_check_var_defined,_CF_DIR,var_full) + @$(call info_check_var_defined,WIN_SHELL_COMMANDS,var_full) + @$(call info_check_var_defined,WIN_PS_TOOLS,var_full) + @$(info -- important environtment variables --) + @$(call info_check_var_defined,OS,var_full) + @$(call info_check_var_defined,OSTYPE,var_full) + @$(call info_check_var_defined,BASH,var_full) + @$(call info_check_var_defined,TERM,var_full) + @$(call info_check_var_defined,SHELL,var_full) + @$(info -- host and target variables --) + @$(call info_check_var_defined,HOST_PLATFORM,var_full) + @$(call info_check_var_defined,TARGET_PLATFORM,var_full) + @$(call info_check_var_defined,PLATFORM,var_full) + @$(call info_check_var_defined,LINUX_HOST,var_full) + @$(call info_check_var_defined,LINUX_TARGET,var_full) + @$(call info_check_var_defined,OSX_HOST,var_full) + @$(call info_check_var_defined,OSX_TARGET,var_full) + @$(call info_check_var_defined,WINDOWS_HOST,var_full) + @$(call info_check_var_defined,WINDOWS_TARGET,var_full) + @$(call info_check_var_defined,BSD_HOST,var_full) + @$(call info_check_var_defined,BSD_TARGET,var_full) + @$(call info_check_var_defined,TARGET_ARCH,var_full) + @$(info -- arch variables --) + @$(call info_check_var_defined,ARCH,var_full) + @$(call info_check_var_defined,ARCH_FLAGS,var_full) + +NOT_PARALLEL_TARGETS += troubleshoot-toolchain +.PHONY: troubleshoot-toolchain +troubleshoot-toolchain: + @$(info -- toolchain variables --) + @$(call info_check_var_defined,GCC_PREFIX,var_full) + @$(call info_check_var_defined,CC,var_full) + @$(call info_check_var_defined,CPP,var_full) + @$(call info_check_var_defined,ECP,var_full) + @$(call info_check_var_defined,ECC,var_full) + @$(call info_check_var_defined,ECS,var_full) + @$(call info_check_var_defined,EAR,var_full) + @$(call info_check_var_defined,AS,var_full) + @$(call info_check_var_defined,LD,var_full) + @$(call info_check_var_defined,AR,var_full) + @$(call info_check_var_defined,STRIP,var_full) + @$(info -- related variables --) + @$(call info_check_var_defined,UPX,var_full) + @$(call info_check_var_defined,CCACHE,var_full) + @$(call info_check_var_defined,CCACHE_COMPILE,var_full) + @$(call info_check_var_defined,CCACHE_PREFIX,var_full) + @$(call info_check_var_defined,DISTCC,var_full) + @$(info -- more related variables --) + @$(call info_check_var_defined,DESTDIR,var_full) + @$(call info_check_var_defined,PREFIXLIBDIR,var_full) + @$(call info_check_var_defined,CPPFLAGS,var_full) + @$(call info_check_var_defined,ROOT_ABSPATH,var_full) + @$(call info_check_var_defined,DYLD_LIBRARY_PATH,var_full) + +NOT_PARALLEL_TARGETS += troubleshoot-openssl +.PHONY: troubleshoot-openssl +troubleshoot-openssl: + @$(info -- toolchain variables --) + @$(call info_check_var_defined,OPENSSL_CONF,var_full) + @$(call info_check_var_defined,OPENSSL_INCLUDE_DIR,var_full) + @$(call info_check_var_defined,OPENSSL_LIB_DIR,var_full) + @$(call info_check_var_defined,OPENSSL_BIN_DIR,var_full) + +NOT_PARALLEL_TARGETS += troubleshoot-version +.PHONY: troubleshoot-version +troubleshoot-version: + @$(info -- version variables --) + @$(call info_check_var_defined,GIT_REPOSITORY,var_full) + @$(call info_check_var_defined,DIR_VER,var_full) + @$(call info_check_var_defined,REPOSITORY_VER,var_full) + +.DEFAULT_GOAL =