[Omake] Compiling Ada code

David Brown caml at davidb.org
Thu Oct 19 19:09:30 PDT 2006


On Thu, Oct 19, 2006 at 11:51:06AM -0700, Aleksey Nogin wrote:
>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?
>
>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.
>
>Most of the time, a dependency would belong to both classes 
>simultaneously, and the scanning setup does not try to distinguish 
>between the two (although it is possible to specify manually that a 
>certain dependency belongs to one class only - the :exists: flag can be 
>used to specify the dependencies that belong only to the first class and 
>the :optional: flag can be used for dependencies that belong to the 
>second class only).
>
>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?

My first question would be: what are you trying to do that gnatmake doesn't
solve?  Generally a makefile can just invoke gnatmake with the main module
and it will build the rest.  Attempts to do this with another dependency
manager wll almost always be wrong.  The rules in Ada are rather
compilcated, and even depend on compile time options (enabling inlining
creates a dependency on the body, instead of just the spec, for example).

GNAT's dependecies aren't really any different than they are for C.  (Most
other Ada compilers do this very differently).  However, GNAT was designed
around their tool gnatmake which knows how to parse the dependency
information generated by compilation.  There is nothing to scan before a
file is compiled.

The build-prerequisites would typically be generated source files.  These
are going to have to be specified manually, anyway.

So, I would recommend having the main program only depend on the generated
source files, as well as a phony target, with it's rule being the running
of gnatmake.  If you need to bind and link manually, you can ask gnatmake
to not do the link, and then do that manually.

Dave


More information about the Omake mailing list