Changeset - r22796:f5b7f87b98f2
[Not reviewed]
master
0 1 0
Patric Stout - 7 years ago 2018-04-14 18:11:49
truebrain@openttd.org
Change: [Build] use flags set by env at the end, not at the start (based on patch by adf88) (#6715)

This closes #6433
1 file changed with 20 insertions and 6 deletions:
0 comments (0 inline, 0 general)
config.lib
Show inline comments
 
@@ -1478,27 +1478,33 @@ make_compiler_cflags() {
 
	eval "$4=\"$ldflags\""
 
	eval "$5=\"$features\""
 
}
 

	
 
make_cflags_and_ldflags() {
 
	# General CFlags for BUILD
 
	CFLAGS_BUILD="$CFLAGS_BUILD"
 
	CFLAGS_BUILD_ENV="$CFLAGS_BUILD"
 
	CFLAGS_BUILD=""
 
	# Special CXXFlags for BUILD
 
	CXXFLAGS_BUILD="$CXXFLAGS_BUILD"
 
	CXXFLAGS_BUILD_ENV="$CXXFLAGS_BUILD"
 
	CXXFLAGS_BUILD=""
 
	# LDFLAGS for BUILD
 
	LDFLAGS_BUILD="$LDFLAGS_BUILD"
 
	LDFLAGS_BUILD_ENV="$LDFLAGS_BUILD"
 
	LDFLAGS_BUILD=""
 
	# FEATURES for BUILD (lto)
 
	FEATURES_BUILD=""
 
	# General CFlags for HOST
 
	CFLAGS="$CFLAGS"
 
	CFLAGS_ENV="$CFLAGS"
 
	CFLAGS=""
 
	# Special CXXFlags for HOST
 
	CXXFLAGS="$CXXFLAGS"
 
	CXXFLAGS_ENV="$CXXFLAGS"
 
	CXXFLAGS=""
 
	# Libs to compile. In fact this is just LDFLAGS
 
	LIBS="-lstdc++"
 
	# LDFLAGS used for HOST
 
	LDFLAGS="$LDFLAGS"
 
	LDFLAGS_ENV="$LDFLAGS"
 
	LDFLAGS=""
 
	# FEATURES for HOST (lto)
 
	FEATURES=""
 

	
 
	make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
 
	make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
 

	
 
@@ -1910,12 +1916,20 @@ make_cflags_and_ldflags() {
 
		fi
 
		if [ -n "$lto_host" ]; then
 
			LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
 
		fi
 
	fi
 

	
 
	# All flags to be extended via the env
 
	CFLAGS_BUILD="$CFLAGS_BUILD $CFLAGS_BUILD_ENV"
 
	CXXFLAGS_BUILD="$CXXFLAGS_BUILD $CXXFLAGS_BUILD_ENV"
 
	LDFLAGS_BUILD="$LDFLAGS_BUILD $LDFLAGS_BUILD_ENV"
 
	CFLAGS="$CFLAGS $CFLAGS_ENV"
 
	CXXFLAGS="$CXXFLAGS $CXXFLAGS_ENV"
 
	LDFLAGS="$LDFLAGS $LDFLAGS_ENV"
 

	
 
	log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
 
	log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
 
	log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
 
	log 1 "using CFLAGS... $CFLAGS"
 
	log 1 "using CXXFLAGS... $CXXFLAGS"
 
	log 1 "using LDFLAGS... $LIBS $LDFLAGS"
0 comments (0 inline, 0 general)