I was wide open to ideas on ways people deal with not wanting to hardcode
a list of source filenames in the Makefiles.  I thought this was common
enough that perhaps there was a builtin make function to help out (I did
look through the manual and didn't see anything, but I could have easily
missed it).

  Michael

--- On Sat, 9/26/09, Paul Smith <[email protected]> wrote:

> From: Paul Smith <[email protected]>
> Subject: Re: Getting list of source files from directory hierarchy
> To: [email protected]
> Cc: [email protected]
> Date: Saturday, September 26, 2009, 6:58 PM
> On Fri, 2009-09-25 at 18:42 -0700,
> Michael Morrell wrote:
> > I have some Makefiles that want to get a list of all
> source files in
> > a directory hierarchy and currently use:
> > 
> > SRCS := $(shell find . -name '*.c')
> > OBJS := $(SRCS:.c=.o)
> > 
> > The problem with this is that the output from find
> isn't deterministic,
> > which means the objects files can get linked into the
> final executable in
> > an arbitrary order and I want the result to be
> identical from run to run
> > from the same source.
> > 
> > My current fix for this is:
> > 
> > SRCS := $(shell find . -name '*.c' | sort)
> > 
> > but I was wondering if anyone could suggest a better
> method.
> 
> I'm not sure what you mean by "better"; what would be
> better?
> 
> Anyway, I can't think of any other way to do it (you could
> use GNU
> make's $(sort ...) function if you wanted but I don't think
> there's much
> point... and it's probably less efficient than using the
> shell's sort in
> this situation).
> 
> -- 
> -------------------------------------------------------------------------------
>  Paul D. Smith <[email protected]> 
>         Find some GNU make tips at:
>  http://www.gnu.org         
>             http://make.mad-scientist.net
>  "Please remain calm...I may be mad, but I am a
> professional." --Mad Scientist
>


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to