All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/5] env: Allow environment files to use the C preprocessor
Date: Wed, 26 Jun 2013 14:05:15 -0600	[thread overview]
Message-ID: <51CB497B.8030404@wwwdotorg.org> (raw)
In-Reply-To: <1372106765-18401-5-git-send-email-sjg@chromium.org>

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.

  reply	other threads:[~2013-06-26 20:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-24 20:46 [U-Boot] [PATCH v2 0/5] env: Add support for environment files Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 1/5] sandbox: Support 'env import' and 'env export' Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 2/5] Make 'run' use run_command_list() instead of run_command() Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 3/5] Allow U-Boot scripts to be placed in a .env file Simon Glass
2013-06-26 19:56   ` Stephen Warren
2013-10-20 20:47     ` Simon Glass
2013-10-25 15:34       ` Stephen Warren
2013-06-24 20:46 ` [U-Boot] [PATCH v2 4/5] env: Allow environment files to use the C preprocessor Simon Glass
2013-06-26 20:05   ` Stephen Warren [this message]
2013-10-20 21:09     ` Simon Glass
2013-06-24 20:46 ` [U-Boot] [PATCH v2 5/5] RFC: tegra: Convert to using environment files Simon Glass
2013-06-26 20:16   ` Stephen Warren
2013-10-20 21:15     ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51CB497B.8030404@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.