comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: how to tell gnatmake to send executables to a different directory when compiling multi source?
Date: Mon, 30 Jul 2012 04:05:35 -0700 (PDT)
Date: 2012-07-30T04:05:35-07:00	[thread overview]
Message-ID: <0ddccceb-c5ef-408a-b336-7cd2cd272ff8@googlegroups.com> (raw)
In-Reply-To: <op.wh88uluwka8ora@aspire.local>

Vasiliy Molostov wrote on comp.lang.ada:
> Ludovic Brenta <ludovic@ludovic-brenta.org> писал(а) в своём письме Mon,  
> As we can see from predefined make rules
> 
> %.o: %.c
> 
> which means that C input source file has a direct correspondence to a  
> resulting object file, and which is not applicable to gnat ada sources at  
> all. Make is a general tool supporting that strict input-output pairing  
> correspondence approach.
> 
> As for dependencies of C code and header files (*.h) they are come from  
> gcc autogenerated dependencies, lately included into makefile as a part.

Don't you see how wrong this approach is?
- The Makefile must call gcc -M to generate the dependencies and store
  them in a file
- The Makefile *cannot* include the generated dependency file while it
  runs
- therefore you must run make twice: (1) to generate the dependency info
  and (2) to build using the dependency info.

Add to that that Make dependencies do not take compiler flags into account
(gnatmake does) and are therefore incomplete.  For example:

all: foo
foo: a.o b.o
        gcc -o $@ $<

is not good enough, even when supplemented by generated source
dependencies. Why? Because when CFLAGS contains -O3 or some explicit
option, cross-unit inlining comes into the picture, so a.o does not depend
on "just" b.o, it depends on a b.o compiled with the *same compiler
options*.  Make simply does not capture this dependency information.

> The way it works is similar to all C stuff, someone has even named
> it as dancing with a blade. Is it danger? Perhaps. Is it devil?

Yes.

> If someone fills that people in danger with that tool, please be so kind  
> to correct existing or to write a better tool, which is the right way, but  

Correcting make is impossible without breaking compatibility with existing
makefiles.  Therefore the only option is to replace make completely.
gnatmake and gprbuild exist for this very purpose; so do all of the make
alternatives mentioned elsewhere in this thread.

> as for me I am sick and tired from advices about devil things (like  
> ada.calendar.time), those came from personal desire, and produce only  
> warring about a need (a requirement!) of restrictive use, without  
> constructive movement forward.

The constructive movement forward is: use *existing* better tools.
If you still *must* use make, do that non-recursively.

> Do you plan to rewrite all these old good debian packages?

No. I have *already* written all my Debian packages non-recursively
and I routinely bypass upstream's fragile recursive makefiles with
one non-recursive, simple makefile and one GNAT project file.  And
I usually specify .SUFFIXES in most of my Makefiles because the
predefined rules just get in the way.

BTW, many "old good Debian packages" are actually old and bad; this
is being revealed by the growing number of build failures triggered
by parallelism.  To the point where many "old good Debian packages",
rather than fixing or rewriting their recursive makefiles completely,
disable parallel builds altogether.

>> dependencies between Ada units like gnatmake does; therefore Make
>> violates the Ada Reference manual.  In short, when compiling Ada you
>> *must* use gnatmake or its equivalent for another compiler than GNAT.
>> And yo *must* use whatever configuration file is appropriate for
>> gnatmake.
> 
> *must* should better sounds with *can*, since this approach relates to  
> GNAT only.  And as a consequence the GNAT compilation model approach can

No.  This approach exists with all Ada compilers and with several other
languages that mandate the precise tracking of dependencies between
compilation units like OCaml and, to a lesser extent, Java.
  
> not turn makefile into a devil thing. This is the same as personal haircut  
> can not turn outer world into an ambiguous state.

No.  While a personal haircut creates no danger, recursive makefiles do
create danger.

> So here we can see when "none of these deficiencies" becomes a need to  
> establish environment capabilities in "tls/ssl and etc" dependencies. So  
> the correct answer here is that GNAT Ada has some deficiencies but in  
> general they are different from C approach.

No. The reason for the existence of "configure" in AWS is because the
external, optional dependencies are not written in Ada.  In the Debian
package for AWS, I bypass configure and upstream's makefile completely.
Instead I use one non-recursive Makefile and one GNAT project file, as
usual.  This is fast and reliable.  And I don't need to call configure
because Debian allows me to control which external libraries must be
present before building AWS.

