
On 06/24/2013 02:46 PM, Simon Glass wrote:
In many cases environment variables need access to the U-Boot CONFIG variables to select different options. Enable this so that the environment scripts can be as useful as the ones currently in the board config files.
The addition of += seems like a separate change to enabling pre-processing, but I guess they're both simple enough and this is a new features, perhaps it's not a big deal.
diff --git a/Makefile b/Makefile
$(obj)include/generated/environment.in: $(obj)include/generated/autoconf.mk.base \ $(wildcard $(ENV_FILE)) if [ -f "$(ENV_FILE)" ]; then \
cat $(ENV_FILE) >$@ ; \
$(CPP) -P $(CFLAGS) -x assembler-with-cpp -D__ASSEMBLY__ \
-include $(obj)include/config.h $(ENV_FILE) -o $@; \
I guess -undef doesn't make sense here, since config.h could well rely on standard pre-defined macros.
Does it make sense to -D __UBOOT_CONFIG__ rather than, or in addition to, -D __ASSEMBLY__ here, so headers can tell what they're being included for? The series I sent for dtc+cpp did -D __DTS__ for similar reasons.
diff --git a/tools/scripts/env2string.awk b/tools/scripts/env2string.awk
# Deal with +=
if (match(var, "(.*)[+]$", var_arr)) {
var = var_arr[1]
env = vars[var] env
}
Does this work if you write just:
foo+=bar
rather than:
foo= foo+=bar
It might be worth allowing the former syntax, so you don't need to explicitly assign empty values before a sequence of ifdef'd += operations. If the above blows up, at least a descriptive error message might be useful.