help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to use shell builtin command in Makefile?


From: Paul Smith
Subject: Re: How to use shell builtin command in Makefile?
Date: Wed, 22 Oct 2008 09:48:15 -0400

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 */.)))

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.mad-scientist.us
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

[Prev in Thread] Current Thread [Next in Thread]