From: Thomas Monjalon <thomas@monjalon.net>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v5] devtools: add tags and cscope index file generation support
Date: Fri, 28 Apr 2017 10:50:20 +0200 [thread overview]
Message-ID: <8009775.Gk3kvYMmnN@xps> (raw)
In-Reply-To: <1490171404-16828-1-git-send-email-jerin.jacob@caviumnetworks.com>
Hi,
I have some comments about behaviour, naming and coding style.
22/03/2017 09:30, Jerin Jacob:
> +verbose=false
> +linuxapp=false
> +bsdapp=false
linuxapp/bsdapp could be renamed to simpler linux/bsd.
> +x86_64=false
> +arm=false
Why not arm32 for consistency?
> +arm64=false
> +ia_32=false
ia_32 should be x86_32
> +ppc_64=false
[...]
> + make showconfigs | sed 's,^,\t,'
This is assuming the working dir is the dpdk root.
It is assumed elsewhere in the script.
I suggest adding "cd $(dirname $0)/.." at the beginning of the script.
[...]
> +arm_common()
> +{
> + find_sources "lib/librte_eal/common/arch/arm" '*.[chS]'
> + find_sources "$source_dirs" '*neon*.[chS]'
> +}
> +
> +arm_sources()
> +{
> + arm_common
> + find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
> + "$skip_64b_files"
> +}
> +
> +arm64_sources()
> +{
> + arm_common
> + find_sources "lib/librte_eal/common/include/arch/arm" '*.[chS]' \
> + "$skip_32b_files"
> + find_sources "$source_dirs" '*arm64.[chS]'
> +}
Same comment about arm32 consistency.
> +ia_common()
> +{
> + find_sources "lib/librte_eal/common/arch/x86" '*.[chS]'
> +
> + find_sources "examples/performance-thread/common/arch/x86" '*.[chS]'
> + find_sources "$source_dirs" '*_sse*.[chS]'
> + find_sources "$source_dirs" '*_avx*.[chS]'
> + find_sources "$source_dirs" '*x86.[chS]'
> +}
> +
> +i686_sources()
> +{
> + ia_common
> + find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
> + "$skip_64b_files"
> +}
> +
> +x86_64_sources()
> +{
> + ia_common
> + find_sources "lib/librte_eal/common/include/arch/x86" '*.[chS]' \
> + "$skip_32b_files"
> +}
... and here x86/x86_32 instead of ia/i686
> +config_file()
> +{
> + if [ -f $RTE_SDK/$RTE_TARGET/include/rte_config.h ]; then
> + ls $RTE_SDK/$RTE_TARGET/include/rte_config.h
> + fi
> +}
RTE_TARGET is used to define the build directory.
It will not be defined in this script and it does not really
make sense to enforce it.
I suggest to remove rte_config.h from this script.
Other argument: you can have several build directories
with different configs.
[...]
> +check_valid_config()
It is not a config but a target.
Yes the target is checked against existing config template names.
> +{
> + cfgfound=false
> + allconfigs=$(make showconfigs)
> + for cfg in $allconfigs
> + do
This "do" keyword could be on the previous line, like you did for if...then.
> + if [ "$cfg" = "$1" ] ; then
> + cfgfound=true
> + fi
> + done
> + $cfgfound || echo "Invalid config: $1"
> + $cfgfound || print_usage
> + $cfgfound || exit 0
Better to use an "if" block here.
[...]
> + if [ $(echo $2 | grep -c "linuxapp-") -gt 0 ]; then
> + linuxapp=true
> + fi
More compact grep:
if echo $2 | grep -q "linuxapp-" ; then
[...]
> +else
> + linuxapp=true
> + bsdapp=true
> + x86_64=true
> + arm=true
> + arm64=true
> + ia_32=true
> + ppc_64=true
> +fi
You could define them as true by default.
So the above grep would become:
echo $2 | grep -q "linuxapp-" || linux=false
[...]
> +all_sources()
> +{
> + common_sources
> + $linuxapp && linuxapp_sources
> + $bsdapp && bsdapp_sources
> + $x86_64 && x86_64_sources
> + $ia_32 && i686_sources
> + $arm && arm_sources
> + $arm64 && arm64_sources
> + $ppc_64 && ppc64_sources
I am a bit surprised by these constructs.
When using sh -e, we should not have a false statement.
I think it should be:
if $linuxapp ; then linuxapp_sources ; fi
[...]
> +show_flags()
> +{
> + $verbose && echo "mode: $1"
> + $verbose && echo "config: $2"
> + $verbose && echo "linuxapp: $linuxapp"
> + $verbose && echo "bsdapp: $bsdapp"
> + $verbose && echo "ia_32: $ia_32"
> + $verbose && echo "x86_64: $x86_64"
> + $verbose && echo "arm: $arm"
> + $verbose && echo "arm64: $arm64"
> + $verbose && echo "ppc_64: $ppc_64"
Please use an "if" block here.
> +++ b/mk/rte.sdkroot.mk
> +.PHONY: cscope gtags tags etags
> +cscope gtags tags etags:
> +ifdef T
> + $(Q)$(RTE_SDK)/devtools/build-tags.sh $@ ${T}
> +else
> + $(Q)$(RTE_SDK)/devtools/build-tags.sh $@
> +endif
No need of ifdef.
Thanks Jerin
next prev parent reply other threads:[~2017-04-28 8:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-27 0:12 [dpdk-dev] [PATCH] tools: " Jerin Jacob
2016-11-28 5:50 ` Yuanhan Liu
2017-01-12 14:19 ` Ferruh Yigit
2017-01-13 2:50 ` Jerin Jacob
2017-01-13 12:23 ` Mcnamara, John
2017-01-17 8:41 ` [dpdk-dev] [PATCH v2] " Jerin Jacob
2017-02-27 14:18 ` Thomas Monjalon
2017-02-28 14:12 ` Jerin Jacob
2017-03-01 10:51 ` Thomas Monjalon
2017-03-13 14:18 ` [dpdk-dev] [PATCH v3] devtools: " Jerin Jacob
2017-03-19 10:52 ` [dpdk-dev] [PATCH v4] " Jerin Jacob
2017-03-20 10:15 ` Dumitrescu, Cristian
2017-03-21 4:05 ` Jerin Jacob
2017-03-22 8:30 ` [dpdk-dev] [PATCH v5] " Jerin Jacob
2017-04-14 12:44 ` Jerin Jacob
2017-04-28 8:50 ` Thomas Monjalon [this message]
2017-04-29 10:51 ` [dpdk-dev] [PATCH v6] " Jerin Jacob
2017-04-30 10:45 ` Thomas Monjalon
2017-04-30 11:00 ` Thomas Monjalon
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=8009775.Gk3kvYMmnN@xps \
--to=thomas@monjalon.net \
--cc=dev@dpdk.org \
--cc=jerin.jacob@caviumnetworks.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).