#5 build system: improve compatibility for posix make
Opened 2 months ago by orbea. Modified 2 months ago
zippy/ orbea/sofort bmake  into  main

file modified
+4 -4
@@ -143,16 +143,16 @@ 

  install-app-extras:

  

  .cflags-host:

- 	@true : $(CFLAGS)

+ 	@echo $(CFLAGS)

  

  .cflags-native:

- 	@true : $(NATIVE_CFLAGS)

+ 	@echo $(NATIVE_CFLAGS)

  

  .ldflags-host:

- 	@true : $(LDFLAGS_APP)

+ 	@echo $(LDFLAGS_APP)

  

  .ldflags-native:

- 	@true : $(NATIVE_LDFLAGS)

+ 	@echo $(NATIVE_LDFLAGS)

  

  

  include ./ccenv/host.mk

file modified
+9 -11
@@ -679,12 +679,12 @@ 

  	if [ -z "$mb_makemode" ]; then

  		mb_makemode='posix'

  

- 		printf '%s\n%s\n%s\n\n%s\n\n'        \

- 				'ifeq (a,b)'          \

- 				'VAR = val'            \

- 				'endif'                 \

- 				'all:'                   \

- 			| ${mb_make} -s -f - 2>/dev/null  \

+ 		printf '%s\n%s\n%s\n\n%s\n\n'           \

+ 				'ifeq (a,b)'             \

+ 				'VAR = val'               \

+ 				'endif'                    \

+ 				'all:'                      \

+ 			| ${mb_make} -s -f - >/dev/null 2>&1 \

  		&& mb_makemode='modern'

  

  	fi
@@ -914,10 +914,8 @@ 

  	mb_cfghost_cc="$ccenv_host_cc"

  	mb_cfghost_tmpname='ccenv/c3RyaWN0X21vZGUK.c'

  

- 	mb_cfghost_cflags=$(${mb_make} -n -f "$mb_makefile" \

- 		.cflags-host)

- 

- 	mb_cfghost_cflags="${mb_cfghost_cflags#*: }"

+ 	mb_cfghost_cflags=$(${mb_make} -s -f "$mb_makefile" \

+ 		.cflags-host | tail -1)

  

  	if [ "$mb_cc_environment" = 'freestanding' ]; then

  		if [ -z "mb_cc_underscore" ]; then
@@ -955,7 +953,7 @@ 

  	printf '\n\n' >&3

  

  	# execute

- 	if eval $mb_cfghost_cc "$ccenv_tmpname" -o a.out    \

+ 	if $mb_cfghost_cc "$ccenv_tmpname" -o a.out        \

  			$(printf '%s' "$mb_cfghost_cflags") \

  			2>&3; then

  		rm a.out

file modified
+13 -20
@@ -527,7 +527,7 @@ 

  			ccenv_host="$mb_native_host"

  

  		elif [ -n "$ccenv_dumpmachine_switch" ]; then

- 			ccenv_host=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \

+ 			ccenv_host=$($ccenv_cc $(printf '%s' "$ccenv_cflags") \

  				$ccenv_dumpmachine_switch 2>&3)

  

  		elif command -v slibtool > /dev/null 2>&1; then
@@ -559,7 +559,7 @@ 

  	fi

  

  	if [ -z "$ccenv_host" ] && [ -n "$ccenv_dumpmachine_switch" ]; then

- 		ccenv_host=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \

+ 		ccenv_host=$($ccenv_cc $(printf '%s' "$ccenv_cflags") \

  			$ccenv_dumpmachine_switch 2>&3)

  		ccenv_cchost=$ccenv_host

  
@@ -605,7 +605,7 @@ 

  		rm -f "$ccenv_tmp"

  		unset ccenv_tmp

  

- 		ccenv_cchost=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \

+ 		ccenv_cchost=$($ccenv_cc $(printf '%s' "$ccenv_cflags") \

  			$ccenv_dumpmachine_switch 2>&3)

  	fi

  
@@ -775,7 +775,7 @@ 

  

  			if [ "$ccenv_stdin_input" = 'yes' ]; then

  				printf '%s' "$ccenv_internal_str"                   \

- 						| eval $ccenv_cc -S -xc - -o -      \

+ 						| $ccenv_cc -S -xc - -o -           \

  						  $(printf '%s' "$ccenv_cflags")    \

  					> /dev/null 2>&3                            \

  				&& ccenv_internal_size=$ccenv_internal_guess
@@ -1513,17 +1513,14 @@ 

  

  

  	if [ "${ccenv_cfgtype}" = 'host' ]; then

- 		ccenv_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" .cflags-host)

- 		ccenv_ldflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" .ldflags-host)

+ 		ccenv_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" .cflags-host | tail -1)

+ 		ccenv_ldflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" .ldflags-host | tail -1)

  	else

- 		ccenv_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" .cflags-native)

- 		ccenv_ldflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" .ldflags-native)

+ 		ccenv_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" .cflags-native | tail -1)

+ 		ccenv_ldflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" .ldflags-native | tail -1)

  	fi

  

- 	ccenv_cflags="${ccenv_cflags#*: }"

- 	ccenv_ldflags="${ccenv_ldflags#*: }"

- 

- 	ccenv_sysroot=$(eval $ccenv_cc $(printf '%s' "$ccenv_cflags") \

+ 	ccenv_sysroot=$($ccenv_cc $(printf '%s' "$ccenv_cflags") \

  		-print-sysroot 2>/dev/null || true)

  

  	eval 'ccenv_'${ccenv_cfgtype}'_cflags'=\'$ccenv_cflags\'
@@ -1734,13 +1731,11 @@ 

  

  	if [ $ccenv_cfgtype = 'host' ]; then

  		ccenv_tflags=

- 		ccenv_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" \

+ 		ccenv_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \

  			OS_DSO_EXRULES=default                          \

  			OS_SONAME=symlink                                \

  			OS_ARCHIVE_EXT='.a'                               \

- 			.cflags-host)

