comp.lang.ada
 help / color / mirror / Atom feed
* Using GNU make with ObjectAda
@ 2003-09-04 22:16 Tim Spargo
  2003-09-05 12:13 ` Georg Bauhaus
  2003-09-06 20:42 ` Guillaume Foliard
  0 siblings, 2 replies; 13+ messages in thread
From: Tim Spargo @ 2003-09-04 22:16 UTC (permalink / raw)


Hi,

I am relatively new to Ada (from the Dark side - C++). I am trying to use
GNU make to create a makefile for some ObjectAda projects I am working on.

Through a combination of GNU make (3.80) and Perl (5.8), I have made
progress and have a working makefile, however the outstanding issue is
automatically generating dependencies. The problem is I need to selectively
generate all dependencies of a particular Ada file pair, which is a subset
of just getting a list of all .ads and .adb files in a particular directory
(which can be done using vpath with pattern matching in GNU make). I am
trying to avoid reinventing the wheel by building a dependancy tree in Perl.

Since I have no choice but to use ObjectAda (7.2 - old), I believe that this
excludes use of the GNAT tool set which supports automatic dependency
generation using the gcc "-M" option. In fact I quickly tried to use
gnatmake on the project and for various reasons the code base will not
compile under gnatmake. gcc needs to be able to compile an Ada file before
it can generate dependencies for it. Perhaps I need to look into this
more...

ObjectAda itself is designed to be GUI driven and therefore all files within
a particular project are added manually by the user. Once added to the
project, the files are added to the UNIT.MAP file. The ObjectAda CLI
commands (i.e. adareg, adamake, adabuild, etc) manipulate this and other
files to determine the dependency list. I don't believe the ObjectAda tools
support "-M" or similar functionality, since essentially they work around
the need for automatic dependancies it in a simplistic way.

Any thoughts from the learned Ada people out there would be appreciated...
Even a general direction would be helpful...





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-04 22:16 Using GNU make with ObjectAda Tim Spargo
@ 2003-09-05 12:13 ` Georg Bauhaus
  2003-09-06 12:21   ` Tim Spargo
  2003-09-06 20:42 ` Guillaume Foliard
  1 sibling, 1 reply; 13+ messages in thread
From: Georg Bauhaus @ 2003-09-05 12:13 UTC (permalink / raw)


Tim Spargo <tim.spargo@no_spamsympatico.ca> wrote:
: Hi,
: 
: I am relatively new to Ada (from the Dark side - C++). I am trying to use
: GNU make to create a makefile for some ObjectAda projects I am working on.

Out of curiosity, why are you trying to generate a make file?
Dependences are usually checked by the translation tools that one
is using, aren't they? So a makefile might be needed to switch
include paths, but for dependces?

Georg



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-05 12:13 ` Georg Bauhaus
@ 2003-09-06 12:21   ` Tim Spargo
  2003-09-06 13:00     ` Marin David Condic
  2003-09-06 14:37     ` Ludovic Brenta
  0 siblings, 2 replies; 13+ messages in thread
From: Tim Spargo @ 2003-09-06 12:21 UTC (permalink / raw)


Hmm... speaking in general, if by "translation tools" I assume you mean
compilers, linkers etc. then compilers can normally generate dependencies
(in C/C++ with the "-M" option previously mentioned) for a particular source
file. But normally it is up to the make file to rebuild an entire project.
For example if a single header/spec file has changed, which files in the
project need to be rebuilt? The compiler doesn't know this. Of course these
files may be in different directories etc. So the makefile is needed to
capture the dependency relationships between the project files.

Specific to ObjectAda, they have created a build system which takes the
place of make files. I discussed this a bit in my earlier post. In my case I
need to unit test individual files and therefore need to use the CLI to
dynamically determine the dependency list of just a few files within a
larger project. In addition I need to compile and link in automatically
generated test code to do the unit testing. So I need to automatically
register these files and their dependencies with the ObjectAda toolset in
order for it to perform the build.

What is missing for me is a way to generate the dependencies of a single Ada
source file, which would then feed into the makefile to perform a rebuild.
My version of the ObjectAda toolset (as I said, I have to use an older 7.2
version) does not appear to support this. The GNAT compiler does automatic
dependency generation, but I am unable to use it.

Tim

"Georg Bauhaus" <sb463ba@d2-hrz.uni-duisburg.de> wrote in message
news:bj9ulk$obi$1@a1-hrz.uni-duisburg.de...
> Tim Spargo <tim.spargo@no_spamsympatico.ca> wrote:
> : Hi,
> :
> : I am relatively new to Ada (from the Dark side - C++). I am trying to
use
> : GNU make to create a makefile for some ObjectAda projects I am working
on.
>
> Out of curiosity, why are you trying to generate a make file?
> Dependences are usually checked by the translation tools that one
> is using, aren't they? So a makefile might be needed to switch
> include paths, but for dependces?
>
> Georg





^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-06 12:21   ` Tim Spargo
@ 2003-09-06 13:00     ` Marin David Condic
  2003-09-06 14:37     ` Ludovic Brenta
  1 sibling, 0 replies; 13+ messages in thread
