From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Tools Generating Ada
Date: Sat, 08 Feb 2014 02:47:20 -0600
Date: 2014-02-08T02:47:20-06:00 [thread overview]
Message-ID: <85zjm2yorr.fsf@stephe-leake.org> (raw)
In-Reply-To: 5a341bef-ace4-468c-b5b6-55d46868d802@googlegroups.com
vincent.diemunsch@gmail.com writes:
> Hello everybody,
>
> I have a question regarding Ada Code Generation tools, like Aflex /
> Ayacc for instance. How can I insert them into the automatic build
> process ?
Yes; you have to write an XML file to tell gprbuild about the tool.
I did this for Auto_Text_IO, which produces *.Text_IO packages from Ada
packages.
The process is not well documented, and the XML file often needs
tweaking with new releases of the GNAT compiler; I submit a bug report
to find out how to tweak. I don't recommend doing this without an
AdaCore support contract. Unless you have read and understand all of the
gprbuild source :).
>I use GNAT GPL, so is it possible to create a GPRBuild
> project that generates Ada files from an AYacc source and then compile
> the Ada sources ?
That takes two projects, to keep the source information distinct.
>Do I need to use a make file ?
No, the project that compiles the Ada code can 'with' the project that
produces the Ada code.
However, gprbuild doesn't always get the dependencies right; sometimes
you have to run it twice.
>Where can I find
> examples ?
Here. This works with GNAT 7.1.2, and probably with GPL 2013:
with "sal_text_io";
project Common_Text_IO is
for Languages use ("Auto_Text_IO");
for Source_Dirs use
("../1553",
"../base",
"../base/test",
"../models",
"../../opentoken");
for Object_Dir use "auto";
for Source_Files use
("gds-hardware-bus_1553-time_tone.ads",
"gds-unconstrained_arrays.ads",
"simple_flight-rwa.ads",
"simple_flight-safehold_css.ads");
package Compiler is
for Default_Switches ("Auto_Text_IO") use ("-05");
end Compiler;
end Common_Text_IO;
with "opentoken";
with "sal";
with "standard_common";
with "../common_text_io";
project GDS is
for Source_Dirs use
("../auto",
"../../1553",
"../../asist_if",
"../../base",
"../../fpga",
"../../hardware",
"../../itos_if",
"../../models",
"../../models/sofa",
"../../spacewire",
"../../system",
"../../windows");
for Object_Dir use "objects";
for Exec_Dir use ".";
for Languages use ("Ada", "C");
package Compiler is
for Default_Switches ("Ada") use
Standard_Common.Compiler.Release_Switches &
Standard_Common.Compiler.Style_Checks &
Standard_Common.Compiler'Default_Switches ("Ada");
for Local_Configuration_Pragmas use "../gnat_config_pragmas.adc";
for Default_Switches ("C") use Standard_Common.Compiler.Release_Switches_C;
end Compiler;
package Binder is
for Default_Switches ("Ada") use Standard_Common.Binder'Default_Switches ("Ada");
end Binder;
package Builder is
for Default_Switches ("Ada") use Standard_Common.Builder'Default_Switches ("Ada");
-- We use ".exe" extension even on non-Windows, to simplify the makefiles.
for Executable_Suffix use ".exe";
end Builder;
end GDS;
---- auto_text_io.xml -----
<?xml version="1.0" ?>
<!-- Run auto_text_io
To tell gprbuild how to run auto_text_io:
copy this file to <gnat>/share/gprconfig
use gprbuild - -autoconf
-->
<gprconfig>
<compiler_description>
<name>Auto_Text_IO</name>
<executable prefix="-1">auto_text_io.exe</executable>
<languages>Auto_Text_IO</languages>
<version>
<external>auto_text_io.exe -?</external>
<grep regexp="auto_text_io version .*"/>
</version>
<!-- target must match gprconfig target -->
<target>
<external>${PREFIX}gcc -dumpmachine</external>
<grep regexp="[^\r\n]+"></grep>
</target>
</compiler_description>
<configuration>
<compilers>
<compiler language="Auto_Text_IO"/>
</compilers>
<config>
package Compiler is
for Driver ("Auto_Text_IO") use "${PATH(auto_text_io)}auto_text_io.exe";
for Include_Path ("Auto_Text_IO") use "ADA_INCLUDE_PATH";
for Required_Switches ("Auto_Text_IO") use ("-f");
for Dependency_Switches ("Auto_Text_IO") use ("-M");
end Compiler;
package Naming is
for Body_Suffix ("Auto_Text_IO") use ".ads";
end Naming;
for Inherit_Source_Path ("Auto_Text_IO") use ("Ada");
for Object_Generated ("Auto_Text_IO") use "false";
</config>
</configuration>
</gprconfig>
--
-- Stephe
next prev parent reply other threads:[~2014-02-08 8:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-07 8:57 Tools Generating Ada vincent.diemunsch
2014-02-07 9:34 ` Jacob Sparre Andersen
2014-02-07 9:41 ` Simon Wright
2014-02-07 16:32 ` Pascal Obry
2014-02-08 8:33 ` vincent.diemunsch
2014-02-07 16:52 ` Vadim Godunko
2014-02-07 19:32 ` gautier_niouzes
2014-02-08 8:47 ` Stephen Leake [this message]
2014-02-11 17:48 ` Vincent DIEMUNSCH
2014-02-11 21:08 ` briot.emmanuel
2014-02-12 11:52 ` Vincent DIEMUNSCH
2014-02-12 13:38 ` Pascal Obry
2014-02-12 16:18 ` Robert A Duff
2014-02-13 15:31 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox