help-make
[Top][All Lists]
Advanced

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

Getting list of source files from directory hierarchy


From: Michael Morrell
Subject: Getting list of source files from directory hierarchy
Date: Fri, 25 Sep 2009 18:42:33 -0700 (PDT)

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.

Thanks,

  Michael




reply via email to

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