-- 
Ludovic Brenta.



  reply	other threads:[~2012-08-02 12:19 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-29  9:31 how to tell gnatmake to send executables to a different directory when compiling multi source? Nasser M. Abbasi
2012-07-29 10:00 ` Dmitry A. Kazakov
2012-07-29 11:35   ` Nasser M. Abbasi
2012-07-29 12:29     ` Patrick
2012-07-29 13:02       ` Nasser M. Abbasi
2012-07-29 13:49         ` Ludovic Brenta
2012-07-29 14:09           ` Nasser M. Abbasi
2012-07-29 15:35             ` Ludovic Brenta
2012-07-29 15:42               ` Patrick
2012-07-29 16:41                 ` Ludovic Brenta
2012-07-29 16:46                   ` Patrick
2012-07-29 17:35               ` Vasiliy Molostov
2012-07-29 19:40                 ` Dmitry A. Kazakov
2012-07-29 22:22                   ` Vasiliy Molostov
2012-07-29 19:46                 ` Robert A Duff
2012-07-30  0:20                   ` Vasiliy Molostov
2012-07-30  3:01                     ` Nasser M. Abbasi
2012-07-30  4:48                       ` Nasser M. Abbasi
2012-07-30 21:05                         ` Robert A Duff
2012-07-30  5:50                       ` Dmitry A. Kazakov
2012-07-30 11:16                       ` Vasiliy Molostov
2012-07-30 12:25                         ` Georg Bauhaus
2012-07-30 12:59                           ` Vasiliy Molostov
2012-07-30 14:07                             ` Georg Bauhaus
2012-07-30 13:03                           ` Nasser M. Abbasi
2012-07-30 14:02                             ` Georg Bauhaus
2012-07-30 19:40                             ` J-P. Rosen
2012-08-01  7:32                               ` Miles Bader
2012-08-01  9:37                                 ` Ludovic Brenta
2012-08-02  5:01                                   ` Miles Bader
2012-08-01 15:15                                 ` J-P. Rosen
2012-08-02 15:08                                   ` Robert A Duff
2012-08-02 16:37                                     ` J-P. Rosen
2012-07-30 19:50                             ` Ludovic Brenta
2012-07-30  3:21                     ` Nasser M. Abbasi
2012-07-30  8:19                       ` Simon Wright
2012-07-30  6:12                     ` Dirk Heinrichs
2012-07-30  6:40                     ` Ludovic Brenta
2012-07-30 10:31                       ` Vasiliy Molostov
2012-07-30 11:05                         ` Ludovic Brenta [this message]
2012-07-30 11:33                           ` Simon Wright
2012-07-30 12:16                           ` Vasiliy Molostov
2012-07-30 12:48                             ` Ludovic Brenta
2012-07-30 13:09                               ` Vasiliy Molostov
2012-07-30  6:06                 ` Dirk Heinrichs
2012-07-29 12:31     ` Nasser M. Abbasi
2012-07-29 13:46       ` Ludovic Brenta
2012-07-29 14:15         ` Simon Wright
2012-07-29 13:54     ` Dmitry A. Kazakov
2012-07-29 14:16       ` Nasser M. Abbasi
2012-07-29 14:32         ` Dmitry A. Kazakov
2012-07-30  5:57     ` General purpose build tools (was: Re: how to tell gnatmake to send executables to a different directory when compiling multi source?) Dirk Heinrichs
2012-07-30 10:50       ` Vasiliy Molostov
2012-07-30 11:10         ` Ludovic Brenta
2012-07-30 12:39           ` Vasiliy Molostov
2012-08-30 10:49           ` General purpose build tools Stephen Leake
2012-07-29 18:33 ` how to tell gnatmake to send executables to a different directory when compiling multi source? björn lundin
2012-07-29 19:06 ` onox
2012-07-31 11:12 ` Patrick
2012-07-31 11:30   ` Dmitry A. Kazakov
2012-07-31 11:31     ` Dmitry A. Kazakov
2012-07-31 11:34       ` Patrick
2012-07-31 12:33   ` Ludovic Brenta
2012-07-31 15:14     ` Patrick
2012-07-31 16:04       ` Ludovic Brenta
replies disabled

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