[U-Boot] [PATCH v4] mkimage: add "-V" option to print version information

Kim Phillips
2011-02-12T23:13:49Z

On Sat, 12 Feb 2011 10:37:11 +0100
Wolfgang Denk <wd@denx.de> wrote:

> - @( printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' "$(U_BOOT_VERSION)" \
> - '$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ) > $@.tmp
> + @( localvers='$(shell $(TOPDIR)/tools/setlocalversion $(TOPDIR))' ; \
> + printf '#define PLAIN_VERSION "%s%s"\n' \
> + "$(U_BOOT_VERSION)" "$${localvers}" ; \
> + printf '#define U_BOOT_VERSION "U-Boot %s%s"\n' \
> + "$(U_BOOT_VERSION)" "$${localvers}" ; \
> + ) > $@.tmp

IMO, PLAIN_VERSION isn't descriptive enough (should really be called
VERSION..?). How about going with something like:

#define U_BOOT_STR "U-Boot"
#define U_BOOT_VERSION U_BOOT_STR " %s%s"...

and then

> + case 'V':
> + printf("mkimage version %s\n", PLAIN_VERSION);
> + exit(EXIT_SUCCESS);

&U_BOOT_VERSION[sizeof(U_BOOT_STR)]

(the - 1 is not necessary since we want to include the ' ')

this maintains consistency and the fact that the mkimage version is
directly tied to it's parent project, U-Boot's, version number.

Kim