# SPDX-License-Identifier: GPL-2.0+
#
# Copyright 2021 Google, Inc
#
# SPDX-License-Identifier:	GPL-2.0+
#
# Awk script to parse a text file containing an environment and convert it
# to a C string which can be compiled into U-Boot.

# The resulting output is:
#
#   #define CONFIG_EXTRA_ENV_TEXT "<environment here>"
#
# If the input is empty, this script outputs a comment instead.

BEGIN {
	# env holds the env variable we are currently processing
	env = "";
	ORS = ""
}

# Skip empty lines, as these are generated by the clang preprocessor
NF {
	# Quote quotes
	gsub("\"", "\\\"")

	# Is this the start of a new environment variable?
	if (match($0, "^([^ \t=][^ =]*)=(.*)$", arr)) {
		if (length(env) != 0) {
			# Record the value of the variable now completed
			vars[var] = env
		}
		var = arr[1]
		env = arr[2]

		# Deal with += which concatenates the new string to the existing
		# variable
		if (length(env) != 0 && match(var, "^(.*)[+]$", var_arr))
		{
			# Allow var\+=val to indicate that the variable name is
			# var+ and this is not actually a concatenation
			if (substr(var_arr[1], length(var_arr[1])) == "\\") {
				# Drop the backslash
				sub(/\\[+]$/, "+", var)
			} else {
				var = var_arr[1]
				env = vars[var] env
			}
		}
	} else {
		# Change newline to space
		gsub(/^[ \t]+/, "")

		# Don't keep leading spaces generated by the previous blank line
		if (length(env) == 0) {
			env = $0
		} else {
			env = env " " $0
		}
	}
}

END {
	# Record the value of the variable now completed. If the variable is
	# empty it is not set.
	if (length(env) != 0) {
		vars[var] = env
	}

	if (length(vars) != 0) {
		printf("%s", "#define CONFIG_EXTRA_ENV_TEXT \"")

		# Print out all the variables
		for (var in vars) {
			env = vars[var]
			print var "=" vars[var] "\\0"
		}
		print "\"\n"
	}
}
