comp.lang.ada
 help / color / mirror / Atom feed
* Creating and using Ada packages: need refinement
@ 2008-03-14 19:09 Ivan Levashew
  2008-03-15  0:32 ` Georg Bauhaus
  0 siblings, 1 reply; 20+ messages in thread
From: Ivan Levashew @ 2008-03-14 19:09 UTC (permalink / raw)


Hello!

My question is: how to create flexible Ada packages and what should they 
look like? Enlist the make variables, for example. I'm not happy with 
what I currently see. Ada packages are not easy to finetune.

Let's suppose that our project is rather complex. It contains both Ada 
and C code and may be C++.

Let's start with the following list:
ADA=                          gnatgcc, gcc
Name of the compiler used to compile Ada. Different compilers can be 
used to compile Ada, C and C++. In particular, different instances of 
GCC. On the most OSes it's $(which gcc), but on FreeBSD and Mac OS X 
it's better to use another compiler for C and C++. On FreeBSD Ada 
compiler is based on GCC 3.x, and on Mac OS X Apple GCC is supposed to 
be used instead of FSF one. So the ./configure script should first look 
for gnatgcc.
ADAFLAGS=                     -I. -O2
Flags used when invoking $(ADA)
CC=                           gcc
C compiler invokation command
CXX=                          g++
C++ compiler invokation command
CFLAGS=                       -g -O2
C-specific flags (not applicable to C++)
CXXFLAGS=                     -g -O2
C++-specific flags
CPP=                          gcc -E
C preprocessor invokation command
CXXCPP=                       g++ -E
INCLUDES, DEFS, LIBS
Additional flags.

The rightest way to call C compiler so far:
$(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)

I also saw: $(AM_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES)

The rightest way to invoke Ada compiler (?? not sure)
$(ADA) $(ADAFLAGS) -c
Adaproject-created project's Makefile contained ${ADA} ${ADAFLAGS}. ${} 
instead of $(). Does it make any sense?

Next.
GNATBIND, GNATLINK, GNATMAKE
usually correspond to gnatbind, gnatlink and gnatmake
GNATMAKEBINDFLAGS, GNATMAKELDFLAGS -- I saw them in GtkAda. I think it's 
a bad idea. For example, GNATMAKELDFLAGS = -largs -L. -lgtkada 
$(GTK_LIBS) in the GtkAda's Makefile. I don't like it because it is 
supposed to be used with $(GNATMAKE). And what if one morning one would 
like to call $(GNATLINK) explicitly? So I suppose it would be better to 
define GNATBINDFLAGS, GNATLDFLAGS (or better name it GNATLINKFLAGS?) and 
GNATMAKEFLAGS.
So far, gnatmake invokation is:
$(GNATMAKE) -cargs $(ADAFLAGS) -bargs $(GNATBINDFLAGS) \
   -largs $(GNATLDFLAGS) -margs $(GNATMAKEFLAGS)

I also saw $(GNATFLAGS). Is it supposed to be passed to every gnat* 
command? Or does it serve the same purpose as ADAFLAGS, just another 
name? It looks like there was no strict convention in Ada packages. No 
any single de facto standard. Developers on OSes where compilation is 
easy didn't care much about flexibility of their packages. And I'm now 
gathering obstacle by obstacle because of this inflexibility.
Consider this example:
GtkAda-2.8.1/testgtk/Makefile:
GNATFLAGS = @CFLAGS@ -gnata -gnatws
Pass CFLAGS to gnat! Awful! Yeah, right, gnat knows that -arch ppc is a 
single argument, that ppc is not a project name or so.

I am to create crapload of shell scripts to make illusion that 
everything is OK. Illusion that GCC is the same for both Ada and C.
Instead of passing CFLAGS, etc. to ./configure I'd like to circumvent 
./configure-make mechanisms. CFLAGS and Co. are to be written to 
KRUNCH_* environment variables, and "gcc", "gnatmake" shell scripts are 
to pass all these flags to the actual compiler.

It is temporary solution, we can't accumulate krunches. So far, I'd like 
to see a guidelines in the "Ada programming" wikibook.

Another point:
I'd like to use Apple GCC as linker. Should I alter GNATMAKELDFLAGS with 
--LINK="" or ideal Ada packages must care about using the right compiler 
by itself? When gcc or g++ is used to link, they are referenced by 
$(CCLD) or $(CXXLD) respectivelly.

My point of view expresses my own only problems. I'd like my Ada 
packages to be convenient for use by everybody, so I encourage you to 
participate in creating a single de facto standard.



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

end of thread, other threads:[~2008-03-31 19:04 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-14 19:09 Creating and using Ada packages: need refinement Ivan Levashew
2008-03-15  0:32 ` Georg Bauhaus
2008-03-15  2:50   ` Ivan Levashew
2008-03-15 17:10     ` Simon Wright
2008-03-15 18:26       ` Ivan Levashew
2008-03-15 22:55         ` Ludovic Brenta
2008-03-16  1:52           ` Ivan Levashew
2008-03-26  9:30           ` Ivan Levashew
2008-03-26 10:37             ` Ludovic Brenta
2008-03-26 15:43               ` Ivan Levashew
2008-03-26 20:30                 ` Ludovic Brenta
2008-03-28 12:00                   ` Ivan Levashew
2008-03-28 15:31                     ` Eric Hughes
2008-03-28 15:51                     ` Georg Bauhaus
2008-03-28 19:06                     ` Steve Whalen
2008-03-30 11:11                       ` Ivan Levashew
2008-03-31 19:04                         ` Steve Whalen
2008-03-26 10:44             ` Georg Bauhaus
2008-03-26 15:32               ` Ivan Levashew
2008-03-26 15:48                 ` Ivan Levashew

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