help-make
[Top][All Lists]
Advanced

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

Re: generate a File-ID??


From: Paul D. Smith
Subject: Re: generate a File-ID??
Date: Mon, 3 Jul 2006 18:02:25 -0400

%% Torsten Mohr <address@hidden> writes:

  tm> Yes, correct.  But we'll also generate a list of sources per release
  tm> then.

This is going to be a pain as well: how can you generate this list if
make is computing the values?  Make does NOT have any functions that
deal with creating files... you'll have to do it through the shell.

You could modify your compiler script to append to a file after each
compile, but then you'd need to do some kind of sort/unique on that file
since incremental builds would duplicate filenames.  Also, this could be
a big problem if you support parallel builds.

And finally, this won't work so well with certain kinds of build tools
like ClearCase's clearmake, which "wink in" objects built by others
(which you probably don't care about but...)

  >> Also, what about files in different directories?

  tm> Yes, correct.  The $(subst) was just an example, i also would have
  tm> replaces / to _.

No, you misunderstood me.

If you have make generate the ID#'s, it can only start at 1 and
increment by one every time (unless you're going to do something like
generate a hash of the filename that fits into 32 bits--not a bad idea
as they will then always be the same).

However, each instance of make will have to start over again at 1, so
for every directory the first file will have the #1, etc.

Unless you (a) have an inclusive/non-recursive environment where there
is only one instance of make for your entire build, or (b) are using two
numbers: one for the directory (hardcoded in the makefile), or a
hardcoded offset for each directory to start with, you'll get duplicate
numbers.


Really, my best advice is to write a Perl script or similar that will go
through and generate the numbers file for your entire source tree
(either in makefile syntax that can be included or in a .h file).
Getting make to automatically generate it will be a big PITA.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "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]