Loading...

help-make@gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Auto-checkout a file from RCS that is used to construct a prerequisites list Richard Bassett Thu Jul 02 08:00:17 2009

Background: I'm bootstrapping a Domain-specific language and I'm trying to automate a full build, where make checks all the required files out from RCS. My DSL has a simple preprocessor for textual substitution and currently I allow a file named _WITHTAB.PP in a source subdirectory to specify a list of 'preprocessor substitution tables' to apply to all the sources in that subdirectory.

This means that the targets produced from each source file in a directory depend on any _WITHTAB.PP file in that directory and on the 'preprocessor substitution tables to apply' that are listed in the _WITHTAB.PP file.

So, I tried to handle that in my makefile like this:

   # ---------------------------------------------------------------
   # INTRA-DIRECTORY DEPENDENCY OF ALL DSL CODE ON THE _WITHTAB.PP FILE
   # (IN THE DIRECTORY) PLUS THE SUBSTITUTION TABLES LISTED IN THAT FILE
   # (WHICH MAY BE LOCATED IN THE DIRECTORY OR ELSEWHERE)
   # Remember - changing the list of preprocessor substitution tables
   # that is applied can change the results without any of the actual
   # tables changing.
   # Note a _WITHTAB.PP dependency is simply on a text file and no
   # targets are built from the _WITHTAB.PP files themselves.
   # We generate the list of table targets by taking the content of
   # _WITHTAB.PP (commalist of simple names) and manipulating the text.

   $(msg_dsl_targets) : msg/_WITHTAB.PP $(patsubst
   %,$(target)%.tabo,$(subst $(comma),$(space),$(shell cat
   msg/_WITHTAB.PP)))


As is probably obvious, the _WITHTAB.PP file contains a commalist of simple names such as "STD,T1,T2" and I'm just transforming that into a space-separated list of the prerequisite targets (that will be built from the source 'substitution tables') such as "STD.tabo T1.tabo T2.tabo"

This seems just fine in my development environment where the _WITHTAB.PP file already exists. My problem is that when I try and build in some other 'clean' environment and I want make to fetch all the source from RCS automatically, I get the following error:

   cat: msg/_WITHTAB.PP: No such file or directory


Now, I *think* I understand this - I'm assuming that make wants to process all the rules and construct its 'database' before actually taking any actions such as fetching something from RCS.

So, if I have understood correctly, my problem is that I somehow need to get make to fetch the msg/_WITHTAB.PP file from RCS *before* constructing those dependencies in which the file itself participates.. but I'm not quite clear if that's possible or how one would go about it.

I can see that what I'm doing is conceptually similar to include-ing another makefile except that my _WITHTAB.PP file is not in fact a makefile fragment. So I wonder if there's some trick possible with include maybe - but again I can't quite see how to make it happen!

I can also see there is an analogy with an #included C header file that #includes other header files and that leads me to think that I could manually maintain say a _WITHTAB.d file alongside each _WITHTAB.PP file - ie. _WITHTAB.d would be an includeable makefile fragment that just expressed the dependency of _WITHTAB.PP on the items listed therein.

But then I'd have to maintain two files, sacrilege.

So I guess my question is whether there is some technique I can use to get the effect I want within one run of make or whether for example I should look instead at running some little makefile that generates _WITHTAB.d files from my _WITHTAB.PP files and *then* running my main makefile which can include the _WITHTAB.d files.

I hope that's clear enough, I have a feeling it's a bit tortuous..

Thank you in advance for any help!
Richard


_______________________________________________
Help-make mailing list
[EMAIL PROTECTED]
http://lists.gnu.org/mailman/listinfo/help-make