This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] new "-margs" flag to gnatmake


gnatmake currently handle multiple "-cargs", "-bargs" or "-largs" sections, however
it is not currently possible to go back to the "normal" section, this is
annoying for GNOME-like xxx-config tools. One wants to be able to build
an Ada program using packages p1 and p2 in one short invocation:

gnatmake main `p1-config` `p2-config`

xxx-config providing the needed flags to go after specs and libraries.
If one of such xxx-config needs to provide "normal" flags to gnatmake
it can't do so since there is no way to tell gnatmake
to process "normal" args after it has gone into "-xargs" mode.

gcc/ada/make.adb:

   type Make_Program_Type is (None, Compiler, Binder, Linker);

   Program_Args : Make_Program_Type := None;

...

      --  Then check if we are dealing with a -cargs, -bargs or -largs

      elsif (Argv (1) = Switch_Character or else Argv (1) = '-')
        and then (Argv (2 .. Argv'Last) = "cargs"
                   or else Argv (2 .. Argv'Last) = "bargs"
                   or else Argv (2 .. Argv'Last) = "largs")
      then
         if not File_Name_Seen then
            Fail ("-cargs, -bargs, -largs ",
                  "must appear after unit or file name");
         end if;

         case Argv (2) is
            when 'c' => Program_Args := Compiler;
            when 'b' => Program_Args := Binder;
            when 'l' => Program_Args := Linker;

            when others =>
               raise Program_Error;
         end case;

The intended modification is to add a "-margs" going back in
Program_Args = None, plus may be a few things I haven't thought about
(detection of the target name probably).

Are people okay with the idea before I really implement it? I'll
submit a documentation patch of course, but since there's no doc file
to patch against yet in CVS I have to wait a bit :).

PS: the current workaround is something like:

gnatmake `p1-config --margs` `p2-config --margs` main `p1-config --cargs --largs` `p2-config --cargs --largs`

which is a bit cumbersome and defeats the original intent of
simplicity.

-- 
Laurent Guerby <guerby@acm.org>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]