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: John Calcote
Subject: Re: Getting list of source files from directory hierarchy
Date: Mon, 28 Sep 2009 16:40:09 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.4pre) Gecko/20090915 Thunderbird/3.0b4

Hi Paul,

On 9/28/2009 3:22 PM, Paul Smith wrote:
On Mon, 2009-09-28 at 13:50 -0700, Michael Morrell wrote:
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).
Actually, this behavior is discouraged (at least by me).  In reality
there's NO completely reliable way to automatically determine what
source files you want to build: there could always be backup files or
test files or other temporary files that happen to match whatever
pattern you come up with.

In my book, a build system that is not completely reliable is very, very
bad.

Whenever I'm asked about this I _always_ say, just list the files you
want to build explicitly in your makefile, or somewhere.  It's not
onerous to keep this list up to date (how often are brand new files
added, anyway?) and it saves a lot of headache and hassle.

I've had at least one case in my past where it was more than a little painful to list all source files manually. One such case involved a large build system wherein dozens of C source files where generated by an external code generator (that happened to be written in Java, no less). These file names were all long and ugly because they were a munge of operation codes applied during generation. A given generation could change the name of the files in subtle ways.

Now, I know what you're going to say: If they're generated, then they're not sources. I agree, but the file generation process was actually done on a secure machine with a different build system. Not the best idea, I know, but it was there before I got there, and I had to work with it.

Other than for situations like this, I whole-heartedly agree with your sentiments. :)

John





reply via email to

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