[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to use shell builtin command in Makefile?
From: |
Peng Yu |
Subject: |
Re: How to use shell builtin command in Makefile? |
Date: |
Wed, 22 Oct 2008 09:00:21 -0500 |
On Wed, Oct 22, 2008 at 8:48 AM, Paul Smith <address@hidden> wrote:
> On Wed, 2008-10-22 at 08:24 -0500, Peng Yu wrote:
>> The reason that I want to use 'compgen' rather than 'find' is that I
>> think it is faster than 'find', since it's a bash builtin command. I'm
>> not sure whether this is a good enough reason to use it. Do you have
>> any idea?
>
> It probably is marginally faster. I doubt, for this situation, whether
> it will make a noticeable difference (especially if you change the =
> to := as I suggested... that will make MUCH more difference to
> performance). Of course there's only one way to know: measure it. In
> general it's quite useless to try to solve performance problems before
> you know what's causing them. Premature optimization is a sure way to
> waste a lot of development time and effort.
>
> However, if this IS a big performance difference then only you can
> decide whether being portable is more or less important than the
> performance increase. We don't know your environment.
>
> Note that not even all Linux distributions use bash as /bin/sh, much
> less other versions of UNIX/POSIX systems, so the portability problems
> are quite real.
>
>
> BTW, if I'm reading your code right I think you could get even better
> efficiency in a more portable way by using make builtin functions rather
> than $(shell ...); maybe something like:
>
> SUBDIRS := $(filter-out backup bash,$(patsubst %/.,%,$(wildcard */.)))
This would give something other than directories. Is there a way in
make to get only directory names?
Thanks,
Peng
Re: How to use shell builtin command in Makefile?, Greg Chicares, 2008/10/22
Re: How to use shell builtin command in Makefile?, Paul Smith, 2008/10/22