Gnat and multiple naming conventions

From: Ben Horowitz (bhorowitdevnull_at_yahoo.com)
Date: 01/30/04


Date: 29 Jan 2004 16:07:22 -0800

I am trying to compile a program with gnat, and am running into some
funny issues with naming.

I have two sets of files, with different naming conventions. One set,
a part of ORBexpress, follows the .ads/.adb convention. I don't have
the .adb files; instead I have the corresponding .ali and .o files.

The other set of files, part of software that I'm trying to get to
compile under gnat, follows the .1.ada/.2.ada convention.

I would like, insofar as possible, to (a) retain the .1.ada/.2.ada
convention for the files that follow that convention already [we have
thousands of files, and renaming them, even with gnatchop, would be
unpleasant]; and (b) use gnatmake for compilation [other developers I
work with would eventually like to use GPS for building files, and GPS
uses gnatmake].

I have tried creating two project files for this naming scenario;
these appear below. The first project file, ois.gpr, uses the
.ads/.adb convention. The second file, for my code, "withs" ois.gpr
and uses the .1.ada/.2.ada convention.

When I compile using gnatmake, I get the following error messages
(this is an excerpt; the full output of gnatmake appears below):

gnatmake: "corba.2.ada" not found
gnatmake: "corba-boa.2.ada" not found
gnatmake: "corba-command_line.2.ada" not found
gnatmake: "corba-orb.2.ada" not found
gnatmake: "corba-impl.2.ada" not found
gnatmake: "corba-impl-servant.2.ada" not found
gnatmake: "corba-request.2.ada" not found
gnatmake: "corba-serverrequest.2.ada" not found
gnatmake: "corba-stream.2.ada" not found
gnatmake: "corba-stream-time_optimized.2.ada" not found
gnatmake: "corba-object.2.ada" not found
gnatmake: "corba-object-helper.2.ada" not found
gnatmake: "corba-impl-server.2.ada" not found

It would appear that gnatmake is interpreting my project files to
mean: always use the .1.ada/.2.ada convention. When I "with" ois.gpr,
the second project file, gnatmake does not understand this to mean:
use the .ads/.adb convention for the ORBexpress files.

Is there any way to inform gnatmake to use the .1.ada/.2.ada
convention for my code, and the .ads/.adb convention for the
ORBexpress files?

I am using gnatpro 3.16a1.

Thanks,
Ben

--------------------

Project file for ORBexpress:
(Note the naming section.)