From: Marin David Condic @ 2003-09-06 13:00 UTC (permalink / raw)


Actually, with Ada, it *does* know. You could try it by experimentation 
- build some relatively small chain of dependencies starting with some 
main program, then compile it. From there, edit one specification 
somewhere down the food chain. Then tell the system to rebuild. Dollars 
to doughnuts, the Ada compiler should discover that the spec you edited 
is out of date and recompile just the stuff that depends on it.

I'm not that familiar with ObjectAda (although I am going down that 
direction for a project at work) so I can't tell you for sure how that 
is accomplished with that compiler. Its just that the standard says it 
should have some means of doing so. With GNAT Ada, I *know* this works - 
even across directories (provided they are in the search path.) An 
edited spec will cause the gnatmake tool to figure out exactly what 
needs to be compiled and it will do so.

In C++ and other languages, make files may be more of a necessity. With 
Ada, I've never had to do that. I've just had to learn how to get the 
particular compiler I was working with to do it for me.

MDC


Tim Spargo wrote:
> file. But normally it is up to the make file to rebuild an entire project.
> For example if a single header/spec file has changed, which files in the
> project need to be rebuilt? The compiler doesn't know this. Of course these
> files may be in different directories etc. So the makefile is needed to
> capture the dependency relationships between the project files.

-- 
======================================================================
Marin David Condic
I work for: http://www.belcan.com/
My project is: http://www.jast.mil/

Send Replies To: m c o n d i c @ a c m . o r g

     "In general the art of government consists in taking as
     much money as possible from one class of citizens to give
     to the other."

         --  Voltaire
======================================================================




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-06 12:21   ` Tim Spargo
  2003-09-06 13:00     ` Marin David Condic
@ 2003-09-06 14:37     ` Ludovic Brenta
  2003-09-07 20:42       ` Robert I. Eachus
  2003-09-15  4:16       ` Dave Thompson
  1 sibling, 2 replies; 13+ messages in thread
From: Ludovic Brenta @ 2003-09-06 14:37 UTC (permalink / raw)


"Tim Spargo" <tim.spargo@NO_SPAMsympatico.ca> writes:

> Hmm... speaking in general, if by "translation tools" I assume you mean
> compilers, linkers etc. then compilers can normally generate dependencies
> (in C/C++ with the "-M" option previously mentioned) for a particular source
> file. But normally it is up to the make file to rebuild an entire project.

Not true.  Make files were invented only to overcome the shortcomings
of the C language with respect to separate compilation, and C++
happily kept these shortcomings.

> For example if a single header/spec file has changed, which files in the
> project need to be rebuilt? The compiler doesn't know this.

An Ada compiler does know this; Java compilers also make an attempt at
this, but IMHO are not very good at it.

> Of course these files may be in different directories etc. So the
> makefile is needed to capture the dependency relationships between
> the project files.

Again, this is not true of Ada compilers.

In Ada, you have the concept of a "library" of compilation units
(packages or subprograms that are "at library level"); the Ada
compiler is in charge of maintaining this library and making sure the
units it contains remain consistent with one another.  It is this
"library" that lets the compiler keep track of where source files are.

In Ada, separate compilation, as well as the rules for consistency,
are defined by the language (the ARM devotes the entire Chapter 10,
"Program Structure and Compilation Issues", to this).

In C and C++, separate compilation is defined not by the language but
by the particular tools ("make" and linker) you use.  For example, the
ISO C99 standard defines the "extern" keyword (6.2), external
definitions (6.9), and the #include preprocessor directive (6.10.2)
but does not define how object files must be linked together, much
less any rules for consistency.  "make" provides you with a separate
language and interpreter (very different from C) that allows you to
describe the relationships between your source and object files.  Not
only is "make" not part of C/C++, you can even use alternatives such
as "ant" or "cook".

As P.J. Plaugher once said, "above 100,000 lines of code, we should
all be coding in Ada".

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-04 22:16 Using GNU make with ObjectAda Tim Spargo
  2003-09-05 12:13 ` Georg Bauhaus