- 

- 		ccenv_cflags="${ccenv_cflags#*: }"

+ 			.cflags-host | tail -1)

  

  		ccenv_cc="$mb_user_cc"

  		ccenv_cpp="$mb_user_cpp"
@@ -1750,13 +1745,11 @@ 

  		ccenv_pe_image_base="$mb_pe_image_base"

  	else

  		ccenv_tflags=

- 		ccenv_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" \

+ 		ccenv_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \

  			OS_DSO_EXRULES=default                          \

  			OS_SONAME=symlink                                \

  			OS_ARCHIVE_EXT='.a'                               \

- 			.cflags-native)

- 

- 		ccenv_cflags="${ccenv_cflags#*: }"

+ 			.cflags-native | tail -1)

  

  		ccenv_cc="$mb_native_cc"

  		ccenv_cpp="$mb_native_cpp"

file modified
+18 -26
@@ -44,21 +44,17 @@ 

  	mb_cfgtest_stdin_input=${ccenv_host_stdin_input:-}

  	mb_cfgtest_environment=${ccenv_host_cc_environment:-}

  

- 	mb_cfgtest_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" \

+ 	mb_cfgtest_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \

  		OS_DSO_EXRULES=default                              \

  		OS_SONAME=symlink                                   \

  		OS_ARCHIVE_EXT='.a'                                 \

- 		.cflags-host)

+ 		.cflags-host | tail -1)

  

- 	mb_cfgtest_cflags="${mb_cfgtest_cflags#*: }"

- 

- 	mb_cfgtest_ldflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" \

+ 	mb_cfgtest_ldflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \

  		OS_DSO_EXRULES=default                               \

  		OS_SONAME=symlink                                    \

  		OS_ARCHIVE_EXT='.a'                                  \

- 		.ldflags-host)

- 

- 	mb_cfgtest_ldflags="${mb_cfgtest_ldflags#*: }"

+ 		.ldflags-host | tail -1)

  }

  

  
@@ -70,21 +66,17 @@ 

  	mb_cfgtest_stdin_input=${ccenv_native_stdin_input:-}

  	mb_cfgtest_environment=${ccenv_native_cc_environment:-}

  

- 	mb_cfgtest_cflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" \

+ 	mb_cfgtest_cflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \

  		OS_DSO_EXRULES=default                              \

  		OS_SONAME=symlink                                   \

  		OS_ARCHIVE_EXT='.a'                                 \

- 		.cflags-native)

+ 		.cflags-native | tail -1)

  

- 	mb_cfgtest_cflags="${mb_cfgtest_cflags#*: }"

- 

- 	mb_cfgtest_ldflags=$(${mb_make} -n -f "$mb_pwd/Makefile.tmp" \

+ 	mb_cfgtest_ldflags=$(${mb_make} -s -f "$mb_pwd/Makefile.tmp" \

  		OS_DSO_EXRULES=default                               \

  		OS_SONAME=symlink                                    \

  		OS_ARCHIVE_EXT='.a'                                  \

- 		.ldflags-native)

- 

- 	mb_cfgtest_ldflags="${mb_cfgtest_ldflags#*: }"

+ 		.ldflags-native | tail -1)

  }

  

  
@@ -352,7 +344,7 @@ 

  

  	# execute

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'header' '-----' "<${1}>"    \

  	|| return
@@ -392,7 +384,7 @@ 

  

  	# execute

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	&& printf 'cfgtest: %s header <%s>: no error.' \

  		"$mb_cfgtest_cfgtype" "${1}" >&3        \
@@ -429,7 +421,7 @@ 

  

  	# execute

  	printf '%s\n' "$cfgtest_src"                  \

- 		| eval $(printf '%s' "$cfgtest_cmd")   \

+ 		| $(printf '%s' "$cfgtest_cmd")        \

  		> /dev/null 2>&3                        \

  	|| cfgtest_epilog 'interface' '(error)' "${1}"   \

  	|| return
@@ -466,7 +458,7 @@ 

  

  	# execute

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'decl' '(error)' "${1}"      \

  	|| return
@@ -519,7 +511,7 @@ 

  			cfgtest_common_init

  

  			printf '%s\n' "$cfgtest_src"                \

- 				| eval $(printf '%s' "$cfgtest_cmd") \

+ 				| $(printf '%s' "$cfgtest_cmd")      \

  				> /dev/null 2>&3                      \

  			&& mb_internal_size=$mb_internal_guess

  
@@ -570,7 +562,7 @@ 

  	cfgtest_ret=1

  

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'attr' '(error)' "${1}"      \

  	|| return
@@ -602,7 +594,7 @@ 

  	cfgtest_ret=1

  

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'snippet' '(error)'          \

  	|| return
@@ -635,7 +627,7 @@ 

  	cfgtest_ret=1

  

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'macro' '(error)' "${1}"     \

  	|| return
@@ -683,7 +675,7 @@ 

  

  	# execute

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'library' '-----' "$@"       \

  	|| return 1
@@ -867,7 +859,7 @@ 

  

  	# execute

  	printf '%s\n' "$cfgtest_src"                \

- 		| eval $(printf '%s' "$cfgtest_cmd") \

+ 		| $(printf '%s' "$cfgtest_cmd")      \

  		> /dev/null 2>&3                      \

  	|| cfgtest_epilog 'switch' '(error)' "$@"      \

  	|| return 1