with "gnade_common_ref";
project GNADE_ODBC_Build is

   Soversion := External ("soversion");

   type Lib_Type is ("static", "dynamic");

   Libtype : Lib_Type := external ("LIBTYPE");

   for Languages use ("Ada");

   --  We we only need gnu.ads, gnu-db.ads from ../support; the rest
   --  of the files in ../support go in libgnadecommon, which we don't
   --  need otherwise. However, if we don't depend on
   --  gnade_common_ref, there would be two packages installing
   --  gnu.ads, gnu-db.ads. That's a problem when one package is
   --  removed without the other. We also need libgnadecommon to
   --  install gnade.gpr.
   --
   --  So we just ignore the warning from dh_shlibdeps about the
   --  useless dependency on libgnadecommon.
   for Source_Dirs use ("../dbi/odbc", "tmp/odbc-prep");
   for Library_Dir use "tmp";
   for Object_Dir use "tmp/odbc-" & Libtype;

   for Library_Name use "gnadeodbc";
   for Library_Kind use Libtype;

   --  Library_Version is not used when Library_Kind is "static"
   for Library_Version use "libgnadeodbc.so." & Soversion;

   --  We want libgnadeodbc.so to contain a dynamic link to libodbc,
   --  so dh_shlibdeps will create the correct package dependencies.
   for Library_Options use ("-lodbc");

   package Compiler is
      Base_Switches :=
        ("-g",
         "-O2",
         "-gnat05",
         "-gnatfno",
         "-gnatwa",
         "-gnatVa");

      for Default_Switches ("Ada") use Base_Switches;

      --  This has generic formal subpgrogram parameters that are used
      --  only in the child packages.
      for Switches ("gnu-db-sqlcli-generic_attr.ads") use Base_Switches & ("-gnatwU");

   end Compiler;

end GNADE_ODBC_Build;
