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