project OIS is

   for Languages use ("Ada");
   for Source_Dirs use ("include\");
   for Object_Dir use "lib\";

   package Naming is
      for Specification_Suffix ("Ada") use ".ads";
      for Implementation_Suffix ("Ada") use ".adb";
      for Separate_Suffix use ".adb";
      for Casing use "lowercase";
      for Dot_Replacement use "-";
   end Naming;

   package Builder is
      for Default_Switches ("Ada") use ("-s", "-k", "-gnatf",
"-gnatv");
   end Builder;

   package Compiler is
      for Default_Switches ("Ada") use ("-gnatf", "-gnatv");
      for Default_Switches ("c") use ("");
      for Default_Switches ("c++") use ("");
   end Compiler;

   package Binder is
      for Default_Switches ("Ada") use ("-E", "-static");
   end Binder;

   package Linker is
      for Default_Switches ("Ada") use ("-g");
   end Linker;

   package Pretty_Printer is
      for Default_Switches ("Ada") use ("");
   end Pretty_Printer;

end OIS;

--------------------

Project file for files following the .1.ada/.2.ada naming convention:

with "ois.gpr";

project Test is

   for Languages use ("Ada");
   for Source_Dirs use ("src\");
   for Object_Dir use "obj\";
   for Exec_Dir use "bin\";
   for Main use ("client", "server");

   package Naming is
      for Specification_Suffix ("Ada") use ".1.ada";
      for Implementation_Suffix ("Ada") use ".2.ada";
      for Separate_Suffix use ".1.ada";
      for Casing use "lowercase";
      for Dot_Replacement use "-";
   end Naming;

   package Builder is
      for Default_Switches ("Ada") use ("-s", "-k", "-gnatf",
"-gnatv",
         "-vP2");
   end Builder;

   package Compiler is
      for Default_Switches ("Ada") use ("-gnatf", "-gnatv");
      for Default_Switches ("c") use ("");
      for Default_Switches ("c++") use ("");
   end Compiler;

   package Binder is
      for Default_Switches ("Ada") use ("-E", "-static");
   end Binder;

   package Linker is
      for Default_Switches ("Ada") use ("-g");
   end Linker;

   package Pretty_Printer is
      for Default_Switches ("Ada") use ("");
   end Pretty_Printer;

end Test;

--------------------

Output of
gnatmake -PTest.gpr

test.gpr:3:20: warning: file name does not match unit name, should be
"start_here.gpr"
gcc -c -gnatf -gnatv -o
d:\projects\ois_demos\start_here\obj\client.2.o
-gnatec=d:\projects\ois_demos\start_here\obj\GNAT-TEMP-000001.TMP
-gnatf -gnatv -I- -gnatA -x ada
d:\projects\ois_demos\start_here\src\client.2.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Compiling: d:\projects\ois_demos\start_here\src\client.2.ada (source
file time stamp: 2003-08-27 01:19:58)
 131 lines: No errors
gcc -c -gnatf -gnatv -o
d:\projects\ois_demos\start_here\obj\counter.2.o
-gnatec=d:\projects\ois_demos\start_here\obj\GNAT-TEMP-000001.TMP
-gnatf -gnatv -I- -gnatA -x ada
d:\projects\ois_demos\start_here\src\counter.2.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Compiling: d:\projects\ois_demos\start_here\src\counter.2.ada (source
file time stamp: 2004-01-28 23:48:26)
 99 lines: No errors
gcc -c -gnatf -gnatv -o
d:\projects\ois_demos\start_here\obj\counter-helper.2.o
-gnatec=d:\projects\ois_demos\start_here\obj\GNAT-TEMP-000001.TMP
-gnatf -gnatv -I- -gnatA -x ada
d:\projects\ois_demos\start_here\src\counter-helper.2.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Compiling: d:\projects\ois_demos\start_here\src\counter-helper.2.ada
(source file time stamp: 2004-01-28 23:48:26)
 82 lines: No errors
gcc -c -gnatf -gnatv -o
d:\projects\ois_demos\start_here\obj\counter-impl.2.o
-gnatec=d:\projects\ois_demos\start_here\obj\GNAT-TEMP-000001.TMP
-gnatf -gnatv -I- -gnatA -x ada
d:\projects\ois_demos\start_here\src\counter-impl.2.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Compiling: d:\projects\ois_demos\start_here\src\counter-impl.2.ada
(source file time stamp: 2003-08-27 01:19:58)
 51 lines: No errors
gcc -c -gnatf -gnatv -o
d:\projects\ois_demos\start_here\obj\server.2.o
-gnatec=d:\projects\ois_demos\start_here\obj\GNAT-TEMP-000004.TMP
-gnatf -gnatv -I- -gnatA -x ada
d:\projects\ois_demos\start_here\src\server.2.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Compiling: d:\projects\ois_demos\start_here\src\server.2.ada (source
file time stamp: 2003-08-27 01:19:58)
 118 lines: No errors
gnatmake: "corba.2.ada" not found
gnatmake: "corba-boa.2.ada" not found
gnatmake: "corba-command_line.2.ada" not found
gnatmake: "corba-orb.2.ada" not found
gnatmake: "corba-impl.2.ada" not found
gnatmake: "corba-impl-servant.2.ada" not found
gnatmake: "corba-request.2.ada" not found
gnatmake: "corba-serverrequest.2.ada" not found
gnatmake: "corba-stream.2.ada" not found
gnatmake: "corba-stream-time_optimized.2.ada" not found
gnatmake: "corba-object.2.ada" not found
gnatmake: "corba-object-helper.2.ada" not found
gnatmake: "corba-impl-server.2.ada" not found

--------------------



Relevant Pages

  • Re: gnatmake command line parameter - newbie question
    ... just typing "gnatmake" without any arguments ... invoke compiler with temp mapping file ... -vPx Specify verbosity when parsing GNAT Project Files ... -cargs opts opts are passed to the compiler ...
    (comp.lang.ada)
  • Re: Ada for 1st year students
    ... gnatmake has switches to tell it ... The first programs might need to with other units, ... source files in one working directory. ... years of experience in teaching how to use a compiler. ...
    (comp.lang.ada)
  • Re: Instantiating generics
    ... demostration.adb:8:18: warning: not dispatching (must be defined in a package spec) ... gnatmake: "demostration.adb" compilation error ... Albert ...
    (comp.lang.ada)
  • Re: Class hierarchy of exceptions (Ada, C++)
    ... Ioannis Vranos wrote: ... >> Actually most compilers provide warnings for lots of stuff and provide ... The question is not only about compiler warnings or errors. ... gnatmake: "temp.adb" compilation error ...
    (comp.lang.cpp)
  • Re: Class hierarchy of exceptions (Ada, C++)
    ... Ioannis Vranos wrote: ... >> Actually most compilers provide warnings for lots of stuff and provide ... The question is not only about compiler warnings or errors. ... gnatmake: "temp.adb" compilation error ...
    (comp.lang.ada)