From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ab5f27c42c253ac5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!fr.ip.ndsoftware.net!fu-berlin.de!uni-berlin.de!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: GNAT and GNU build system Date: Tue, 10 Aug 2004 17:18:02 +0100 Message-ID: References: <87n0157kp0.fsf@insalien.org> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; delsp=yes; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.uni-berlin.de eJWHy6U51PB0O1A+FDjcWQFuioL2kI4AbVnyZ/5nF82aW/yN4= User-Agent: Opera M2/7.51 (Win32, build 3798) Xref: g2news1.google.com comp.lang.ada:2653 Date: 2004-08-10T17:18:02+01:00 List-Id: On Sun, 08 Aug 2004 16:45:15 +0200, Ludovic Brenta wrote: > The usual way to do configuration management in Ada in these > situations is to have several bodies for a single spec, and choose > one body when configuring. This can be done in several ways. The > GNAT way is to symlink the file containing the particular body to > the canonical name. For example, one body is "5msystem.ads" and it > is symlinked to "system.ads" before building. This however is done > from the Makefile and does not, per se, require a configure script. I think I might be repeating what someone has already said, but Ada itself provides a way of doing this, via renamings (which is what a symlink is, in essence). If your program has a set of packages (say My.Foo, My.Bar, and My.Hum) which all have different bodies corresponding to three different configurations (say A, B, and C), then you could write nine packages (My.Foo_for_A, My.Foo_for_B, ..., My.Hum_for_C), and put three renamings into each of three files (named, say, "config_x.ada") as part of the library for configuration x as follows: package My.Foo renames My.Foo_for_x; package My.Bar renames My.Bar_for_x; package My.Hum renames My.Hum_for_x; and then all other source text in the program can simply refer to My.Foo, My.Bar, and My.Hum. To recompile with a different configuration, you only have to change one file in the compilation. I'm sure a simple script could automate this job. Alternatively, a more sophisticated script could generate the sequence of renamings according to a complicated set of configuration requirements or environment characteristics). A Unix program called 'm4' could be useful for this purpose. Note that this technique permits the package specifications to vary between configurations, as well as the body. It is sometimes useful to be able to do this (for example, there may be differences in the private parts). -- Nick Roberts