@ 2003-09-06 20:42 ` Guillaume Foliard
  2003-09-08 13:48   ` Stephen Leake
  1 sibling, 1 reply; 13+ messages in thread
From: Guillaume Foliard @ 2003-09-06 20:42 UTC (permalink / raw)


Tim Spargo wrote:

> Hi,
> 
> I am relatively new to Ada (from the Dark side - C++). I am trying to use
> GNU make to create a makefile for some ObjectAda projects I am working on.
> .........
> Any thoughts from the learned Ada people out there would be appreciated...
> Even a general direction would be helpful...

I do not understand why you want to generate dependencies. I'm using the
command line version of ObjectAda under Unix everyday for more than 3 years
now and I _never_ had to do this. Here is what to do :

adareg <list of Ada files>
adabuild <unit>

That's all.
For Gnat users, adabuild is more or less the equivalent of gnatmake, adareg
is a tool which registers the source files in the Ada compilation library.
This registering step is needed as ObjectAda does not enforce a naming
scheme on source files.

-- 
Guillaume



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-06 14:37     ` Ludovic Brenta
@ 2003-09-07 20:42       ` Robert I. Eachus
  2003-09-15  4:16       ` Dave Thompson
  1 sibling, 0 replies; 13+ messages in thread
From: Robert I. Eachus @ 2003-09-07 20:42 UTC (permalink / raw)


Ludovic Brenta wrote:

> In Ada, you have the concept of a "library" of compilation units
> (packages or subprograms that are "at library level"); the Ada
> compiler is in charge of maintaining this library and making sure the
> units it contains remain consistent with one another.  It is this
> "library" that lets the compiler keep track of where source files are.

(If you are not a language lawyer, you can skip the rest of this post.)

No, the Ada compiler is responsible for identifying a set of consistant 
library units that the unit being compiled depends on, and insuring that 
the closure of that set at run-time is consistant.  It is perfectly 
legal for the library to contain mutually inconsistant library units and 
subunits.

The usual effect of this rule is that at "link time" which is not an Ada 
term, the implementation recognizes inconsistancies and causes the 
necessary units to be recompiled.  (With GNAT, this is the job of 
gnatmake, to find out what is inconsistant and call the compiler on 
those units in an order consistant with the language rules.)

But as I said at the beginning, only language lawyers need think about 
the fact that a library unit, body, or subunit may be inconsistant with 
library units it does not depend on.  (For example, during a series of 
compilations.)

-- 
                                               Robert I. Eachus

"As far as I'm concerned, war always means failure." -- Jacques Chirac, 
President of France
"As far as France is concerned, you're right." -- Rush Limbaugh




^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: Using GNU make with ObjectAda
@ 2003-09-08  9:00 Lionel.DRAGHI
  0 siblings, 0 replies; 13+ messages in thread
From: Lionel.DRAGHI @ 2003-09-08  9:00 UTC (permalink / raw)
  To: comp.lang.ada



| -----Message d'origine-----
| De: Tim Spargo [mailto:tim.spargo@NO_SPAMsympatico.ca]
...
| What is missing for me is a way to generate the dependencies 
| of a single Ada
| source file, which would then feed into the makefile to 
| perform a rebuild.
| My version of the ObjectAda toolset (as I said, I have to use 
| an older 7.2
| version) does not appear to support this. The GNAT compiler 
| does automatic
| dependency generation, but I am unable to use it.
| 
Does your adareg version have the -s|b switch?

    -s unit_name        Autoregister files in search of 'unit_name' DECL.
    -b unit_name        Autoregister files in search of 'unit_name' BODY.

One more question : why isn't it possible to simply build the test with the
adabuild command?

-- 
Lionel Draghi 




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-06 20:42 ` Guillaume Foliard
@ 2003-09-08 13:48   ` Stephen Leake
  2003-09-08 22:22     ` Guillaume Foliard
  0 siblings, 1 reply; 13+ messages in thread
