Message ID | 1307126163-24859-1-git-send-email-msm@freescale.com |
---|---|
State | Rejected |
Headers | show |
On Friday, June 03, 2011 14:36:03 Matthew McClintock wrote: > +if [ -z "${options}" ] ; then > + options=$EXTRA_OPTS > +else > + options="$options,$EXTRA_OPTS" > +fi this can be simplified (or at least done in one line) with: options=${options:+${options},}${EXTRA_OPTS} although i can understand that not everyone can grok that at first blush > +TARGETS+=`echo $EXTRA_OPTS | tr ',' ' '` you're still using non-portable += append operator although i dont understand how EXTRA_OPTS can both be extra options and extra targets at the same time ... -mike
On Fri, Jun 3, 2011 at 2:24 PM, Mike Frysinger <vapier@gentoo.org> wrote: > On Friday, June 03, 2011 14:36:03 Matthew McClintock wrote: >> +if [ -z "${options}" ] ; then >> + options=$EXTRA_OPTS >> +else >> + options="$options,$EXTRA_OPTS" >> +fi > > this can be simplified (or at least done in one line) with: > options=${options:+${options},}${EXTRA_OPTS} > > although i can understand that not everyone can grok that at first blush I'm fine with doing this if it's understandable by all > >> +TARGETS+=`echo $EXTRA_OPTS | tr ',' ' '` > > you're still using non-portable += append operator > > although i dont understand how EXTRA_OPTS can both be extra options and extra > targets at the same time ... Actually I just looked over this again and I found a much simpler way to accomplish the same thing. See my next patch. -M
Dear Matthew McClintock, In message <1307126163-24859-1-git-send-email-msm@freescale.com> you wrote: > Allow users to pass in extra defines via make so they can > modify the build. Example > > make P1022DS EXTRA_OPTS=NAND > > is equivalent to > > make P1022DS_NAND > > Signed-off-by: Matthew McClintock <msm@freescale.com> What would that be good for? I consider this not a good idea. NAK. Best regards, Wolfgang Denk
diff --git a/mkconfig b/mkconfig index 6ff533f..bc6ce06 100755 --- a/mkconfig +++ b/mkconfig @@ -81,6 +81,12 @@ if [ "${ARCH}" -a "${ARCH}" != "${arch}" ]; then exit 1 fi +if [ -z "${options}" ] ; then + options=$EXTRA_OPTS +else + options="$options,$EXTRA_OPTS" +fi + if [ "$options" ] ; then echo "Configuring for ${BOARD_NAME} - Board: ${CONFIG_NAME}, Options: ${options}" else @@ -146,7 +152,7 @@ else > config.h # Create new config file fi echo "/* Automatically generated - do not edit */" >>config.h - +TARGETS+=`echo $EXTRA_OPTS | tr ',' ' '` for i in ${TARGETS} ; do i="`echo ${i} | sed '/=/ {s/=/\t/;q } ; { s/$/\t1/ }'`" echo "#define CONFIG_${i}" >>config.h ;
Allow users to pass in extra defines via make so they can modify the build. Example make P1022DS EXTRA_OPTS=NAND is equivalent to make P1022DS_NAND Signed-off-by: Matthew McClintock <msm@freescale.com> --- v2: Fix tab indention, fix posix compliance mkconfig | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)