From: Kim Phillips Date: Sat, 12 Feb 2011 18:08:47 -0600 Subject: [U-Boot] [PATCH v4] mkimage: add "-V" option to print version information In-Reply-To: <20110212233508.B61821539A6@gemini.denx.de> References: <1297414591-12987-1-git-send-email-wd@denx.de> <1297503431-19435-1-git-send-email-wd@denx.de> <20110212171349.f0f5d472.kim.phillips@freescale.com> <20110212233508.B61821539A6@gemini.denx.de> Message-ID: <20110212180847.8b62cd13.kim.phillips@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Sun, 13 Feb 2011 00:35:08 +0100 Wolfgang Denk wrote: > Dear Kim Phillips, > > In message <20110212171349.f0f5d472.kim.phillips@freescale.com> you 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"... > > No - not unless you guarantee that this syntax is compatible with all > assemblers that may be used to build U-Boot. I cannot do that, but, ok, not such a big deal: /* prefix lengths must match */ #define U_BOOT_STR "U-Boot" #define U_BOOT_VERSION "U-Boot %s%s"... > > > + 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 ' ') > > No again. This is, um, ugly, and completely unnecessary. that's a matter of personal taste, but IMO it's better than PLAIN_VERSION (what's that? - VERSION_NUMBERONLY would be way more descriptive). If it's the &..[..] that's not appealing, feel free to do as the '+ 7' code but as '+ sizeof(...)' (to maintain a not-so-completely unnecessary clarity & consistency..but that's my opinion). Kim