From: Stephen Leake @ 2003-09-08 13:48 UTC (permalink / raw)


Guillaume Foliard <guifo@wanadoo.fr> writes:

> Tim Spargo wrote:
> 
> > Hi,
> > 
> > I am relatively new to Ada (from the Dark side - C++). I am trying to use
> > GNU make to create a makefile for some ObjectAda projects I am working on.
> > .........
> > Any thoughts from the learned Ada people out there would be appreciated...
> > Even a general direction would be helpful...
> 
> I do not understand why you want to generate dependencies. I'm using the
> command line version of ObjectAda under Unix everyday for more than 3 years
> now and I _never_ had to do this. Here is what to do :
> 
> adareg <list of Ada files>
> adabuild <unit>
> 
> That's all.

There's more to real projects than just creating the main Ada
executable.

You also have to run the unit tests, and see if they pass.

You also have to run any preprocessors needed (gnatprep, Auto_Text_IO,
whatever). 

You may want to generate tar files for source distribution.

You may want to interact with the CM system.

Makefiles are very good for all of these other tasks.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-08 13:48   ` Stephen Leake
@ 2003-09-08 22:22     ` Guillaume Foliard
  2003-09-09  0:05       ` Ludovic Brenta
  2003-09-09 13:38       ` Stephen Leake
  0 siblings, 2 replies; 13+ messages in thread
From: Guillaume Foliard @ 2003-09-08 22:22 UTC (permalink / raw)


Stephen Leake wrote:
> Guillaume Foliard <guifo@wanadoo.fr> writes:
>> I do not understand why you want to generate dependencies. I'm using the
>> command line version of ObjectAda under Unix everyday for more than 3
>> years now and I _never_ had to do this. Here is what to do :
>> 
>> adareg <list of Ada files>
>> adabuild <unit>
>> 
>> That's all.
> 
> There's more to real projects than just creating the main Ada
> executable.
> 
> You also have to run the unit tests, and see if they pass.
> 
> You also have to run any preprocessors needed (gnatprep, Auto_Text_IO,
> whatever).
> 
> You may want to generate tar files for source distribution.
> 
> You may want to interact with the CM system.
> 
> Makefiles are very good for all of these other tasks.

I feel my answer was too short, or maybe my english is awkward, please
forgive me. I was not telling not to use Makefiles, but I was suprised to
see that one could wonder about generating Ada source files dependencies
like in C. And of course I'm a strong advocate at my workplace of Makefiles
use instead of half-baked shell scripts, for all the hereabove tasks you're
describing. Except interacting with a CM system, maybe. Could you elaborate
on this one ? I'm rather used to the development model of the free software
world and I don't see any immediate advantages of performing CM tasks
through a build system.

-- 
Guillaume



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-08 22:22     ` Guillaume Foliard
@ 2003-09-09  0:05       ` Ludovic Brenta
  2003-09-09 13:38       ` Stephen Leake
  1 sibling, 0 replies; 13+ messages in thread
From: Ludovic Brenta @ 2003-09-09  0:05 UTC (permalink / raw)


Guillaume Foliard <guifo@wanadoo.fr> writes:

> Could you elaborate on this one ? I'm rather used to the development
> model of the free software world and I don't see any immediate
> advantages of performing CM tasks through a build system.

If you want to do reproducible builds, you check out from the CM
system into a fresh set of source files and rebuild the world from it.
Preferably, you do all of this automatically in a cron job and log the
results.  In Ada, the compiler performs a first set of integration
tests.  Normally, after your cron job has made the build, it goes on
to execute unit test suites, then feature tests, then system tests.
Debian uses this kind of setup to rebuild packages every night on its
build farm.

-- 
Ludovic Brenta.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-08 22:22     ` Guillaume Foliard
  2003-09-09  0:05       ` Ludovic Brenta
@ 2003-09-09 13:38       ` Stephen Leake
  1 sibling, 0 replies; 13+ messages in thread
From: Stephen Leake @ 2003-09-09 13:38 UTC (permalink / raw)


Guillaume Foliard <guifo@wanadoo.fr> writes:

> I feel my answer was too short, 

That often happens with newsgroups :).

> I'm a strong advocate at my workplace of Makefiles use
> instead of half-baked shell scripts, for all the hereabove tasks
> you're describing. Except interacting with a CM system, maybe. Could
> you elaborate on this one ? 

