[Omake] Compiling Ada code
Dirk Heinrichs
ext-dirk.heinrichs at nokia.com
Fri Oct 20 00:01:22 PDT 2006
Am Donnerstag, 19. Oktober 2006 20:51 schrieb ext Aleksey Nogin:
> On 19.10.2006 11:21, Dirk Heinrichs wrote:
> > The problem I have now is with dependency scanners. It seems that omake
> > always runs the scanner _before_ the actual compilation. This does not
> > work with Ada. Ada doesn't have the concept of header files, which are
> > included into C files. Instead, modules are pre-compiled units. This
> > means that I can get at the dependency information earliest _after_ a
> > unit has been compiled, like
> >
> > gnatmake -a -M -u <INCLUDES> file.o
>
> Can you elaborate a bit - what kind of dependencies exist for Ada?
Ada packages usually consist of a specification (spec) and a body. The spec
defines the interface to a package while the body implements the package.
Both need to be compiled before they can be used. When a body is compiled,
the spec is compiled automatically. This means, that when the spec changes
the package body and all clients of the package need to be recompiled.
OTOH, if only the body changes, one only needs to relink.
> Normally the dependencies are the files that either:
> 1) Need to exist _before_ the target can be built, or
> 2) Affect what the target will turn out to be.
>
> Of course, for the dependencies of the first kind, scanning needs to go
> first - we need to know what those dependencies are before we can
> attempt building the file. So, are you saying that (other than the
> source file itself) there are no build prerequisites in Ada and all the
> dependencies are necessarily of the second kind only?
No. I'm saying that you only can find out what are the build prerequisites
_after_ a file has been compiled. If I use the command above, I get the
usual dependency rule output, like I would get for a C file with gcc -M.
The difference is that for C, it works on source files while for Ada it
works on object files.
One way I could think of working around this is to do something like:
.SCANNER: %.o: %.adb
gnatgcc <options> $< -o $@ # compile the file
gnatmake -a -M -u <INCLUDES> $@ # get it's dependencies
%.o: %.adb
touch $@ # nothing to be done here, since the scanner compiled already
Bye...
Dirk
--
Dirk Heinrichs | Tel: +49 (0)162 234 3408
Configuration Manager | Fax: +49 (0)211 47068 111
Capgemini Deutschland | Mail: dirk.heinrichs at capgemini.com
Hambornerstraße 55 | Web: http://www.capgemini.com
D-40472 Düsseldorf | ICQ#: 110037733
GPG Public Key C2E467BB | Keyserver: www.keyserver.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.metaprl.org/pipermail/omake/attachments/20061020/6bbd5c7e/attachment.bin
More information about the Omake
mailing list