help-make
[Top][All Lists]
Advanced

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

Re: Getting list of source files from directory hierarchy


From: Michael Morrell
Subject: Re: Getting list of source files from directory hierarchy
Date: Mon, 28 Sep 2009 13:50:17 -0700 (PDT)

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 <address@hidden> wrote:

> From: Paul Smith <address@hidden>
> Subject: Re: Getting list of source files from directory hierarchy
> To: address@hidden
> Cc: address@hidden
> 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 <address@hidden> 
>         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
>




reply via email to

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