Well, most of my interactions with the CM system are thru Emacs, but I
use a Makefile to apply a tag for the final release; it helps to have
a documented way to do that.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Using GNU make with ObjectAda
  2003-09-06 14:37     ` Ludovic Brenta
  2003-09-07 20:42       ` Robert I. Eachus
@ 2003-09-15  4:16       ` Dave Thompson
  1 sibling, 0 replies; 13+ messages in thread
From: Dave Thompson @ 2003-09-15  4:16 UTC (permalink / raw)


On 06 Sep 2003 16:37:31 +0200, Ludovic Brenta
<ludovic.brenta@skynet.be> wrote:

> "Tim Spargo" <tim.spargo@NO_SPAMsympatico.ca> writes:
<snip>
> Not true.  Make files were invented only to overcome the shortcomings
> of the C language with respect to separate compilation, and C++
> happily kept these shortcomings.
> 
The make tool and its files were invented originally in the Unix
environment primarily for C, but FORTRAN of the day had the same
issues which make also could be and was used to solve.  So did most if
not all assemblers, and PL/I, which were all of the languages you were
likely to separately compile and link together other than COBOL, which
partly evaded the issue by having only character-structured data, and
maybe Pascal, which mostly had its own private tools.

C++ didn't directly set out to fix any of these issues, but in order
to provide overloaded functions the original implementation and AFAIK
all since use(d) name mangling which provides *partial* checks on
consistency for functions, but not for class contents (members), and
particularly the classes functions/methods operate on.

<snip>
> In Ada, separate compilation, as well as the rules for consistency,
> are defined by the language (the ARM devotes the entire Chapter 10,
> "Program Structure and Compilation Issues", to this).
> 
> In C and C++, separate compilation is defined not by the language but
> by the particular tools ("make" and linker) you use.  For example, the
> ISO C99 standard defines the "extern" keyword (6.2), external
> definitions (6.9), and the #include preprocessor directive (6.10.2)

All keywords as such are in 6.4.1, and the syntax(es) using the extern
keyword are in 6.7.1 and 6.9.1; but it is actually external *linkage*
that matters, defined by 6.2.2 and 6.7.1 (and a little bit by 6.7.4),
and linkage is only loosely, er, linked to the keyword:  you can have
external linkage without using the keyword, and in some particularly
silly cases you can use the keyword without getting external linkage.
Note that 6.9 "external definitions" really means library-level (Ada)
or file-scope (C), not necessarily external in the sense of crossing
compilation units.

> but does not define how object files must be linked together, much
> less any rules for consistency.  

It does give rules requiring the *program* to be consistent about
(external) functions and variables, primarily 6.5.2.2 and 6.5
respectively.  (Remember in C function includes procedure.) What it
does not require is any implementation (compiler, linker, etc.)
support for checking them, and in fact such support is very rarely
provided, although it is *legal* to do so.

(An implementation *is* required to check consistency *within* a
compilation unit and scope -- as you would minimally expect -- for
variables and for functions using the "modern" 1980s prototype syntax
but not for the legacy "K&R1" 1970 syntax.)

> "make" provides you with a separate
> language and interpreter (very different from C) that allows you to
> describe the relationships between your source and object files.  Not
> only is "make" not part of C/C++, you can even use alternatives such
> as "ant" or "cook".
> 
Agree there.  

> As P.J. Plaugher once said, "above 100,000 lines of code, we should
> all be coding in Ada".

Plauger.  The h belongs in Kernighan.  Or perhaps Knuth. :-)

- David.Thompson1 at worldnet.att.net



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2003-09-15  4:16 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-04 22:16 Using GNU make with ObjectAda Tim Spargo
2003-09-05 12:13 ` Georg Bauhaus
2003-09-06 12:21   ` Tim Spargo
2003-09-06 13:00     ` Marin David Condic
2003-09-06 14:37     ` Ludovic Brenta
2003-09-07 20:42       ` Robert I. Eachus
2003-09-15  4:16       ` Dave Thompson
2003-09-06 20:42 ` Guillaume Foliard
2003-09-08 13:48   ` Stephen Leake
2003-09-08 22:22     ` Guillaume Foliard
2003-09-09  0:05       ` Ludovic Brenta
2003-09-09 13:38       ` Stephen Leake
  -- strict thread matches above, loose matches on Subject: below --
2003-09-08  9:00 Lionel.DRAGHI

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox